-
Notifications
You must be signed in to change notification settings - Fork 145
Description
There may be times when driving backwards to a coordinate is appropriate.
(our tank's wheels are mounted backwards to save space, hence the 'inversed' polarity)
This code drives the tank in a square (almost perfectly...almost). It starts north, then east, south and west. It then turns 90deg to end up in the same position it started.... almost.
class MCTire(Wheel):
def init(self):
Wheel.init(self, 100.3, 17)
mdiff = MoveDifferential(OUTPUT_C, OUTPUT_B, MCTire, 129.3)
mdiff.set_polarity('inversed')
mdiff.odometry_start()
side=200
speed=30
mdiff.on_to_coordinates(SpeedRPM(speed), 0, side,brake='false')
mdiff.on_to_coordinates(SpeedRPM(speed), side, side,brake='false')
mdiff.on_to_coordinates(SpeedRPM(speed), side, 0,brake='false')
mdiff.on_to_coordinates(SpeedRPM(speed), 0, 0,brake='false')
mdiff.turn_right(SpeedRPM(speed), 90)
mdiff.odometry_stop()
HOWEVER, when I change the speed=-30, I would expect the robot to traverse the same path, only backwards, but instead, it took a much different path. It rolls to (0,-200), then makes a ~30deg turn rolls to about (100,-300), then to about (150,-350) etc. (this is the point where it hits a wall, or closet , or sleeping dog)
I hope this explains the issue, but if not, let me know. Perhaps a video would work?
**ev3dev version: 4.14.117-ev3dev-2.3.4-ev3
**ev3dev-lang-python version:
+++-====================================-=======================-=======================-==============================================================================
ii micropython-ev3dev2 2.0.0 all Python language bindings for ev3dev for MicroPython
ii python3-ev3dev 1.2.0 all Python language bindings for ev3dev
ii python3-ev3dev2 2.0.0 all Python language bindings for ev3dev