dev #33
@@ -21,7 +21,7 @@ drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK)
|
||||
drive_base.settings(600, 500, 300, 200)
|
||||
drive_base.use_gyro(True)
|
||||
|
||||
WALL_DISTANCE = 200 # mm
|
||||
WALL_DISTANCE = 300 # mm
|
||||
|
||||
async def drive_forward():
|
||||
"""Drive forward continuously using DriveBase."""
|
||||
@@ -32,11 +32,11 @@ async def monitor_distance():
|
||||
"""Monitor ultrasonic sensor and stop when wall is detected."""
|
||||
while True:
|
||||
distance = lazer_ranger.distance()
|
||||
print('Distancing...',distance)
|
||||
|
||||
if distance < WALL_DISTANCE:
|
||||
# Stop the drivebase
|
||||
await drive_base.turn(-180)
|
||||
drive_base.brake()
|
||||
await drive_base.stop
|
||||
print(f"Wall detected at {distance}mm!")
|
||||
break
|
||||
|
||||
@@ -117,7 +117,7 @@ async def Run4(): # From Send_Over_Final.py
|
||||
await drive_base.straight(65)
|
||||
#Solve mission
|
||||
drive_base.turn(-10)
|
||||
await left_arm.run_angle(10000,-4000)
|
||||
await left_arm.run_angle(10000, 4000)
|
||||
#Get to Red Start
|
||||
await drive_base.straight(-110)
|
||||
await drive_base.turn(90)
|
||||
|
||||
Reference in New Issue
Block a user