Commit 6b93e7c0 authored by Cédric Bonhomme's avatar Cédric Bonhomme

fine tune

parent 9799c723
...@@ -41,10 +41,11 @@ try: ...@@ -41,10 +41,11 @@ try:
ir_sensor = InfraredSensor() ir_sensor = InfraredSensor()
color_sensor = ColorSensor() color_sensor = ColorSensor()
except Exception as e: except Exception as e:
print e raise e
pass#raise Exception('You must run the application on the EV3.')
right_wheel.position = 0 right_wheel.position = 0
left_wheel.position = 0 left_wheel.position = 0
right_wheel.stop()
left_wheel.stop()
from web import views from web import views
...@@ -41,7 +41,7 @@ def authentication_required(e): ...@@ -41,7 +41,7 @@ def authentication_required(e):
@app.route('/move/<direction>', methods=['GET']) @app.route('/move/<direction>', methods=['GET'])
@app.route('/move/<direction>/<speed>', methods=['GET']) @app.route('/move/<direction>/<int:speed>', methods=['GET'])
@to_response @to_response
def move(direction="forward", speed=800): def move(direction="forward", speed=800):
""" """
...@@ -62,8 +62,8 @@ def move(direction="forward", speed=800): ...@@ -62,8 +62,8 @@ def move(direction="forward", speed=800):
result["message"] = movements.run_position_limited(left_wheel, result["message"] = movements.run_position_limited(left_wheel,
right_wheel, position) right_wheel, position)
else: else:
left_wheel.run_forever(speed * -1, regulation_mode=False) left_wheel.run_forever(speed * -1, regulation_mode=True)
right_wheel.run_forever(speed * -1, regulation_mode=False) right_wheel.run_forever(speed * -1, regulation_mode=True)
elif direction == 'backward': elif direction == 'backward':
nb_blocks = request.args.get("blocks", None) nb_blocks = request.args.get("blocks", None)
...@@ -72,6 +72,7 @@ def move(direction="forward", speed=800): ...@@ -72,6 +72,7 @@ def move(direction="forward", speed=800):
result["message"] = movements.run_position_limited(left_wheel, result["message"] = movements.run_position_limited(left_wheel,
right_wheel, position) right_wheel, position)
else: else:
print(speed)
left_wheel.run_forever(speed * 1, regulation_mode=False) left_wheel.run_forever(speed * 1, regulation_mode=False)
right_wheel.run_forever(speed * 1, regulation_mode=False) right_wheel.run_forever(speed * 1, regulation_mode=False)
...@@ -79,7 +80,7 @@ def move(direction="forward", speed=800): ...@@ -79,7 +80,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, -300, 300, 90, 0) movements.rotate(left_wheel, right_wheel, -310, 310, 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)
...@@ -88,7 +89,7 @@ def move(direction="forward", speed=800): ...@@ -88,7 +89,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, 300, -300, 0, 90) movements.rotate(left_wheel, right_wheel, 310, -310, 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