Working code for computing odometry from decoder ticks

asked 2020-02-13 10:54:49 -0500

pitosalas gravatar image

We're building our own robot and are at the point where we're debugging our python code which receives decoder ticks and generate odometry messages. There are no shortage of examples on GitHub and google; the problem is that your mileage may vary.

I'm wondering whether there's a ros.org tested, generally accepted version of this code. It seems like it's a few pages of somewhat intricate code but extremely standardized in the case of differential drive robots. There are a few parameters (wheel diameter, wheel spacing, what else?) and the rest is "just math", Being "intricate" there's lots of room for a greater than being switched for a less than or off by one errors, overflow etc. So I am looking for actual working code, debugged and mainstream. I gotta believe it's out there but I've not been able to find it.

edit retag flag offensive close merge delete

Comments

My go-to would be the diff_drive_controller of ros_control, but I'm not sure whether you'd be comfortable creating a hardware_interface for your robot.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-13 11:55:57 -0500 )edit

@gvdhoorn comes through again! By the way, I guess vdhoorn is van der hoorn from which is guess that you are in the Netherlands...?

But back to the point. This looks like exactly the direction I was looking for. I don't see mention of hardware_interface in the linked page though. I see this: https://github.com/ros-controls/ros_c... . Is that what you were referring to?

pitosalas gravatar image pitosalas  ( 2020-02-13 13:09:55 -0500 )edit

Yes.

All ros_control controllers are used with a hardware_interface.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-13 13:25:39 -0500 )edit

I find the explanations for how to write a hardware_interface not sufficient without reading all its code. I am looking for something with more explanations?

pitosalas gravatar image pitosalas  ( 2020-02-13 15:57:57 -0500 )edit

I'm not aware of any more extensive documentation about this.

I'd suggest to lookup some examples of such hardware_interfaces. There are a nr of Q&As on this site about the same topic, and you could take a look at code for Clearpath Husky, Jackal and more recent robots. The diff_drive_controller page lists a few more robots using this, and the Used By section of the Package Links box on the same wiki page has a few more.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-14 02:01:23 -0500 )edit

This seems highly relevant: https://github.com/PickNikRobotics/ro...

pitosalas gravatar image pitosalas  ( 2020-02-18 19:28:12 -0500 )edit