-
Notifications
You must be signed in to change notification settings - Fork 307
Add ur_calibration package #451
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
| project(ur_calibration) | ||
|
|
||
| if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| add_compile_options(-Wall -Wextra -Wpedantic) | ||
| endif() | ||
|
|
||
| add_compile_options(-Wno-unused-parameter) | ||
|
|
||
| if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) | ||
| message("${PROJECT_NAME}: You did not request a specific build type: selecting 'RelWithDebInfo'.") | ||
| set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
| endif() | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| find_package(rclcpp REQUIRED) | ||
| find_package(ur_robot_driver REQUIRED) | ||
|
|
||
| find_package(Eigen3 REQUIRED) | ||
| find_package(yaml-cpp REQUIRED) | ||
| find_package(ur_client_library REQUIRED) | ||
|
|
||
| set(YAML_CPP_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR}) | ||
|
|
||
| ########### | ||
| ## Build ## | ||
| ########### | ||
|
|
||
| include_directories( | ||
| include | ||
| ${EIGEN3_INCLUDE_DIRS} | ||
| ${YAML_CPP_INCLUDE_DIRS} | ||
| ) | ||
|
|
||
| add_executable(calibration_correction | ||
| src/calibration.cpp | ||
| src/calibration_consumer.cpp | ||
| src/calibration_correction.cpp | ||
| ) | ||
| target_include_directories(calibration_correction PRIVATE include) | ||
| target_link_libraries(calibration_correction | ||
| ${YAML_CPP_LIBRARIES} | ||
| ur_client_library::urcl | ||
| ) | ||
| ament_target_dependencies( | ||
| calibration_correction | ||
| rclcpp | ||
| ur_robot_driver | ||
| ) | ||
|
|
||
| install(TARGETS calibration_correction | ||
| RUNTIME DESTINATION lib/${PROJECT_NAME} | ||
| ) | ||
|
|
||
| install(DIRECTORY include/ | ||
| DESTINATION include | ||
| ) | ||
|
|
||
| install(DIRECTORY launch | ||
| DESTINATION share/${PROJECT_NAME} | ||
| ) | ||
|
|
||
| ## Add gtest based cpp test target and link libraries | ||
| if(BUILD_TESTING) | ||
| find_package(ament_cmake_gmock REQUIRED) | ||
|
|
||
| # Get the first item (it will be the build space version of the build path). | ||
| list(GET ament_index_build_path 0 ament_index_build_path) | ||
| if(WIN32) | ||
| # On Windows prevent CMake errors and prevent it being evaluated as a list. | ||
| string(REPLACE "\\" "/" ament_index_build_path "${ament_index_build_path}") | ||
| endif() | ||
|
|
||
| ament_add_gmock( | ||
| calibration_test | ||
| test/calibration_test.cpp | ||
| src/calibration.cpp | ||
| ) | ||
| target_include_directories(calibration_test PRIVATE include ${EIGEN3_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIRS}) | ||
| target_link_libraries(calibration_test ${rclcpp_LIBRARIES} ${EIGEN3_LIBRARIES} ${YAML_CPP_LIBRARIES} ur_client_library::urcl) | ||
| endif() | ||
|
|
||
| ament_export_include_directories( | ||
| include | ||
| ) | ||
| ament_export_dependencies( | ||
| ur_robot_driver | ||
| rclcpp | ||
| ) | ||
| ament_package() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # ur_calibration | ||
|
|
||
| Package for extracting the factory calibration from a UR robot and changing it to be used by `ur_description` to gain a correct URDF model. | ||
|
|
||
| Each UR robot is calibrated inside the factory giving exact forward and inverse kinematics. To also | ||
| make use of this in ROS, you first have to extract the calibration information from the robot. | ||
|
|
||
| Though this step is not necessary, to control the robot using this driver, it is highly recommended | ||
| to do so, as end effector positions might be off in the magnitude of centimeters. | ||
|
|
||
| ## Nodes | ||
| ### calibration_correction | ||
| This node extracts calibration information directly from a robot, calculates the URDF correction and | ||
| saves it into a .yaml file. | ||
|
|
||
| In the launch folder of the ur_calibration package is a helper script: | ||
|
|
||
| ```bash | ||
| $ ros2 launch ur_calibration calibration_correction.py.launch \ | ||
| robot_ip:=<robot_ip> target_filename:="${HOME}/my_robot_calibration.yaml" | ||
| ``` | ||
|
|
||
| For the parameter `robot_ip` insert the IP address on which the ROS pc can reach the robot. As | ||
| `target_filename` provide an absolute path where the result will be saved to. | ||
|
|
||
| ## Creating a calibration / launch package for all local robots | ||
| When dealing with multiple robots in one organization it might make sense to store calibration data | ||
| into a package dedicated to that purpose only. To do so, create a new package (if it doesn't already | ||
| exist) | ||
|
|
||
| ```bash | ||
| # Replace your actual colcon_ws folder | ||
| $ cd <colcon_ws>/src | ||
| $ ros2 pkg create <organization_name>_ur_launch --build-type ament_cmake --dependencies ur_client_library \ | ||
| --description "Package containing calibrations and launch files for our UR robots." | ||
| # Create a skeleton package | ||
| $ mkdir -p <organization_name>_ur_launch/etc | ||
| $ mkdir -p <organization_name>_ur_launch/launch | ||
| $ echo 'install(DIRECTORY etc launch DESTINATION share/${PROJECT_NAME})' >> <organization_name>_ur_launch/CMakeLists.txt | ||
| $ colcon build --packages-select <organization_name>_ur_launch | ||
| ``` | ||
|
|
||
| We can use the new package to store the calibration data in that package. We recommend naming each | ||
| robot individually, e.g. *ex-ur10-1*. | ||
|
|
||
| ```bash | ||
| $ ros2 launch ur_calibration calibration_correction.py.launch \ | ||
| robot_ip:=<robot_ip> \ | ||
| target_filename:="$(ros2 pkg prefix <organization_name>_ur_launch)/share/<organization_name>_ur_launch/etc/ex-ur10-1_calibration.yaml" | ||
fmauch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| To make life easier, we create a launchfile for this particular robot. We base it upon the | ||
| respective launchfile in the driver: | ||
|
|
||
| ```bash | ||
| # Replace your actual colcon_ws folder | ||
| $ cd <colcon_ws>/src/<organization_name>_ur_launch/launch | ||
| $ cp $(ros2 pkg prefix ur_bringup)/share/ur_bringup/launch/ur_control.launch.py ex-ur10-1.launch.py | ||
| ``` | ||
|
|
||
| Next, modify the parameter section of the new launchfile to match your actual calibration: | ||
|
|
||
| ```py | ||
| kinematics_params = PathJoinSubstitution( | ||
| [FindPackageShare("<organization_name>_ur_launch"), "etc", "", "ex-ur10-1_calibration.yaml"] | ||
| ) | ||
|
|
||
| ``` | ||
|
|
||
| Then, anybody cloning this repository can startup the robot simply by launching | ||
|
|
||
| ```bash | ||
| # Replace your actual colcon_ws folder | ||
| $ cd <colcon_ws> | ||
| $ colcon build --packages-select <organization_name>_ur_launch | ||
| $ ros2 launch <organization_name>_ur_launch ex-ur10-1.launch.py | ||
| robot_ip:=xxx.yyy.zzz.www ur_type:=ur5e use_fake_hardware:=false launch_rviz:=true | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.