def test_lConnect(): mRobot = robot().getLdvBot(238) rRobot = robot().getLdvBot(237) rRobot.getInfrared().setReceiveMode() mRobot.connect() mRobot.getInfrared().getID() #time.sleep(1) #mRobot.getMotor().drive(100, 3000, 0) mRobot.disconnect()
def test_search(): data, size, goal, r = parseLine( "8x8 \nw 1,2\nw 1,3\nw 1,4\nw 1,5\n robot 4,2\ngoal 7,0") world = create_world(size, data, r, goal) world.print_world() stack = linked_list() r2d2 = robot(r) search(r2d2.x, r2d2.y, world, stack)
def test_eMicrophone(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getMicrophone().getValues() i = 0 while i < 25: mRobot.getMicrophone().getValues() i = i + 1 mRobot.reset() mRobot.disconnect()
def test_eCamera(): mRobot = robot().getEpuck() mRobot.connect() camera = mRobot.getCamera() camera.refresh_camera_parameters() camera.get_image() camera.save_image() camera.set_camera_parameters(0, 10, 10, 1) mRobot.reset() mRobot.disconnect()
def test_eFloorsensor(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getFloorSensor().getValues() i=0 while i < 25: mRobot.getFloorSensor().getValues() i=i+1 mRobot.reset() mRobot.disconnect()
def test_eFloorsensor(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getFloorSensor().getValues() i = 0 while i < 25: mRobot.getFloorSensor().getValues() i = i + 1 mRobot.reset() mRobot.disconnect()
def test_eMicrophone(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getMicrophone().getValues() i=0 while i < 25: mRobot.getMicrophone().getValues() i=i+1 mRobot.reset() mRobot.disconnect()
def test_eProximity(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getProximitySensor().calibrate() i=0 while i < 25: mRobot.getProximitySensor().getValues() i=i+1 mRobot.reset() mRobot.disconnect()
def test_eSelector(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getSelector().getValues() i = 0 while i < 25: mRobot.getSelector().getValues() i = i + 1 mRobot.reset() mRobot.disconnect()
def test_eProximity(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getProximitySensor().calibrate() i = 0 while i < 25: mRobot.getProximitySensor().getValues() i = i + 1 mRobot.reset() mRobot.disconnect()
def test_eSelector(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getSelector().getValues() i=0 while i < 25: mRobot.getSelector().getValues() i=i+1 mRobot.reset() mRobot.disconnect()
def test_eAccelerometer(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getAccelerometer().getValues() mRobot.getAccelerometer().setAccelerometerFiltered(True) mRobot.getAccelerometer().getValues() i=0 while i < 2000000: i=i+1 mRobot.reset() mRobot.disconnect()
def test_eAccelerometer(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getAccelerometer().getValues() mRobot.getAccelerometer().setAccelerometerFiltered(True) mRobot.getAccelerometer().getValues() i = 0 while i < 2000000: i = i + 1 mRobot.reset() mRobot.disconnect()
def __init__(self, x, y, theta, steering_noise, distance_noise, measurement_noise, N = 100): self.N = N self.steering_noise = steering_noise self.distance_noise = distance_noise self.measurement_noise = measurement_noise self.data = [] for i in range(self.N): r = robot() r.set(x, y, theta) r.set_noise(steering_noise, distance_noise, measurement_noise) self.data.append(r)
def test_robot(): r2d2 = robot([1, 2]) r2d2.where_is_robot() print(r2d2.y) x = r2d2.move_up() print(r2d2.y) eq_(r2d2.robot[0], 1, print("move up OK")) robot.move_down(r2d2) eq_(r2d2.robot[1], 2, print("move down OK")) robot.move_right(r2d2) eq_(r2d2.robot[0], 2, print("move right OK")) robot.move_left(r2d2) eq_(r2d2.robot[0], 1, print("move left OK"))
def test_eMovement(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getMotor().getSpeed() mRobot.getMotor().getPosition() #mRobot.getMotor().setPosition(10, 10) mRobot.getMotor().setSpeed(200, 200) mRobot.getMotor().getSpeed() i=0 while i < 200: mRobot.getMotor().getPosition() i=i+1 mRobot.reset() mRobot.disconnect()
def test_eMovement(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getMotor().getSpeed() mRobot.getMotor().getPosition() #mRobot.getMotor().setPosition(10, 10) mRobot.getMotor().setSpeed(200, 200) mRobot.getMotor().getSpeed() i = 0 while i < 200: mRobot.getMotor().getPosition() i = i + 1 mRobot.reset() mRobot.disconnect()
def main(): parser = argparse.ArgumentParser() parser.add_argument('--input', help='input help') arguments = parser.parse_args() fileHandle = open(arguments.input).read() data, size, goal, rob = parseLine(fileHandle) if create_world != False: world = create_world(size, data, rob, goal) world.print_world() stack = array_ADT() r2d2 = robot(rob) search(r2d2.x, r2d2.y, world, stack) print(stack) else: print("World couldn't be created ")
def test_eLED(ledID): mRobot = robot().getEpuck() mRobot.connect() mRobot.getLED(ledID).setLED(led_status.ON) mRobot.getLED(2).setLED(led_status.ON) mRobot.getLED(3).setLED(led_status.ON) mRobot.getLED(4).setLED(led_status.ON) mRobot.getLED(5).setLED(led_status.ON) mRobot.getLED(6).setLED(led_status.ON) mRobot.getLED(7).setLED(led_status.ON) mRobot.getLED(8).setLED(led_status.ON) mRobot.getLED(9).setLED(led_status.ON) i = 0 while i < 2000000: i = i + 1 mRobot.reset() mRobot.disconnect()
def test_eLED(ledID): mRobot = robot().getEpuck() mRobot.connect() mRobot.getLED(ledID).setLED(led_status.ON) mRobot.getLED(2).setLED(led_status.ON) mRobot.getLED(3).setLED(led_status.ON) mRobot.getLED(4).setLED(led_status.ON) mRobot.getLED(5).setLED(led_status.ON) mRobot.getLED(6).setLED(led_status.ON) mRobot.getLED(7).setLED(led_status.ON) mRobot.getLED(8).setLED(led_status.ON) mRobot.getLED(9).setLED(led_status.ON) i=0 while i < 2000000: i=i+1 mRobot.reset() mRobot.disconnect()
i = 0 while i < 200: mRobot.getMotor().getPosition() i = i + 1 mRobot.reset() mRobot.disconnect() def test_eCamera(): mRobot = robot().getEpuck() mRobot.connect() camera = mRobot.getCamera() camera.refresh_camera_parameters() camera.get_image() camera.save_image() camera.set_camera_parameters(0, 10, 10, 1) mRobot.reset() mRobot.disconnect() if __name__ == '__main__': try: test_eConnect() test_eMovement() except: mRobot = robot().getEpuck() mRobot.connect() mRobot.reset() mRobot.disconnect() sys.exit(0)
# Don't try to move faster than allowed! if distance > max_distance: distance = max_distance # We move the hunter according to your instructions hunter_bot.move(turning, distance) # The target continues its (nearly) circular motion. target_bot.move_in_circle() #Visualize it measuredbroken_robot.setheading(target_bot.heading*180/pi) measuredbroken_robot.goto(target_measurement[0]*size_multiplier, target_measurement[1]*size_multiplier-100) measuredbroken_robot.stamp() broken_robot.setheading(target_bot.heading*180/pi) broken_robot.goto(target_bot.x*size_multiplier, target_bot.y*size_multiplier-100) chaser_robot.setheading(hunter_bot.heading*180/pi) chaser_robot.goto(hunter_bot.x*size_multiplier, hunter_bot.y*size_multiplier-100) #End of visualization ctr += 1 if ctr >= 1000: print "It took too many steps to catch the target." return caught target = robot.robot(0.0, 10.0, 0.0, 2*pi / 30, 1.5) measurement_noise = 2.0*target.distance # VERY NOISY!! target.set_noise(0.0, 0.0, measurement_noise) hunter = robot.robot(-10.0, -10.0, 0.0) # print demo_grading(hunter, target, naive_next_move) print demo_grading(hunter, target, next_move)
def test_eConnect(): mRobot = robot().getEpuck() mRobot.connect() mRobot.disconnect()
def test_eFirmware(): mRobot = robot().getEpuck() mRobot.connect() mRobot.getFirmware().getVersion() mRobot.reset() mRobot.disconnect()
def __init__(self): self.epuck = robot().getEpuck() self.epuck.connect()
mRobot.getMotor().setSpeed(200, 200) mRobot.getMotor().getSpeed() i=0 while i < 200: mRobot.getMotor().getPosition() i=i+1 mRobot.reset() mRobot.disconnect() def test_eCamera(): mRobot = robot().getEpuck() mRobot.connect() camera = mRobot.getCamera() camera.refresh_camera_parameters() camera.get_image() camera.save_image() camera.set_camera_parameters(0, 10, 10, 1) mRobot.reset() mRobot.disconnect() if __name__ == '__main__': try: test_eConnect() test_eMovement() except: mRobot = robot().getEpuck() mRobot.connect() mRobot.reset() mRobot.disconnect() sys.exit(0)