BreezySLAM icon indicating copy to clipboard operation
BreezySLAM copied to clipboard

Why computeVelocities returns doubled distance?

Open topin89 opened this issue 7 years ago • 2 comments

in vehicles.py distance calculates as:

    dxyMillimeters =  self.wheelRadiusMillimeters * \
            (math.radians(leftDiffDegrees) + math.radians(rightDiffDegrees))

Obviously, if two 1mm radius wheels rotate by 1rad we get 2mm distanse instead of one.

yet return value described as dxyMillimeters forward distance traveled, in millimeters

As far as I understand, rotation is also doubled, but I'm not sure. Maybe CoreSLAM uses doubled value, maybe degrees should be halved, maybe it's just error, I don't know. So, why?

topin89 avatar Apr 24 '18 11:04 topin89

There is similar code in the C++ code and based on testing, the calculated distance and rotation didn't seem correct.

poseChange.dtheta_degrees = this->wheel_radius_mm / this->half_axle_length_mm *
        (right_diff_degrees - left_diff_degrees);

When I modified Robot::extractOdometry() of my robot to calculate degrees rotate of each wheel to be 1/2, the calculations seems much closer physical measurements. I too would love to know if this is a bug, or something I'm not understanding.

ghormann avatar Aug 15 '18 00:08 ghormann

This is legacy code that I haven't looked at in years. If you want to modify and do a pull request, that'd be great. Maybe an optional scaling parameter would be the best solution.

simondlevy avatar Aug 15 '18 01:08 simondlevy