Issue EasyGoPiGo3.steer(left_percent, right_percent) method - suggested fix

Given the documentation for steer():

def steer(self, left_percent, right_percent):
        """
        Control each motor in order to get a variety of turning movements.

        Each motor is assigned a percentage of the current speed value. 
        While there is no limit on the values of ``left_percent`` and ``right_percent`` parameters,
        they are expected to be between **-100** and **100**.

        :param int left_percent: Percentage of current speed value that gets applied to left motor. The range is between **-100** (for back
ward rotation) and **100** (for forward rotation).
        :param int right_percent: Percentage of current speed value that gets applied to right motor. The range is between **-100** (for ba
ckward rotation) and **100** (for forward rotation).

With my wheel encoder logging travel along path, rotation, time in motion, I commanded various steer(left_percent,right_percent) commands with the “speed” set to 150dps.

How can the following be explained:

set_speed(150) # set speed to 150 dps

  1. steer(50,50) # goes straight forward at 130 dps - both wheels should turn at 75 dps

  2. steer(50,25) # Still went straight forward at 130 dps - should turn right with right wheel half the speed of left)

  3. steer(25, 25) # goes straight forward at 125 dps - wheels should turn slower at 37.5 dps

  4. steer(25, 12.5) # turns 14.6 degrees right for 161mm travel along path in 2.3 seconds or approximately 124 dps along path

  5. steer(12.5, 12.5) # goes straight forward at 113 dps - wheels should turn at 18.75 dps

  6. steer(12.5, 6.25) # turns 42 degrees right for 127 mm travel along path in 2.7 seconds or approximately 83 dps along path

  7. steer(100,100) # goes straight at 136 dps

  • My wheels may be 64mm effective diameter instead of 66.5 so measured dps numbers might be off by 4% which is 6 dps, but going straight at 113 dps when 18-19 is expected is not wheel diameter setting.

Clearly the steer(left_percent,right_percent) is not resulting in speed * percent motion

Not turning when one wheel is commanded at half speed of the other (50,25) would seem to indicate an issue.

This is my test program (only uses stock DI/ModRobotics code) and reports distance along path at effective dps for each test execution.

1 Like

@mitch.kremm, I have confirmed the problem is the issue I filed in March:

and tested a fix with test program (self contained - no Carl specific code):

and created a pull request to merge the fix into your repository:

1 Like