I’ve tried working with ArUco in ROS, but for some reason I don’t get a correct position back. Good thing is, I found Sahloul’s ar_sys!
Sometimes a marker’s Tvec is approximately [0, 0, 0], sometimes to enormous values (~ ±1e15, z seems fixed to 9007199254740992.0).
Things that might be a problem:
- Extrinsic values are not computed for the markers at all.
- Test: Read source code for
aruco::Markerandaruco::MarkerDetector. - Result: To compute the extrinsic pose of the marker,
aruco::Marker::calculateExtrinsicsshould be called. This is done inaruco::MarkerDetector::detectiff the camera matrix (either passed directly, or through aaruco::CameraParametersobject) is set. This is done correctly.
- Test: Read source code for
- Camera does not know its parameters
- Tests: Inspect camera’s parameters from the ROS topic
/c920/camera_info - Result: parameters are the same as in the file
~/.ros/camera_info/c920.yaml
- Tests: Inspect camera’s parameters from the ROS topic
- ArUco does not know the (right) camera parameters.
- Test: Print out the
ArucoDetector::camera_parameters_’s fields. - Result: ArUco got the wrong values. I read in a
cv::Matofdoublevalues withCV_32F. However, those arefloats. Fordoubles, useCV_64F. Still wrong position, while both parameter sets are the same.
- Test: Print out the
aruco::Marker::Tvecis not set correctly.- Test: Print out
Tvec. - Result: It’s similar to the values that are output by ROS (minus the +/- transforms of
aruco::Marker::OgreGetPoseParameters). No errors in converting from ArUco to to ROS.
- Test: Print out
Error resides somewhere in ArUco/parameter part, but not sure where! I will need help of Toby next meeting.
Update: I found Sahloul’s ar_sys by coincidence (googling for ROS AR packages). This package does work. A screenshot from Rviz:

A screenshot from Rviz, using ar_sys to localize the camera with respect to marker boards.