This repository contains a setup for detecting ArUco markers using the aruco_ros package with ROS Noetic, a USB webcam, and Docker for easy deployment and testing.
Before running the ArUco detection node, you must calibrate your camera to obtain the correct intrinsic parameters.
- Open and run the Jupyter Notebook:
notebooks/camera_calibration.ipynb
This notebook will guide you through capturing calibration images and generating the camera intrinsic parameters.
- After calibration, save the resulting YAML file to:
camera_calibration/my_webcam.yaml
The ArUco detection node will load this file at runtime to correct lens distortion and compute accurate poses.
All necessary build and run commands are provided in:
cmd.txt
This file includes:
- Docker image build instructions
- Docker container run commands
- ROS launch command for the ArUco detection node
By following these commands, you can launch the entire system inside Docker and test ArUco detection using your webcam.
If you prefer to run the project on your local system instead of using Docker, follow these steps to install all required dependencies on a machine with ROS Noetic installed (Ubuntu 20.04):
sudo apt update
sudo apt install -y \
ros-noetic-ros-base \
ros-noetic-usb-cam \
ros-noetic-rqt-image-view \
ros-noetic-rqt-graph \
ros-noetic-rqt-topic \
ros-noetic-rviz \
python3-rosdep \
python3-colcon-common-extensions \
python3-catkin-tools \
python3-pip \
git \
build-essentialsudo rosdep init
rosdep updatemkdir -p ~/ros_ws/src
cd ~/ros_ws/srcgit clone https://github.com/pal-robotics/aruco_ros.git
cd aruco_ros
git checkout noetic-devel
cd ~/ros_wsrosdep install --from-paths src --ignore-src -r -ysource /opt/ros/noetic/setup.bash
catkin buildAdd this to your ~/.bashrc to automatically source your workspace every time:
echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrcCopy your camera calibration file (e.g., my_webcam.yaml) into the workspace:
mkdir -p ~/ros_ws/calibrations
cp camera_calibration/my_webcam.yaml ~/ros_ws/calibrations/.
├── camera_calibration/
│ └── my_webcam.yaml # Camera intrinsic parameters (after calibration)
├── camera_calibration.ipynb # Jupyter Notebook for camera calibration
├── Dockerfile # Docker setup for ROS Noetic and aruco_ros
├── launch/
│ └── usb_cam_aruco.launch # Launch file to start webcam and ArUco detection node
├── cmd.txt # Build and run commands for Docker and ROS
└── ...
- Docker installed
- USB webcam connected
- Printed or displayed ArUco markers (for detection testing)
- Calibrate your camera → Save results to
camera_calibration/my_webcam.yaml - Build and run the Docker container → Follow steps in
cmd.txt - Launch the ArUco detection node → Using the provided launch file
- Point your webcam at an ArUco marker and observe detection results (it can be seen through rqt_image_view in the aruco_marker_publisher/result topic)
The results are published to /aruco_marker_publisher/markers, like this:
header:
seq: 0
stamp:
secs: 1751980672
nsecs: 969804506
frame_id: "usb_cam"
id: 115
pose:
pose:
position:
x: -0.00266
y: 0.01967
z: 0.44075
orientation:
x: 0.98798
y: -0.01915
z: 0.02042
w: -0.15197
covariance: [ ... ]
- Accurate calibration significantly improves detection stability and pose estimation.
- Displaying markers on computer screens may cause detection issues due to flickering, anti-aliasing, or poor viewing angles. Printed markers are recommended for better results.