Skip to content
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

Add an auto-camera calibration script #48

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

amalnanavati
Copy link
Contributor

@amalnanavati amalnanavati commented Oct 15, 2024

Description

This PR adds an auto-camera calibration script. Through command-line interaction, it interactively guides the user to place a charucoboard in front of the robot (the parameters for the charucoboard should already be specified in config/calibrate_camera.yaml). Then, the robot moves the arm in a star around its hardcoded starting configuration, varying roll and pitch as it goes, to gather samples. It then runs eye-in-hand camera calibration using those samples, using the config-specified method (I empirically found that Andreff worked best).

Note that when computing the translation and rotation error, we first get the predicted charucoboard pose in robot frame for all of the samples. We then compute the translation/rotation distances between every pair of samples, and take the median of those distances.

This procedure should be re-run every time the eye-in-hand system is modified, e.g., unscrewed/rescrewed, some 3D printed components were replaced, etc.

Testing

  • Pull this branch, re-build the workspace.
  • Modify the parameters in config/calibrate_camera.yaml to your charucoboard as necessary.
  • Test online camera calibration:
    • Run the camera calibration code: python3 src/ada_ros2/ada_calibrate_camera/calibrate_camera_start.py
    • Follow the on-screen instructions to gather samples calibrating the camera.
    • Once the procedure is done, copy-paste the translation and rotation error below.
Rotation error: 0.016380652571024775
Translation error: 0.004512129207414376
R_cam2gripper: [ 0.00238821 -0.12084312  0.99259871  0.01179148]
R_cam2gripper: [ 3.1187588  -0.00759098 -0.24220932]
T_cam2gripper: [[ 0.03562513]
 [ 0.13481861]
 [-0.05481037]]
- [x] Terminate camera calibration code: `python3 src/ada_ros2/ada_calibrate_camera/calibrate_camera_start.py -c`
  • Test offline camera calibration:
    • Change config/calibrate_camera.yaml to run offline, point it to the new data directory that was created above, and run all the camera calibration methods.
    • Run ros2 run ada_calibrate_camera calibrate_camera --ros-args --params-file <path/to/ada_ros2>/ada_calibrate_camera/config/calibrate_camera.yaml
    • Paste the translation and rotation errors across methods below (same as above)
  • Test the feeding demo with the new calibration:
    • Launch the feeding demo: python3 src/ada_feeding/start.py
    • Test the acquisition of 3 bites, verify the camera is centered.

# save the files to the built package's share directory, which hinders pushing it to Github.
data_dir: "~/Workspaces/ada_ws/src/ada_ros2/ada_calibrate_camera/data"
# Where to save the calibration results
output_calib_name: ~/Workspaces/ada_ws/src/ada_ros2/ada_calibrate_camera/config/calibs/auto.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Change to ~/Workspace to align with lovelace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants