Rotation of 90 degrees.

parent 704b93d0
......@@ -58,15 +58,15 @@ def run_position_limited(motorA, motorB, position):
amp_down_sp=1000)
return check_stop_condition(motorA, motorB)
def rotate(motorA, motorB, position1, position2):
def rotate(motorA, motorB, position1, position2, initial_position1, initial_position2):
"""
Rotate.
"""
motorA.position_sp = 0
motorA.position = initial_position1
motorA.run_position_limited(position_sp=position1, speed_sp=800,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
ramp_down_sp=1000)
motorB.position_sp = 90
motorB.position= initial_position2
motorB.run_position_limited(position_sp=position2, speed_sp=800,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
amp_down_sp=1000)
......
......@@ -71,7 +71,7 @@ def move(direction="forward", speed=800):
if direction == 'forward':
nb_blocks = request.args.get("blocks", None)
if None is not nb_blocks:
position = int(nb_blocks) * -1152
position = int(nb_blocks) * -1020
result["message"] = movements.run_position_limited(left_wheel,
right_wheel, position)
else:
......@@ -81,7 +81,7 @@ def move(direction="forward", speed=800):
elif direction == 'backward':
nb_blocks = request.args.get("blocks", None)
if None is not nb_blocks:
position = int(nb_blocks) * 1152
position = int(nb_blocks) * 1020
result["message"] = movements.run_position_limited(left_wheel,
right_wheel, position)
else:
......@@ -92,7 +92,7 @@ def move(direction="forward", speed=800):
speed = 600
forever = request.args.get("forever", None)
if None is forever:
movements.rotate(left_wheel, right_wheel, 90, -90)
movements.rotate(left_wheel, right_wheel, -340, 340, 90, 0)
else:
left_wheel.run_forever(speed * -1, regulation_mode=False)
right_wheel.run_forever(speed, regulation_mode=False)
......@@ -101,7 +101,7 @@ def move(direction="forward", speed=800):
speed = 600
forever = request.args.get("forever", None)
if None is forever:
movements.rotate(left_wheel, right_wheel, -90, 90)
movements.rotate(left_wheel, right_wheel, 340, -340, 0, 90)
else:
left_wheel.run_forever(speed, regulation_mode=False)
right_wheel.run_forever(speed * -1, regulation_mode=False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment