Not able to turn left to heading using an inertial sensor with geared up drivetrain

Hi,
We rebuilt our drivetrain to gain more speed (257 RPM with 600 RPM motors and a 3:7 gear ratio from the motors to the wheels).
The motors are attached to gears between the wheels, so they spin in the opposite direction as the wheels. This means whenever we try to turn to a negative heading, the drivetrain spins clockwise and vice versa.
When this happens, the inertial sensor can’t detect the angle it’s supposed to stop at so the robot keeps spinning.
To fix this, we’ve made the turns right or left in a range, where right turns are working but left turns usually spin for a few rotations before sensing the correct angle. We have tried making the range bigger but it doesn’t help much and makes the turns inaccurate. Here is the code for left turns:

def turn_left_to_heading(degrees):
drivetrain.set_turn_velocity(5,PERCENT)
drivetrain.turn(RIGHT) # Our gears go in reverse direction
while (drivetrain.heading(DEGREES) > (361 - degrees)
or drivetrain.heading(DEGREES) < (359 - degrees)):
wait(3,MSEC)
drivetrain.stop()

Any suggestions on how to make the left turns stop at the correct angle? Are we missing anything obvious like changing the drivetrain settings?
Thanks!

1 Like