Skip to content
Snippets Groups Projects
Commit dbd54d56 authored by Charles Javerliat's avatar Charles Javerliat
Browse files

Use sleep

parent 6a06de06
No related branches found
No related tags found
1 merge request!2Add/camera node
from time import sleep
from position import Position
from math import pi
from utils import compare_distance, compare_theta
......@@ -44,7 +45,7 @@ class Robot():
# We check that we approximately run the distance we wanted, if not, we continue to go forward
while not compare_distance(start_position, self.position, distance):
self.send_vel(LINEAR_SPEED, 0)
self.sleep(SLEEP_INTERVAL)
sleep(SLEEP_INTERVAL)
def backward(self, distance):
......@@ -53,4 +54,4 @@ class Robot():
# We check that we approximately run the distance we wanted, if not, we continue to go forward
while not compare_distance(start_position, self.position, distance):
self.send_vel(-LINEAR_SPEED, 0)
self.sleep(SLEEP_INTERVAL)
sleep(SLEEP_INTERVAL)
from time import sleep
from task import Task
from utils import compare_distance, compare_theta
from math import pi
TRAVEL_DISTANCE = 0.5 # meters
class SwingWindsocks(Task):
def __init__(self, robot, state):
self.robot = robot
self.state = state
self.start_pos = None
def run(self):
self.start_pos = self.robot.position
# Lower the arm and wait for it to complete
# Ensure we are at the right rotation
# Go forward TRAVEL_DISTANCE meters
# Raise up the arm
# Wait for the arm to be completely up
self.robot.lower_arm()
sleep(0.5)
self.robot.rotate_to(-pi)
self.robot.forward(TRAVEL_DISTANCE)
self.robot.raise_arm()
sleep(0.5)
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