Exemple #1
0
from robot_control_class import RobotControl
rc = RobotControl()

while rc.get_laser(360) > 1:
    rc.move_straight()

rc.stop_robot()
rc.rotate(75)
Exemple #2
0
from robot_control_class import RobotControl

rc = RobotControl()

wall_proximity = rc.get_laser(360)

while wall_proximity >= 1:
    rc.move_straight()
    wall_proximity = rc.get_laser(360)
    print("The robot is located %f meter from the wall" % wall_proximity)

rc.stop_robot()

print("The wall is at %f meters, Stop it!!!" % wall_proximity)
Exemple #3
0
from robot_control_class import RobotControl
rc = RobotControl()
a = int(input("Enter a number "))
laser1 = rc.get_laser(a)
print("Laser 1 output", laser1)
from robot_control_class import RobotControl
import time as t
rc = RobotControl()
rc.stop_robot()
while True:
    d = rc.get_laser(360)
    f = rc.get_laser(0)

    if (d < 1.0):
        #Stop Robot
        rc.stop_robot()
        rc.turn("clockwise", 0.3, 5.25)
        if (d < 1.0 and f < 1.3):
            rc.stop_robot()
            rc.turn("counterclockwise", 0.6, 5.35)
    else:
        #Move Forward
        rc.move_straight()

    print("distance1 = ", d)
    print("distance2 = ", f)
Exemple #5
0
# First Example
# Move robot forward until a
# wall is less than 1 meter away

from robot_control_class import RobotControl

rc = RobotControl()

while True:
    # Check distance
    dist = rc.get_laser(360)

    if dist < 1:
        # Stop robot when wall <1m away
        rc.stop_robot()
        print("The robot stopped at %f meters from the wall" % dist)

    else:
        # Move straight when wall >1m away
        rc.move_straight()
        print("The robot is %f meters from the wall" % dist)
Exemple #6
0
from robot_control_class import RobotControl  #importa uma classe
robotcontrol = RobotControl()  #criando um objeto

laser1 = robotcontrol.get_laser(360)

print("The laser1 value received is: ", laser1)

laser2 = robotcontrol.get_laser(330)

print("The laser2 value received is: ", laser2)

laser2 = robotcontrol.get_laser(370)

print("The laser2 value received is: ", laser2)
Exemple #7
0
from robot_control_class import RobotControl  #importa uma classe
robotcontrol = RobotControl()  #criando um objeto

position = input("What's the angle position? ")

laser1 = robotcontrol.get_laser(position)

print("The laser value received is: ", laser1)
Exemple #8
0
#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)
Exemple #9
0
from robot_control_class import RobotControl

rc = RobotControl()

laser1 = rc.get_laser(180)
print(laser1)

laser2 = rc.get_laser(400)
print(laser2)

laser2 = rc.get_laser(700)
print(laser2)

Exemple #10
0
from robot_control_class import RobotControl

rc = RobotControl()


apostasi_apo_empodio = rc.get_laser(360)

if apostasi_apo_empodio < 1:
    rc.stop_robot()
else: 
    rc.move_straight()

print("the laser value was: ", apostasi_apo_empodio)
Exemple #11
0
#!/usr/bin/env python

import sys
from robot_control_class import RobotControl

rc = RobotControl()

if str(sys.argv[1]) == 'full':
    a = rc.get_laser_full()
    print("All 360 values: {}".format(a))

elif str(sys.argv[1]) == 'single':
    ray_n = int(sys.argv[2])
    if ray_n >= 0 and ray_n < 360:
        a = rc.get_laser(ray_n)
        print("The distance along ray {} is {}".format(ray_n, a))
    else:
        print("Invalid ray number")

elif str(sys.argv[1]) == 'four_dirs':
    front = rc.get_laser(0)
    right = rc.get_laser(89)
    back = rc.get_laser(179)
    left = rc.get_laser(359)
    print("The distances are: front - {}, right - {}, back - {}, left - {}".
          format(front, right, back, left))

else:
    print("VERBOTEN first command line argument")
Exemple #12
0
from robot_control_class import RobotControl
rc = RobotControl()
laser1 = rc.get_laser(360)
print("Laser 1 output", laser1)
laser2 = rc.get_laser(180)
print("Laser 2 output", laser2)
laser2 = rc.get_laser(299)
print("Laser 2 output", laser2)
Exemple #13
0
from robot_control_class import RobotControl

rc = RobotControl()

wall = rc.get_laser(360)

if wall <= 1:
    rc.stop_robot()
else:
    rc.move_straight()
print("The laser value received was: ", wall)
Exemple #14
0
from robot_control_class import RobotControl

rc = RobotControl()

users_number = int(input("Give me a number from 0 to 719: "))
users_laser = rc.get_laser(users_number)

print(users_laser)
from robot_control_class import RobotControl  #importa uma classe
robotcontrol = RobotControl()  #criando um objeto

a = robotcontrol.get_laser(330)

print("The laser value received is: ", a)
Exemple #16
0
from robot_control_class import RobotControl

rc = RobotControl()

a = rc.get_laser(360)

print ("The distance measured is: ", a)
Exemple #17
0
#!/usr/bin/env python

import sys
from robot_control_class import RobotControl

rc = RobotControl()

if str(sys.argv[1]) == 'full':
    a = rc.get_laser_full()
    print("All 360 values: {}".format(a))

elif str(sys.argv[1]) == 'single':
    ray_n = int(sys.argv[2])
    if ray_n >= 0 and ray_n < 360:
        a = rc.get_laser(ray_n)
        print("The distance along ray {} is {}".format(ray_n, a))
    else:
        print("Invalid ray number")

else:
    print("VERBOTEN first command line argument")
Exemple #18
0
from robot_control_class import RobotControl

rc = RobotControl()

laser1 = rc.get_laser(280)
print("laser1=", laser1)

laser2 = rc.get_laser(420)
print("laser2=", laser2)

laser3 = rc.get_laser(500)
print("laser3=", laser3)

#print ("The distance measured is: ", a)
Exemple #19
0
from robot_control_class import RobotControl

robotcontrol = RobotControl()

laser1 = robotcontrol.get_laser(0)
print("The laser value received is: ", laser1)

laser2 = robotcontrol.get_laser(360)
print("The laser value received is: ", laser2)

laser2 = robotcontrol.get_laser(719)
print("The laser value received is: ", laser2)