-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
14 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#Module function | ||
async def module(degrees=0, speed=1110, acceleration=10000): | ||
if (degrees > 0): | ||
if degrees > 0: | ||
await motor.run_for_degrees(motor_module, degrees, speed, acceleration=acceleration) | ||
elif (degrees < 0): | ||
elif degrees < 0: | ||
await motor.run_for_degrees(motor_module, degrees, speed, acceleration=acceleration) | ||
elif (degrees == 0): | ||
elif degrees == 0: | ||
print("Error") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
#Drive function | ||
async def drive(distance=0, multiplier=14, speed=1000, acceleration=1000): | ||
if (distance > 0): | ||
if distance > 0: | ||
degrees = multiplier*(distance - calibration) | ||
await motor_pair.move_for_degrees(pair, degrees, 0, velocity=speed, acceleration=acceleration) | ||
elif (distance < 0): | ||
elif distance < 0: | ||
degrees = multiplier*(distance + calibration) | ||
await motor_pair.move_for_degrees(pair, degrees, 0, velocity=speed, acceleration=acceleration) | ||
elif (distance == 0): | ||
elif distance == 0: | ||
print("Bist du dumm?") | ||
|
||
#Tank function | ||
async def tank(degrees=0, left_speed=1000, right_speed=1000, acceleration=1000): | ||
#180 degrees = 90 Grad | ||
if (degrees > 0): | ||
if degrees > 0: | ||
await motor_pair.move_tank_for_degrees(pair, -degrees, left_speed, -right_speed, acceleration=acceleration) | ||
elif (degrees < 0): | ||
elif degrees < 0: | ||
await motor_pair.move_tank_for_degrees(pair, degrees, -left_speed, right_speed, acceleration=acceleration) | ||
elif (degrees == 0): | ||
elif degrees == 0: | ||
print("Bist du dumm?") | ||
|
||
#Obstacle function | ||
async def obstacle(distance=0, speed=1000, acceleration=1000): | ||
if (distance > 0): | ||
if distance > 0: | ||
while distance_sensor.distance(port.C) > distance: | ||
await drive(2, 14, speed, acceleration) | ||
print("Obstacle detected!") | ||
#print(distance_sensor.distance(port.C)) | ||
elif (distance <= 0): | ||
elif distance <= 0: | ||
print("Bist du dumm?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Switch function | ||
async def switch(switch=False): | ||
while switch == False: | ||
if (force_sensor.force(force_module) >= 50): | ||
if force_sensor.force(force_module) >= 50: | ||
switch = True | ||
return True |