AutonomyLab / libcreate

C++ library for interfacing with the iRobot Create 1 and 2.
BSD 3-Clause "New" or "Revised" License
47 stars 76 forks source link

Create 2 wheel diameter #35

Closed RaphiePS closed 5 years ago

RaphiePS commented 6 years ago

Hey all! I've noticed some worrying drift in the pose readings, and so I dug into the odometry code. One thing I'm a little confused about: libcreate defines the Create 2's wheel diameter as 78 mm, but on page 5 of iRobot's specification, the wheel diameter is 72 mm.

I checked myself with some digital calipers, and it read about ~72.1mm (I wasn't measuring very carefully). I then ran an extremely unscientific experiment: I put some tape 100 inches from a wall and ran my Create 2 into it, checking the pose on impact and measuring the actual distance traveled with a tape measure. I repeated this twice, once using 78mm as the wheel diameter and again using 72mm. Results below. I wouldn't read too much into the individual accuracies (this was very ad hoc, and the incredible accuracy of 72 mm was almost certainly a coincidence), but check out the difference between them:

Wheel Diameter Actual Distance Odometry Distance Error %
78 mm (current) 103.71 in 109.84 in 5.9%
72 mm (proposed) 101.61 in 101.57 in 0.04%

To me it seems pretty clear that 72mm is the right (or at least more correct) constant, and I'd be delighted to submit a PR. But first, I wanted to check in and see if there's any context around the 78mm number - maybe there's a story behind it. Thanks so much for the incredibly helpful library!

jacobperron commented 6 years ago

I can't recall a reason why it defaults to 78mm. Honestly, I'm a bit surprised that it is not the value from the spec. I don't foresee any issues in changing it to the documented 72mm. A PR is welcome :smile: