def get_laser_readings(self): output = [] rc = RobotControl() laser = rc.get_laser_full() output.append(laser[719]) output.append(laser[0]) return output
def __init__(self, motion, clockwise, speed, time): self.RC = RobotControl() self.motion = motion self.clockwise = clockwise self.speed = speed self.time = time self.time_turn = 7.0
def __init__(self, motion, clockwise, speed, time): self.robotcontrol = RobotControl(robot_name="summit") self.motion = motion self.clockwise = clockwise self.speed = speed self.time = time self.time_turn = 7.0 # This is an estimate time in which the robot will rotate 90 degrees
def __init__(self, moveDirection, turnDirection, speed): self.RobotControl = RobotControl() self.moveDirection = moveDirection self.turnDirection = turnDirection self.speed = speed self.timeTurn = 4.80 #Set to get as close to 90 degrees as possible self.left = 0 #Sets leftmost laser value self.middle = 360 #sets middle laser value self.right = 719 #sets rightmost laser value
def __init__(self, motion, clockwise, speed, time): self.robot = RobotControl() self.motion = motion self.clockwise = clockwise self.speed = speed self.time = time self.time_turn = 2.5 self.turn_speed = speed self.full_laser = self.robot.get_laser_full() self.full_laser2 = self.robot.get_laser_full()
def main(self): rc = RobotControl() d_left, d_right = self.get_laser_readings() print(d_left, d_right) while True: rc.move_straight() d_left, d_right = self.get_laser_readings() print(d_left, d_right) if (math.isinf(d_left)) and (math.isinf(d_right)): break rc.stop_robot()
def get_highest_lowest(): from robot_control_class import RobotControl rc = RobotControl() laser_readings = [] laser_readings = rc.get_laser_full() max = 0 low = 1000000000000000000000 for costas in range(0, 720): if laser_readings[costas] > max and laser_readings[costas] != float( "inf"): max = laser_readings[costas] max_pos = costas if laser_readings[costas] < low: min = laser_readings[costas] min_pos = costas return max_pos, min_pos
def get_higest_lowest(): rc = RobotControl() lc1 = rc.get_laser_full() #lc1 = [1,2,3,4,5,float('inf')] lc = [] for x in lc1: if not math.isinf(x): #print (x) lc.append(x) #print (lc) #print (lc1) lw = min(lc) #print(lw) hw = max(lc) return lc1.index(hw), lc1.index(lw) #j = get_higest_lowest() #print (j)
def get_highest_lowest(): from robot_control_class import RobotControl rc = RobotControl() lr_list = [] lr_list = rc.get_laser_full() max_val = 0 min_val = 100000000000000000000000 max_pos = 0 min_pos = 0 for item in range(0, 720): if lr_list[item] > max_val and lr_list[item] != float("inf"): max_val = lr_list[item] max_pos = item if lr_list[item] < min_val: min_val = lr_list[item] min_pos = item return max_pos, min_pos
def get_highest_lowest(): rc = RobotControl() laser = rc.get_laser_full() laser_dict = {} output = [] for i, elem in enumerate(laser): if not math.isinf(elem): laser_dict[i] = elem max_val = max(laser_dict.values()) min_val = min(laser_dict.values()) print(max_val, min_val) for key, val in laser_dict.items( ): # for name, age in dictionary.iteritems(): (for Python 2.x) if val == max_val: output.append(key) break for key, val in laser_dict.items( ): # for name, age in dictionary.iteritems(): (for Python 2.x) if val == min_val: output.append(key) break return output
def sleept(t=5): rc = RobotControl() rc.move_straight() time.sleep(t) rc.stop_robot()
from robot_control_class import RobotControl robot = RobotControl() def movimento(): global a global b a = "forward" b = "counter-clockwise" movimento() direcao = robot.move_straight_time(a, 0.75, 5) giro = robot.turn(b, 0.45, 10) print ("O robo se deslocou com os seguinte parametros:", direcao ) print ("O robo girou com os seguintes parametros:", giro )
def __init__(self): self.robot= RobotControl() self.is_out_maze = False
def __init__(self,speed,time): self.rc=RobotControl() self.motion=None self.speed=speed self.time=time self.d=None
def __init__(self): self.rc = RobotControl()
from robot_control_class import RobotControl robotcontrol = RobotControl() robotcontrol.turn("counter-clockwise", 0.3, 4) robotcontrol.move_straight_time("forward", 0.3, 6) robotcontrol.turn("counter-clockwise", 0.3, 4) robotcontrol.move_straight_time("forward", 0.3, 7)
from robot_control_class import RobotControl rc = RobotControl(robot_name="summit") rc.move_straight_time("forward", 0.2, 5) rc.turn("counter-clockwise", 0.2, 13) rc.move_straight_time("forward", 0.2, 10) rc.turn("counter-clockwise", 0.2, 11) rc.move_straight_time("forward", 0.2, 10) print("Bellos is my lord and savior")
from robot_control_class import RobotControl rc = RobotControl() a = rc.get_laser(360) if a < 1: rc.stop_robot() else: rc.move_straight() print(a)
#Exercise 3,1 #Arnaldo Jr import time from robot_control_class import RobotControl #importa uma classe robotcontrol = RobotControl() #criando um objeto def robotmove(a): robotcontrol.move_straight() time.sleep(a) robotcontrol.stop_robot() print('Forneca 3 valores entre 0 e 719.') value = [0, 1, 2] value[0] = input('valor 1:') value[1] = input('valor 2:') value[2] = input('valor 3:') print(value) #robotmove(5) laser1 = robotcontrol.get_laser(360) print(laser1)