Rotation of 90 degrees.

parent 704b93d0
...@@ -58,15 +58,15 @@ def run_position_limited(motorA, motorB, position): ...@@ -58,15 +58,15 @@ def run_position_limited(motorA, motorB, position):
amp_down_sp=1000) amp_down_sp=1000)
return check_stop_condition(motorA, motorB) return check_stop_condition(motorA, motorB)
def rotate(motorA, motorB, position1, position2): def rotate(motorA, motorB, position1, position2, initial_position1, initial_position2):
""" """
Rotate. Rotate.
""" """
motorA.position_sp = 0 motorA.position = initial_position1
motorA.run_position_limited(position_sp=position1, speed_sp=800, motorA.run_position_limited(position_sp=position1, speed_sp=800,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000, stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
ramp_down_sp=1000) ramp_down_sp=1000)
motorB.position_sp = 90 motorB.position= initial_position2
motorB.run_position_limited(position_sp=position2, speed_sp=800, motorB.run_position_limited(position_sp=position2, speed_sp=800,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000, stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
amp_down_sp=1000) amp_down_sp=1000)
......
...@@ -71,7 +71,7 @@ def move(direction="forward", speed=800): ...@@ -71,7 +71,7 @@ def move(direction="forward", speed=800):
if direction == 'forward': if direction == 'forward':
nb_blocks = request.args.get("blocks", None) nb_blocks = request.args.get("blocks", None)
if None is not nb_blocks: if None is not nb_blocks:
position = int(nb_blocks) * -1152 position = int(nb_blocks) * -1020
result["message"] = movements.run_position_limited(left_wheel, result["message"] = movements.run_position_limited(left_wheel,
right_wheel, position) right_wheel, position)
else: else:
...@@ -81,7 +81,7 @@ def move(direction="forward", speed=800): ...@@ -81,7 +81,7 @@ def move(direction="forward", speed=800):
elif direction == 'backward': elif direction == 'backward':
nb_blocks = request.args.get("blocks", None) nb_blocks = request.args.get("blocks", None)
if None is not nb_blocks: if None is not nb_blocks:
position = int(nb_blocks) * 1152 position = int(nb_blocks) * 1020
result["message"] = movements.run_position_limited(left_wheel, result["message"] = movements.run_position_limited(left_wheel,
right_wheel, position) right_wheel, position)
else: else:
...@@ -92,7 +92,7 @@ def move(direction="forward", speed=800): ...@@ -92,7 +92,7 @@ def move(direction="forward", speed=800):
speed = 600 speed = 600
forever = request.args.get("forever", None) forever = request.args.get("forever", None)
if None is forever: if None is forever:
movements.rotate(left_wheel, right_wheel, 90, -90) movements.rotate(left_wheel, right_wheel, -340, 340, 90, 0)
else: else:
left_wheel.run_forever(speed * -1, regulation_mode=False) left_wheel.run_forever(speed * -1, regulation_mode=False)
right_wheel.run_forever(speed, regulation_mode=False) right_wheel.run_forever(speed, regulation_mode=False)
...@@ -101,7 +101,7 @@ def move(direction="forward", speed=800): ...@@ -101,7 +101,7 @@ def move(direction="forward", speed=800):
speed = 600 speed = 600
forever = request.args.get("forever", None) forever = request.args.get("forever", None)
if None is forever: if None is forever:
movements.rotate(left_wheel, right_wheel, -90, 90) movements.rotate(left_wheel, right_wheel, 340, -340, 0, 90)
else: else:
left_wheel.run_forever(speed, regulation_mode=False) left_wheel.run_forever(speed, regulation_mode=False)
right_wheel.run_forever(speed * -1, 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