In this section, I will explain how to set up realsense working with ROS and detecting AprilTags
First, set up and calibrate the realsense camera using the realsense dynamic calibration tool (https://www.intel.com/content/www/us/en/download/645988/intel-realsense-d400-series-dynamic-calibration-tool.html). If you are using the lab realsense or have already done this step before, you do NOT need to do it again.
Next, navigate to your ros workspace and clone the following repository into the src/ folder:
https://github.com/IntelRealSense/realsense-ros.git
After cloning the repository, make sure you switch the branch to ros1-legacy by running the command "git checkout ros1-legacy". Now, navigate to the ros source directory using the command "roscd" and run "catkin_make".
Note: If errors occur when running roscd, manually navigate to the ros workspace and run "source devel/setup.bash"
Now, run the command "roslaunch realsense2_camera rs_camera.launch filters:=pointcloud"
When checking rviz, you should see a point cloud appear after subscribing to the topic!
Now, we will set up the AprilTag repository
Navigate back to your ros workspace's src/ folder. Clone the following repository:
https://github.com/AprilRobotics/apriltag_ros
Also, install the apriltag library through: sudo apt install ros-noetic-apriltag
After cloning the repository, you will first need to set up the config file based on the AprilTags you will be using. In our case, we are using the tag ID's 0, 1, 2, 3.
Navigate to the config/ folder and open tags.yaml in your favorite text editor.
Now, in the standalone tags array, set it up however you like. In our case, it will look something like this:
standalone_tags:
[
{id: 0, size: 88, name: tag0},
{id: 1, size: 88, name: tag1},
{id: 2, size: 88, name: tag2},
{id: 3, size: 88, name: tag3},
]
Note: For the size, make sure you measure it to ensure it is accurate to your tag.
Now, if it still isn't running, relaunch the realsense node using the earlier commad:
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
Now, run the following command:
roslaunch apriltag_ros continuous_detection.launch
When opening rviz, the TF messages of the april tags will now be broadcasted to the system. If you subscribe to the TF messages, you should see that the tag and the point cloud should line up!
You have now set up apriltag and realsense in ros!