Closed WesleyJ-128 closed 4 years ago
Interesting! There's no way to explicitly rotate it as far as I know, but you I believe can make it behave like that. Can you negate your P, I and D coefficients so that kp=-1
and ki=kd=0
and try again?
I have tried that already, and when I try to run the program, it gives the same error, before it moves at all.
@WesleyJ-128 It sounds to me like your kp
might be too large. Could you change it to 0.1
and try again, with both positive and negative signs just in case?
This worked! Thank you.
In my robot, the gyro sensor is mounted such that the gyro is inverted relative to the motors. This means that when the robot turns clockwise, the angle decreases instead of increasing. Therefore, when I run
tank = MoveTank(OUTPUT_B, OUTPUT_C)
tank.gyro = GyroSensor(INPUT_2)
tank.follow_gyro_angle(kp, ki, kd, Speed, Heading, 0.01, follow_for_forever)
withkp
,ki
,kd
,Speed
, andHeading
equaling 1, 0, 0, 25, and 0, respectively, the robot tries to correct in the wrong direction, and the robot spirals faster and faster until the program throws theFollowGyroAngleErrorTooFast
error. Is there any way for the gyro angle to be inverted in code? I have triedtank.gyro.circle_angle()
, but this causes the program to throw the same error as before, before the robot moves at all.