Skip to content

Instantly share code, notes, and snippets.

@cardboardcode
Last active September 16, 2022 16:34
Show Gist options
  • Save cardboardcode/3fe3d4d2604063aefe57fe1bd4549eac to your computer and use it in GitHub Desktop.
Save cardboardcode/3fe3d4d2604063aefe57fe1bd4549eac to your computer and use it in GitHub Desktop.
For People In A Hurry: Setting up to Detect AprilTag in ROS2

For People In A Hurry: Setting up to Detect AprilTag in ROS2

TLDR: This is a set of instructions to help set up necessary ROS2 packages to start detecting Apriltag.

Dependencies

  1. Ubuntu 20.04 Focal Fossa ( Operating System )
  2. ROS2 Foxy Fitzroy ( ROS )
  3. Apriltag 3.2 ( Library SDK )
  4. python3-rosdep ( Dependency Manager )
  5. Intel Realsense D400 Series Depth Camera ( Physical Camera Hardware )

Setup 🔨

apriltag_ros

  1. Download the necessary ROS2 packages:
cd $HOME
mkdir -p ~/apriltag_ros2_ws/src
cd ~/apriltag_ros2_ws/src
git clone https://github.com/AprilRobotics/apriltag.git                  # Clone Apriltag library
git clone https://github.com/Adlink-ROS/apriltag_ros.git -b foxy-devel   # Clone Apriltag ROS wrapper
  1. Build the aforementioned packages:
cd ~/apriltag_ros2_ws
rosdep install --from-paths src --ignore-src -r -y  # Install any missing packages
colcon build --symlink-install                      # Build all packages in the workspace

realsense-ros 📷

  1. Download the necessary ROS2 packages and Realsense Library:
# Download Realsense SDK 2.0
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
# Use intel servers instead of using the now defunct amazon servers that were used to distribute these binaries.
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
sudo apt-get install librealsense2-dkms librealsense2-utils librealsense2-dev librealsense2-dbg -y
# Create a ROS2 workspace
cd ~/apriltag_ros2_ws/src
# Download and Set-up ros2_intel_realsense package.
git clone --depth 1 --branch `git ls-remote --tags https://github.com/IntelRealSense/realsense-ros.git | grep -Po "(?<=tags/)3.\d+\.\d+" | sort -V | tail -1` https://github.com/IntelRealSense/realsense-ros.git
  1. Build the aforementioned packages:
cd ~/apriltag_ros2_ws
colcon build

Run

Run realsense-ros ROS2 package:

cd ~/apriltag_ros2_ws
source install/setup.bash
ros2 launch realsense2_camera rs_launch.py

Run apriltag_ros ROS2 package:

ros2 launch apriltag_ros tag_realsense.launch.py camera_name:=/camera/color image_topic:=image_raw

References

  1. Adlink-ROS/apriltag_ros - https://github.com/Adlink-ROS/apriltag_ros#quickstart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment