I built a mobile base from scratch, and now I am focused on getting the robot to charge.

The robot is using an on-board webcam (and PC) to detect a QR barcode on the charger unit. Using OpenCV I find various barcode attributes such as center point of the barcode, edge lengths, degrees of the edges, area, and so on. The specifics of the way the barcode is captured by the webcam has enough data to locate the robot relative to the charger, but, is it ever a huge pain in the rear. It is leading me to ask questions like this: https://math.stackexchange.com/questions/4281368/how-to-combine-equations-that-are-describing-related-physical-phenomena

So here is my question: Does anyone know of a library (preferably in c++) that uses a webcam and a QR code that can provide accurate information of where the camera is relative to the QR barcode? I am looking for the following data form the lib:

  • distance of camera from QR code (how far are the two apart?)
  • rotation of camera relative to QR code (if camera drives straight will it hit the QR code in the center?)
  • camera center to QR center error reporting (by how much is the center of the barcode and the center of the camera off; assuming the camera is square to QR code)

If I am re-engineering the wheel here, I am ready to throw in the towel and use a precanned solution... Please let there be a docking library out there for my hardware...



There's a lot of solutions out there already for this. I'll start by suggesting AR tags not QR tags. They're better optimized for localizing.

The Alvar library is commonly used for tracking AR tags.


And there's a ROS package which wraps that and publishes the results as ROS messages.


API defined here: http://wiki.ros.org/ar_track_alvar

There's also ArUco: http://www.uco.es/investiga/grupos/ava/node/26 With a ROS wrapper aruco_detect

If you're looking for a higher level of intergration there's an autodock package which is available here: https://github.com/osrf/autodock with some discussion of it here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.