orjano-max / ORJANOS_MASTER_REPO

This is the github repo for orjano's master thesis
1 stars 0 forks source link

CAMERA CALIBRATION REALSENSE ROS" FOXY XAVIER #2

Closed orjano-max closed 1 year ago

orjano-max commented 1 year ago

Calibrate camera on xavier2 using ros2 foxy:

1. Install usb_cam ros package

sudo apt-get install ros-foxy-usb-cam

2. Install camera calibration

sudo apt-get install ros-foxy-image-pipeline

this installs several packages including camera calibration

3. Set up parameter file:

Copy "params.yaml" and "camera_info.yaml" from the ros2 usb_cam repo: https://github.com/ros-drivers/usb_cam/tree/ros2/config

In the yaml file, change "image_width", "image_height", "video_device" and "camera_name" to fit your camera. Also change "camera_info_url" to point to the "camera_info.yaml" file that you are using. If the file is stored in your file system, remember to use "file://" at the beginning of the path. Example:

  camera_info_url: "file:///home/xavier2/camera_info.yaml"

4. Launch camera using ros wrapper

Run camera in ros with the ros package usb_cam. Remember to add your own parameter file path after "--params-file"

ros2 run usb_cam usb_cam_node_exe --ros-args --params-file /home/xavier2/params.yaml

The camera feed can be checked in rviz2 by adding the /image_raw topic,

5. Run the camera calibration ros node

Run the camera calibration node using the following command:

ros2 run camera_calibration cameracalibrator --size 9x6 --square 0.026 image:=/image_raw

This tutorial takes you through the calibration: https://navigation.ros.org/tutorials/docs/camera_calibration.html

6. Copy Results into camera_info.yaml file

After pressing "Save" dusring calibration, the calibration data is saved under /tmp/calibrationdata.tar.gz”. Unzip this folder and open it. there should be a ".yaml" file there contining calibration information. Copy the calibration contents of the ".yaml" file into your own camera_info.yaml" file and the calibration is done! PS: I DID NOT COPY THE CAMERA NAME. ONLY THE DATA FROM THE MATRICES