EV3 Scripts, and Docu update robot driving
This commit is contained in:
parent
307e9fcb7c
commit
d54bfdd101
Binary file not shown.
Binary file not shown.
30
software/roboter/ev3/drive_back.py
Normal file
30
software/roboter/ev3/drive_back.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
from ev3dev2.sensor.lego import TouchSensor, UltrasonicSensor
|
||||||
|
from ev3dev2.sensor import INPUT_1, INPUT_4
|
||||||
|
import sys
|
||||||
|
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
ultraSensor = UltrasonicSensor(INPUT_4)
|
||||||
|
touchSensor = TouchSensor(INPUT_1)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(-50), seconds=2.8)
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(int(sys.argv[1])), 400)
|
||||||
|
|
||||||
|
motorLeft.on(SpeedPercent(-70), block=False)
|
||||||
|
motorRight.on(SpeedPercent(-70))
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if ultraSensor.distance_centimeters < 10:
|
||||||
|
motorLeft.on(SpeedPercent(-25), block=False)
|
||||||
|
motorRight.on(SpeedPercent(-25))
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
touchSensor.wait_for_pressed(timeout_ms=None, sleep_ms=10)
|
||||||
|
motorLeft.off()
|
||||||
|
motorRight.off()
|
15
software/roboter/ev3/plant_1.py
Normal file
15
software/roboter/ev3/plant_1.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env pybricks-micropython
|
||||||
|
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, ServoMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
|
||||||
|
motorRight.on_for_seconds(SpeedPercent(70), seconds=0.8, block=False)
|
||||||
|
motorLeft.on_for_seconds(SpeedPercent(70), seconds=0.8)
|
||||||
|
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(-50), 400)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(50), seconds=2.8)
|
16
software/roboter/ev3/plant_2.py
Normal file
16
software/roboter/ev3/plant_2.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env pybricks-micropython
|
||||||
|
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, ServoMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
|
||||||
|
motorRight.on_for_seconds(SpeedPercent(70), seconds=0.8, block=False)
|
||||||
|
motorLeft.on_for_seconds(SpeedPercent(70), seconds=0.8)
|
||||||
|
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(50), 400)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(50), seconds=2.8)
|
||||||
|
|
16
software/roboter/ev3/plant_3.py
Normal file
16
software/roboter/ev3/plant_3.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env pybricks-micropython
|
||||||
|
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, ServoMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
|
||||||
|
motorRight.on_for_seconds(SpeedPercent(70), seconds=2.2, block=False)
|
||||||
|
motorLeft.on_for_seconds(SpeedPercent(70), seconds=2.2)
|
||||||
|
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(-50), 400)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(50), seconds=2.8)
|
||||||
|
|
15
software/roboter/ev3/plant_4.py
Normal file
15
software/roboter/ev3/plant_4.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env pybricks-micropython
|
||||||
|
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, ServoMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
|
||||||
|
motorRight.on_for_seconds(SpeedPercent(70), seconds=2.2, block=False)
|
||||||
|
motorLeft.on_for_seconds(SpeedPercent(70), seconds=2.2)
|
||||||
|
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(50), 400)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(50), seconds=3)
|
16
software/roboter/ev3/plant_5.py
Normal file
16
software/roboter/ev3/plant_5.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env pybricks-micropython
|
||||||
|
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, ServoMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
|
||||||
|
motorRight.on_for_seconds(SpeedPercent(70), seconds=2.7, block=False)
|
||||||
|
motorLeft.on_for_seconds(SpeedPercent(70), seconds=2.7)
|
||||||
|
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(-50), 400)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(50), seconds=3)
|
||||||
|
|
16
software/roboter/ev3/plant_6.py
Normal file
16
software/roboter/ev3/plant_6.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env pybricks-micropython
|
||||||
|
|
||||||
|
from ev3dev2.motor import Motor, LargeMotor, ServoMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent
|
||||||
|
|
||||||
|
motorRight = LargeMotor(OUTPUT_A)
|
||||||
|
motorLeft = LargeMotor(OUTPUT_D)
|
||||||
|
motorUpDown = Motor(OUTPUT_C)
|
||||||
|
motorLeftRight = Motor(OUTPUT_B)
|
||||||
|
|
||||||
|
motorRight.on_for_seconds(SpeedPercent(70), seconds=2.7, block=False)
|
||||||
|
motorLeft.on_for_seconds(SpeedPercent(70), seconds=2.7)
|
||||||
|
|
||||||
|
motorLeftRight.on_for_degrees(SpeedPercent(50), 400)
|
||||||
|
|
||||||
|
motorUpDown.on_for_seconds(SpeedPercent(50), seconds=3)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user