Open fll-pigeons opened 4 years ago
robot.straight() with negative distance should travel that distance backwards;
e.g.:
distance = -1000 # millimetres speed = 150 # mm/sec robot.reset() gyro_sensor.reset_angle(0) PROPORTIONAL_GAIN = 1.1 if distance < 0: # move backwards while robot.distance() > distance: speed = -1 * robotSpeed angle_correction = -1 * PROPORTIONAL_GAIN * gyro_sensor.angle() robot.drive(drive_speed=speed, turn_rate=angle_correction) wait(10) elif distance > 0: # move forwards while robot.distance() < distance: angle_correction = -1 * PROPORTIONAL_GAIN * gyro_sensor.angle() robot.drive(drive_speed=robotSpeed, turn_rate=angle_correction) wait(10) robot.stop()
robot.straight() with negative distance should travel that distance backwards;
e.g.: