commit fine-tune from the last week

parent 9c98f618
......@@ -28,6 +28,9 @@ app.debug = True
# Create a random secrey key so we can use sessions
app.config['SECRET_KEY'] = os.urandom(12)
from ev3.ev3dev import Tone
alarm = Tone()
#head = None#Motor(port=Motor.PORT.A)
right_wheel = None
left_wheel = None
......@@ -38,11 +41,15 @@ try:
right_wheel = Motor(port=Motor.PORT.B)
left_wheel = Motor(port=Motor.PORT.C)
button = TouchSensor()
ir_sensor = InfraredSensor()
#ir_sensor = InfraredSensor()
color_sensor = ColorSensor()
alarm.play(200)
except Exception as e:
alarm.play(200)
alarm.play(200)
raise e
right_wheel.position = 0
left_wheel.position = 0
right_wheel.reset()
......
......@@ -43,12 +43,12 @@ def check_stop_condition(motorA, motorB):
stop(motorA, motorB)
# go a few centimers backward
motorA.position = 0
motorA.run_position_limited(position_sp=180, speed_sp=500,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
motorA.run_position_limited(position_sp=220, speed_sp=350,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=20,
ramp_down_sp=1000)
motorB.position = 0
motorB.run_position_limited(position_sp=180, speed_sp=500,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
motorB.run_position_limited(position_sp=220, speed_sp=350,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=20,
amp_down_sp=1000)
while "running" in motorA.state.split(" ") and \
"running" in motorB.state.split(" "):
......@@ -67,12 +67,12 @@ def run_position_limited(motorA, motorB, position):
Run for a limitied position.
"""
motorA.position = 0
motorA.run_position_limited(position_sp=position, speed_sp=500,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
motorA.run_position_limited(position_sp=position, speed_sp=350,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=20,
ramp_down_sp=1000)
motorB.position = 0
motorB.run_position_limited(position_sp=position, speed_sp=500,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=1000,
motorB.run_position_limited(position_sp=position, speed_sp=350,
stop_mode=Motor.STOP_MODE.BRAKE, ramp_up_sp=20,
amp_down_sp=1000)
return check_stop_condition(motorA, motorB)
......
......@@ -77,7 +77,7 @@ def move(direction="forward", speed=60):
elif direction == 'left':
forever = request.args.get("forever", None)
if None is forever:
movements.rotate(left_wheel, right_wheel, -360, 360, 140, 0)
movements.rotate(left_wheel, right_wheel, -360, 360, 180, 0)
else:
left_wheel.run_forever(speed * -1, regulation_mode=False)
right_wheel.run_forever(speed, regulation_mode=False)
......@@ -85,7 +85,7 @@ def move(direction="forward", speed=60):
elif direction == 'right':
forever = request.args.get("forever", None)
if None is forever:
movements.rotate(left_wheel, right_wheel, 360, -360, 0, 140)
movements.rotate(left_wheel, right_wheel, 360, -360, 0, 180)
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