-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pr-add handeye calibration rviz plugin #4
Pr-add handeye calibration rviz plugin #4
Conversation
Copy @felixvd 's comments here: @RoboticsYY As I mentioned in #1070 already, I love this effort. Great job. I don't know where best to put the discussion, but as we found one bug in the code of this PR, I'll add comments as I go. Some of these are mentioned in #1070. Sorry for the duplicates. Other comments:
|
|
||
// Initialize handeye solver plugins | ||
std::vector<std::string> plugins; | ||
if (loadSolverPlugin(plugins)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments:
This does not seem to populate the list when the plugin is part of the Rviz config file and is loaded when Rviz starts up. Maybe move this into a function that is called upon clicking the planning group dropdown box.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked into this. I do think the list is populated when the plugin is loaded from a config--that is, all the options are there. However, the solver that was selected and saved to the config doesn't get re-selected. It just loads the first one, which happens to be the Daniilidis solver. Is that the behavior you were referring to @felixvd ? (I have a fix here, which will be part of a PR to @RoboticsYY's branch soon.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been too long for me to remember, but it sounds like it might have been.
// ************************************************************** | ||
|
||
mhc::SensorMountType sensor_mount_type_; | ||
std::map<std::string, std::string> frame_names_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments:
This variable should be initialized, otherwise the "Save Camera Pose" button gives an "Empty Frame" error if the user left the "Sensor Mount Type" dropdown box on its default setting "Eye-to-Hand" without clicking on it.
I don't mind if it is done here as in the suggestion of in the cpp along with the rest here, but this took some error to find and was a confusing error.
std::map<std::string, std::string> frame_names_; | |
std::map<std::string, std::string> frame_names_ = "base"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment was really confusing to me until I found the original and realized it was from a different line. I've added an initialization for from_frame_tag_
to my PR.
|
||
if (from_frame.empty() || to_frame.empty()) | ||
{ | ||
QMessageBox::warning(this, tr("Empty Frame Name"), tr("Make sure you have set correct frame names.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
This error message could have been more helpful. Can you be more verbose?
|
||
auto_execute_btn_ = new QPushButton("Execute"); | ||
auto_execute_btn_->setMinimumHeight(35); | ||
auto_execute_btn_->setToolTip("Pause the auto calibration process"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
This tooltip seems to be outdated
auto_cal_layout->addLayout(auto_btns_layout); | ||
auto_plan_btn_ = new QPushButton("Plan"); | ||
auto_plan_btn_->setMinimumHeight(35); | ||
auto_plan_btn_->setToolTip("Start or resume auto calibration process"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
Same with this one.
layout->addLayout(calib_layout); | ||
|
||
// Calibration progress | ||
auto_progress_ = new ProgressBarWidget(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
Can this be initialized to 0% somehow? It looks like is loading and complete upon first opening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JStech IIRC when first opening the plugin, the bar is filled and animated, and does not look like it is displaying "0%". That seemed unintuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what's going on (from the Qt docs):
If minimum and maximum both are set to 0, the bar shows a busy indicator instead of a percentage of steps. This is useful, for example, when using QNetworkAccessManager to download items when they are unable to determine the size of the item being downloaded.
The best fix I could come up with is to disable the bar when the max is 0, which grays it out:
layout->addWidget(auto_progress_); | ||
|
||
// Pose sample tree view area | ||
QGroupBox* sample_group = new QGroupBox("Pose_sample"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
layout->addWidget(auto_progress_); | |
// Pose sample tree view area | |
QGroupBox* sample_group = new QGroupBox("Pose_sample"); | |
QGroupBox* sample_group = new QGroupBox("Pose Samples"); |
|
||
std::ostringstream ss; | ||
|
||
QStandardItem* child_1 = new QStandardItem("bTe"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
Do bTe and cTo mean "base_to_endeffector" and "camera_to_object"? I would rename them everywhere for readability. The current names are very cryptic.
} | ||
} | ||
|
||
void ControlTabWidget::resetSampleBtnClicked(bool clicked) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
Redundant comment, but I would rename this to "clearSamplesBtnClicked" and would appreciate a real "resetSampleBtnClicked" function that removes only a single sample from the tree.
} | ||
else | ||
{ | ||
ROS_ERROR_STREAM_NAMED(LOGNAME, "No available handeye calibration solver instance."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy @felixvd 's comments here:
I don't know if is this line that should be changed, but currently the solving pipeline fails silently, and the user does not know if there is an issue. At some point there should give an error popup instead of just a silent error stream.
44737a5
to
7211cc2
Compare
39eb2f6
to
f9b4f55
Compare
@JStech Thanks for testing and feeding back!
When the number of samples exceeds 5, the calculation happens each time a new sample is taken. I think it's a little bit confused as it happens in the background. When enough samples are taken, can click
I noticed from the photo that the move_group used
I think this wrong result mostly comes from OpenCV 3.2, which is the default version on Ubuntu 18.04. I have provided a new PR #5 to fix this by installing OpenCV 3.4 through Debian packages. In addition, the target detection result could be debugged visually through the TF frame of Rviz and FOV. If adding the TF tree to Rviz display panel, the coordinate frame of camera should show up. Another useful tool is the FOV display. If adding a marker array to Rviz display panel and selecting proper topic, the FOV of the camera should show up. And the coordinate frame of the target should locate within the FOV. There are sliders on the context widget to set the initial guess pose of the camera. The FOV is generated from the camera intrinsic parameters, thus a correct camera_info topic must be chosen at the |
OK, I got a calibration! Thank you! A couple things. I had to debug a stupid mistake on my part (apparently I never did a I was able to use the auto calibration to plan poses when I switched the Planning Group option on the Calibrate tab. (Great feature, by the way--thanks for implementing that.) However, it still occasionally would fail to move the arm, and then would give me the error, "Please check if move_group is started or there are recorded joint states." If I moved the arm using the MotionPlanning panel, it would usually start working again. I was also unable to get the FOV display. I added a MarkerArray display, and the topics available are /move_group/display_contacts, /move_group/display_cost_sources, /move_group/display_grasp_markers, and /rviz_visual_tools. I did have the ON/OFF set to on (well, I tried both, actually). I had issues with the cTo pose diverging again, so I upgraded to OpenCV 3.4. |
|
||
target_params_["marker_border"]->setText(QString("1")); | ||
target_params_["marker_border"]->setValidator(new QIntValidator(1, 4)); | ||
layout_left_top->addRow("Marker border (bits)", target_params_["marker_border"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurs to me (as I'm working on adding a plugin for a ChArUco board: #7) that these parameters are somewhat specific to the ArUco board. Would it be possible to have target plugins define the parameters and validations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! I think both of the aruco and charuco board needs two double parameter values, but actually the meaning of the values are different. For the aruco, they are maker size and marker spacing. And for the charuco, they are square size and marker size. And obviously, it's difficult to list all of the possibilities of different kind of board, because the parameters could be very different. I think it's possible to let the target plugin return a list of parameters and types, and the GUI components are initialized from this list. Do you think that would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems like the best way to handle it. I guess the HandEyeTargetBase class should similarly be updated to have more flexibility in the inputs to intialize
, setTargetIntrinsicParams
, and setTargetDimensions
. Maybe all that should go in a different PR.
|
||
target_real_dims_["marker_dist_real"]->setText("0.0066"); | ||
target_real_dims_["marker_dist_real"]->setValidator(new QDoubleValidator(0, 2, 4)); | ||
layout_left_bottom->addRow("Marker spacing (m)", target_real_dims_["marker_dist_real"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter, also, doesn't quite work for a ChArUco board
|
||
if (frame_source_ == CAMERA_FRAME) | ||
if (index != std::string::npos) | ||
addItem(QString(name.c_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is requiring that the camera coordinate frame have the string "camera" in it, correct? That seems too restrictive (in fact, just ran into this with a client using a camera node that didn't include "camera" in the frame). Maybe the filter here should also just be that the frame is not a robot link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this sort of default. Can we have the frames with "camera" listed at the top, maybe even as duplicates and separated by a "---" entry, and then list all the frames (except the robot links)?
A tooltip explaining which frame should go in here would also be very helpful.
b05ce3c
to
c698077
Compare
Hi, I am interested in using this tool as well. Amazing effort so far, I think this could be immensely useful. I built this branch https://github.com/JStech/moveit_calibration/tree/charuco-with-rviz for now to get it up and running. I'll point out any bugs or issues I find on this PR. Thanks! |
|
||
tab_control_ = new ControlTabWidget(); | ||
tab_control_->setTFTool(tf_tools_); | ||
connect(tab_context_, SIGNAL(sensorMountTypeChanged(int)), tab_control_, SLOT(UpdateSensorMountType(int))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing, but I believe this will not get changed if the user simply leaves the default sensor mount type as "eye-to-hand". I had to hunt this down since eventually I would run into the "Invalid key used for reading the frame names." error because from_frame_tag_ was never being set.
I had to toggle the sensor mount type to get around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I've fixed this in this branch by calling the sensor mount update when the panel is loaded. If you could give it a try and let me know if it's fixed, I'd appreciate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears to be fixed.
Possible bug in calibrate tab. If you load a saved joint state file and are doing an auto calibration, pressing plan then execute too quickly will freeze rviz. This requires a restart. If you wait some time for the planning animation to complete, this issue does not arise. I am able to consistently reproduce this, but it could be something specific to my moveit config setup if no one else can reproduce this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready to go. Are there any blocking issues I could help address?
I've addressed what I could in this PR. There are still some hiccups in the auto calibration process that could use some work, but it's usable as-is. I think we should merge this soon, so that the master branch is generally useful, and create issues from any remaining comments. |
As the original PR for this was opened over a year ago I think we should merge this now (there's been a lot of great work put into this) and any remaining concerns from e.g. @felixvd be turned into issues / feature requests. I keep hearing everyone is using a non-master branch of this repo, which is a bad practice to follow and a strong sign we should just merge it in because ppl are using it. |
+1 On merging current PR into master. I've been using this tool and have had to jump between branches making the version control more difficult. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @RoboticsYY , for pulling my changes. I think this is ready to go now--the "[WIP]" can be removed. I've opened #15 to discuss how we want to update the GUI to separate out the different functions currently wrapped up in the "Take Sample" button.
I'll also update the tutorial to match.
I think most comments have been addressed. At current stage, this package can be compiled and run as a package along with MoveIt with CI build passed. Thus I agree that it would be better to merge this PR first and then continue to make amends to GUI in other PRs. Thanks @JStech for implementing the changes! Thanks @felixvd @tandronescu @davetcoleman for your comments and keep tracking on the progress! |
This PR intends to add a handeye calibration rviz plugin. Any requested changes of MoveIt PR#1560 will be addressed here. For more info about the discussion can refer to MoveIt issue#1070.