-
Notifications
You must be signed in to change notification settings - Fork 79
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
ROS 2 port & Gazebo demos #118
base: ros2
Are you sure you want to change the base?
Conversation
Fix tf visual tools, add image transport dependency
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
@AndrejOrsula thank you so much for working on this. The progress looks awesome! I'll try to add a ROS 2 CI job to this, fork and complete ports of necessary packages of crigroup. The project seems to be not updated for some time and they seem a bit unresponsive from the PRs you linked, so I'm assuming it would be OK to fork and port it. I think we can figure out about the releases later. |
What's the status of this? :) Was planning to use moveit_calibration in my project. Anything I can help with? @Abishalini @vatanaksoytezer @AndrejOrsula |
Hello @ErikOrjehag, Thank you for commenting. As the next (and maybe final) step, |
Adding this line solved it: dlopen("/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0", RTLD_LAZY | RTLD_GLOBAL); Not a very elegant solution, I'm guessing the correct way would be to change something in the CMakeLists? At least now I'm up to speed with similar results as in your video: @AndrejOrsula How come you stopped porting at this step? Any particular pitfalls I should look out for? |
I did a kindy janky humble port of handeye as a ament_python package without the handeye_server and service messages because it was enough to get movit_calibration working. Also ported baldor to humble. Skipped criutils because it was not used in the files ran by movit_calibration. Was able to get some values out from clicking "solve" in the GUI before I left the office yesterday. Will experiment more today to see if I can use the calibration and that it is correct :) |
I am glad you were able to resolve the issue but I am unsure why it would be needed. Something might be missing but the current CMake setup for the Python wrapper worked for me when I tried it the last time.
I looked into porting
Good job! Looking forward to hear more. |
@AndrejOrsula Got it working, here I'm projecting a point in front of the robot back into the camera. I did however need to modify the output roll, pitch, yaw values from the calibration like this: <!-- Camera -->
<link name="camera_calibrated">
</link>
<!-- values copied from the gui of moveit_calibration -->
<xacro:property name="c_roll" value="3.1302"/>
<xacro:property name="c_pitch" value="-3.0507"/>
<xacro:property name="c_yaw" value="-1.5320"/>
<xacro:property name="c_x" value="0.0614"/>
<xacro:property name="c_y" value="0.0000"/>
<xacro:property name="c_z" value="0.0550"/>
<joint name="camera_calibrated_joint" type="fixed">
<origin
xyz="${c_x} ${c_y} ${c_z}"
<!-- NOTICE: that roll and pitch are switched with each other and
I need to negate the pitch and add 2 PI -->
rpy="${2*pi - c_pitch} ${c_roll} ${c_yaw}" />
<parent link="end_effector" />
<child link="camera_calibrated" />
</joint> |
@AndrejOrsula Any suggestion on how to proceed on this? It seems @crigroup doesn't really intend to support the Python packages anymore. I guess finding an alternative may be a better approach. |
Hello @lukicdarkoo, I am not aware of the current status of crigroup/handeye, nor any plans for "officially" porting this package to ROS 2 and its future maintenance. As discussed above, @ErikOrjehag was able to create a functional port to As for finding an alternative solver that is actively maintained, it might indeed be a better approach. For that, My personal opinion is that OpenCV's Surely, there are also other alternatives that could potentially be more suitable. Please, let us know if you have some suggestions. 😃 |
The OpenCV solvers are definitely a good path forward--I was working on that previously, and you can see my old branch here, https://github.com/ros-planning/moveit_calibration/tree/opencv-solvers. When MoveIt Calibration was originally written, these solvers didn't exist. I also remember working on porting the crigroup packages to ROS 2, although I don't know that I was able to get them all ported. I've neglected this package since I left PickNik. I'm glad there's still interest in getting it moved to ROS 2. |
@ErikOrjehag Following you work here I was able to get up to the "Error: Failed to load python module: handeye.calibrator" error. How were you able to get the calibration working beyond this point? I've built your humble port of handeye but I still get that error when I hit "Solve" in the calibration plugin. It seems like the moveit_calibration package is unable to find the handeye build files? I would really appreciate it if you could provide a bit more detail! Thank you! |
Actually I was able to resolve this today with debugging help from chatGPT. The problem was I did not clone and build the humble port of the baldor package made by @ErikOrjehag and then I also pip installed scipy. Then I was able to solve the calibration after obtaining samples! |
It has been a whole year since opening this PR during the previous World MoveIt Day. I think it is about time to finalize it. 😅 If nobody minds, I will work towards finishing it during this year's WMD. |
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
- This replaces ROS 1 solvers from crigroup Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
This PR is now ready for review. I updated the PR description. There are certainly improvements to the code that could be made, but I think it is in a good state to merge and then open new PRs to address tests, optimization and clean-up. |
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 for all your work on this! I left a few suggestions, but none of them are blockers. LGTM 👍
ss << " # --roll " << r_euler[0] << std::endl; | ||
ss << " # --pitch " << r_euler[1] << std::endl; | ||
ss << " # --yaw " << r_euler[2] << std::endl; | ||
} |
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 it'd be cleaner to put each of these blocks in a separate function: outputCalibrationPy
, outputCalibrationXml
, outputCalibrationYaml
.
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.
True! Thank you. Refactored in 23dd00b
I think there are several places like this where code style could be improved. However, I would rather do it after tests work so I don't accidentally break something.
ss << " -->" << std::endl; | ||
ss << "</launch>" << std::endl; | ||
} | ||
else if (file_name.endsWith(".yaml")) |
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 .yml
is also common.
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 was not aware of that in the context of ROS 2 launch files, but it makes sense. Thank you!
Added in 6712423
*error_message = "Unsupported handeye solver: " + solver_name; | ||
RCLCPP_ERROR_STREAM(LOGGER_CALIBRATION_SOLVER, *error_message); | ||
return false; | ||
} |
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 could be replaced with a map.
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's much cleaner.
Refactored in 0263c8c
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Thank you so much @JStech for taking a look at it! One thing I forgot to mention is that the Gazebo demos are now configured with an RGB-D camera. The depth is currently unused, but I think it would be cool if this package eventually supported hand-eye calibration also in unstructured environments (without fiducial markers/known patterns). |
Hello all! Thanks @AndrejOrsula for working on this port. I gave it a try using ROS 2 Humble and a Oak-D camera from Luxonis. The first thing I noted was that the camera intrinsics were not being set correctly. I found out that only the first camera info message received was being evaluated. If This PR updates the logic such that the |
} | ||
}; | ||
|
||
const std::string LOGNAME = "handeye_target_base"; | ||
rclcpp::Clock clock; |
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 clock
variable is not being used.
Another update for your consideration, is adding support for the rational polynomial distortion model. I've made the changes in my fork. Should I create a PR for this update? If so, should it be to @Abishalini's repo? Any comments/suggestions are more than welcomed. Thanks! Credit goes to this PR that was merged for ROS 1. |
Hello there, First of all, thanks for all the work put into this, this tool in ROS2 will prove useful for many. Just wondering if there were any plans to merge this PR since there were other proposals made by other forks such as this fork from @sgarciav.
Seems like there a few PRs related to a ROS2 port now with different features. It could be nice to address new improvements in different PRs as stated and have a stable branch for ROS2 with this port by now. Warm regards, thanks to everyone. |
This PR ports
moveit_calibration
to ROS 2. It is a direct continuation of #101 by @Abishalini and @vatanaksoytezer.Besides the progress from last year:
moveit2_tutorials
in this PR.tf2_ros/static_transform_publisher
node using the estimated extrinsics.Two of the Gazebo demos can be seen below:
moveit2_calibration.mp4
Note: I tried the official Gazebo config under moveit2_tutorials, but I couldn't get it to work for the demos. I had to use my own Panda config (https://github.com/AndrejOrsula/panda_ign_moveit2) in order to support Gazebo/Ignition plugins required for the demos (requires launch scripts that export SDF before starting Gazebo, and some plugins must be defined under the SDF of the model such as the
DetachableJoint
).Tested on ROS 2
humble
& Gazebofortress
.iron
/rolling
yet (waiting forgz_ros2_control
).garden
. It should technically work, but there were some issues compilinggz_ros2_control
when I tried it.The
moveit_calibration_demos/.docker
directory currently provides some custom helper scripts. I can see in several MoveIt 2 repositories that extensively usedocker-compose
instead. Please, let me know if you want to change it todocker-compose
(I might need some help with GUI and GPU, though).Try it out!
With this one-liner, you can test the Gazebo demos yourself inside a single Docker container! It automatically pulls the pre-built image from Docker Hub and runs it with the required flags (tested on Ubuntu 22.04 with NVIDIA GPU, but rendering might NOT be functional out-of-the-box on some machines).
There are 3 additional demos that you can try for eye-in-hand & eye-to-hand using ChArUco or ArUco patterns (no setup required, just change the command).
ros2 launch moveit_calibration_demos gz_eye_to_hand_charuco.launch.py
ros2 launch moveit_calibration_demos gz_eye_in_hand_aruco.launch.py
ros2 launch moveit_calibration_demos gz_eye_to_hand_aruco.launch.py
6 June 2022: Original PR description (Click to expand)
Below is a short video to illustrate the current state of this PR (6 June 2022).
moveit_calibration_ros2_wip_demo.mp4
Missing features
HandEyeSolverDefault::solve()
needs to be ported to ROS 2. This function relies on Python module implemented in crigroup/handeye ROS package. To finalise this PR, crigroup/handeye needs to be ported to ROS 2 (or some alternativesolve()
method needs to be implemented).Tests need to be tested and fixed.
Otherwise, everything else that is essential seems to be functional. Most GUI elements were checked, but anything that requires the calibration to be "solved" was not tested for obvious reasons.
Note to maintainer(s): Please, change the target of this PR if desired.
Note to reviewer(s): I had difficulties getting
pluginlib
classes to be exported correctly at the beginning, so I ended up rewriting CMake config. Please, check that everything is MoveIt compatible (commit=1a81445).