- Ubuntu 18.04
- ROS Melodic
- OpenCV
-
Install ROS USB driver
- Clone ROS USB camera driver
mkdir -p catkin_ws/src && cd catkin_ws/src git clone https://github.com/bosch-ros-pkg/usb_cam.git
- Create USB camera directory
cd .. catkin_make
- Set up ROS environment
source ./devel/setup.bash # need to run this command everytime a new terminal window is opened
- Build ennvironment
cd src/usb_cam mkdir build && cd build cmake ..
- Check available cameras/webcams (make sure camera is connected)
sudo apt-get install v4l-utils v4l2-ctl --list-devices # sample output # Integrated Camera (usb-0000:00:1a.0-1.6): # /dev/video0
- Launch USB camera
cd .. cd launch roslaunch usb_cam usb_cam-test.launch
- Clone ROS USB camera driver
-
Install AprilTag_ros driver
- Clone AprilTag repo
cd ~/ # or choose other installation location git clone https://github.com/AprilRobotics/apriltag.git
- Install AprilTag
cd apriltag mkdir build && cd build cmake .. sudo make install
- Clone AprilTag_ros repo and install
cd ~/catkin_ws/src git clone https://github.com/AprilRobotics/apriltag_ros.git cd .. catkin_make
- Clone AprilTag repo
-
Camera Calibration
- Install ROS camera calibration package
sudo apt-get install ros-melodic-camera-calibration
- Perform camera calibration
roslaunch usb_cam usb_cam-test.launch # turn on USB camera rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.024 image:=/usb_cam/image_raw camera:=/usb_cam
The example above uses an 8x6 checkerboard with 24mm squares (Calibration uses the interior vertex points of the checkerboard, so an "9x7" board uses the interior vertex parameter "8x6" as in the example below).
Download the official ROS 8x6 checkerboard here.
Move checkerboard up/down/left/right until "CALIBRATE" button turns green, then click on "CAILIBRATE", wait for the system to complete calibration calculation, then click on "SAVE", then "COMMIT".
When you click on the "Save" button after a succesfull calibration, the data (calibration data and images used for calibration) will be written to /tmp/calibrationdata.tar.gz.
- Install ROS camera calibration package
- Using AprilTag_Ros and Detecting AprilTags
-
go to /apriltag_ros/apriltag_ros/config and configure settings.yaml and tags.yaml.
check out http://wiki.ros.org/apriltag_ros/Tutorials/Detection%20in%20a%20video%20stream for parameter setup.
- settings.yaml
tag_family: 'tag36h11' tag_border: 1 tag_threads: 2 tag_decimate: 1.0 tag_blur: 0.0 tag_refine_edges: 1 tag_refine_decode: 0 tag_refine_pose: 0 tag_debug: 0 publish_tf: true
- tags.yaml (Values based on the diagram below)
standalone_tags: [ {id: 10, size: 0.15}, {id: 20, size: 0.1}, {id: 30, size: 0.07} ] tag_bundles: [ { name: 'my_bundle', layout: [ {id: 0, size: 0.05, x: 0.0000, y: 0.0000, z: 0.0, qw: 1.0, qx: 0.0, qy: 0.0, qz: 0.0}, {id: 4, size: 0.05, x: 0.0548, y: -0.0522, z: 0.0, qw: 1.0, qx: 0.0, qy: 0.0, qz: 0.0}, {id: 3, size: 0.05, x: -0.0580, y: -0.0553, z: 0.0, qw: 1.0, qx: 0.0, qy: 0.0, qz: 0.0}, {id: 2, size: 0.05, x: 0.0543, y: 0.0603, z: 0.0, qw: 1.0, qx: 0.0, qy: 0.0, qz: 0.0}, {id: 1, size: 0.05, x: -0.0582, y: 0.0573, z: 0.0, qw: 1.0, qx: 0.0, qy: 0.0, qz: 0.0} ] } ]
- Go to apriltag_ros/apriltag_ros/launch, add the following lines to continuous_detection.launch
<arg name="camera_name" default="/usb_cam" /> <arg name="camera_frame" default="usb_cam" /> <arg name="image_topic" default="image_raw" />
- settings.yaml
-
- Launch camera
roslaunch usb_cam usb_cam-test.launch
- Launch AprilTag detection
roslaunch apriltag_ros continuous_detection.launch
- View results
rostopic echo /tag_detections
- Visualize results
select tag_detections_image from drop-down menu in rqt ImageView
rqt_image_view
- Run RViz
rosrun rviz rviz
See the open issues for a full list of proposed features (and known issues).