def _main():
    #init Robot
    config = PepperConfiguration(roboterName)
    if (not config.isAvailable()):
        Logger.err(
            "Main", "checkAvailability",
            "name: " + config.Name + ", ip: " + config.Ip + " not reachable!")
        sys.exit(1)

    robot = Robot(config)
    sensorhandler = SensorHandler(robot)

    #sensorhandler.write_operation_modes(3.0)
    sensorhandler.read_operation_modes()
 def __init__(self):
     self.config = PepperConfiguration(_ROBOT_NAME)
     if(not self.config.isAvailable()):
         Logger.err("ControlFlow", "checkAvailability", "name: " + self.config.Name + ", ip: " + self.config.Ip + " not reachable!")
         sys.exit(1) #Abort since robot is not available...
     self.robot = Robot(self.config)
     Speech(self.robot) #Initialize Speech (static class, no reference needed)
     DoorChecker(self.robot) #Initialize DoorChecker (static class, no reference needed)
     TabletHandler(self.robot) #Initialize TabletHandler (static class, no reference needed)
     Filetransfer(self.config) #Initialize Filetransfer (static class, no reference needed)
     #self.tracer = Tracer(self.robot) # enable to gather sensor data
     self.sensorhandler = SensorHandler(self.robot)
     self.planner = Planner()
     self.movement = Movement(self.robot)
     self.poscalib = PositionCalibrator(self.robot)
     self.currentpos = _START_COORDINATE
Exemple #3
0
def main(pepper_name):
    config = PepperConfiguration(pepper_name)
    robot = Robot(config)

    renate = RENATE(robot)

    renate.do_wakeup()
 def __init__(self):
     self.config = PepperConfiguration("Porter")
     robot = Robot(self.config)
     self.camera = robot.ALPhotoCapture
     self.tts = robot.ALTextToSpeech
     self.tts.setLanguage("English")
     self.audio = robot.ALAudioPlayer
Exemple #5
0
def _main():
    #init Robot
    config = PepperConfiguration(roboterName)
    if (not config.isAvailable()):
        Logger.err(
            "Main", "checkAvailability",
            "name: " + config.Name + ", ip: " + config.Ip + " not reachable!")
        sys.exit(1)

    robot = Robot(config)
    Speech(robot)
    Filetransfer(config)

    # init Door Checker
    DoorChecker(robot)
    robot.ALRobotPosture.goToPosture("StandInit", 1)
    DoorChecker.check_door("303")
def main():
    config = PepperConfiguration(PEPPER_NAME)
    robot = Robot(config)

    schoolboy = SchoolBoy(robot, room_orientation=SCHOOL_ON_HIS_LEFT)
    schoolboy.talk_to_teacher()
Exemple #7
0
        a = self.motion_service.moveTo(X, Y, Theta)

        t1 = time.time()
        t = t1 - t0
        t *= 1000

        units = float(t) * (1.0 / TIME_CALIBERATED)
        # TIME_CALIBERATED is an average time per m length. Need to caliberate according to the flooring.

        resDist = 0
        if units >= 0.2:
            resDist = units

        # print "dist in m : ",units
        possible = True  # movement possible in direction
        if units < 0.2:
            possible = False
            units = ONEUNITDIST  # NOT UPDATING AS OBSTCLE JUST IN FRONT HENCE WE DONT WANT 0 BTW GRID LINES

        return [possible, units]

    def run(self):
        time.sleep(60)


virtualRobotConfig = PepperConfiguration("Amber")
myRobot = Robot(virtualRobotConfig)

moveHands = MoveHands(myRobot)
moveHands.run()
Exemple #8
0
from pynaoqi_mate import Robot
from configuration import PepperConfiguration

config = PepperConfiguration('Amber')
pepper = Robot(config)

pepper.ALTextToSpeech.setLanguage('English')
pepper.ALAnimatedSpeech.say('hello')
lang = pepper.ALTextToSpeech.getAvailableLanguages()

pepper.ALTextToSpeech.setLanguage('German')
pepper.ALTextToSpeech.say('hallo')



Exemple #9
0
from pynaoqi_mate import Robot
from configuration import PepperConfiguration
import qi

virtualRobotConfig = PepperConfiguration("Porter")
myRobot = Robot(virtualRobotConfig)


# Hands
# open
myRobot.ALMotion.openHand("RHand")
myRobot.ALMotion.openHand("LHand")

# close
myRobot.ALMotion.closeHand("RHand")
myRobot.ALMotion.closeHand("LHand")

import sys
sys.path.append('..')
import naoqi
import time
from pynaoqi_mate import Robot
from configuration import PepperConfiguration

conf = PepperConfiguration("Amber")
# robot = Robot(conf)

# Create a proxy to ALLandMarkDetection
try:
    markProxy = naoqi.ALProxy("ALLandMarkDetection", conf.Ip, conf.Port)
except Exception, e:
    print "Error when creating landmark detection proxy:"
    print str(e)
    exit(1)

# Subscribe to the ALLandMarkDetection extractor
period = 500
markProxy.subscribe("Test_Mark", period, 0.0)

memValue = "LandmarkDetected"

# Create a proxy to ALMemory.
try:
    memProxy = naoqi.ALProxy("ALMemory", conf.Ip, conf.Port)
except Exception, e:
    print "Error when creating memory proxy:"
    print str(e)
    exit(1)
class ControlFlow():
    def __init__(self):
        self.config = PepperConfiguration(_ROBOT_NAME)
        if(not self.config.isAvailable()):
            Logger.err("ControlFlow", "checkAvailability", "name: " + self.config.Name + ", ip: " + self.config.Ip + " not reachable!")
            sys.exit(1) #Abort since robot is not available...
        self.robot = Robot(self.config)
        Speech(self.robot) #Initialize Speech (static class, no reference needed)
        DoorChecker(self.robot) #Initialize DoorChecker (static class, no reference needed)
        TabletHandler(self.robot) #Initialize TabletHandler (static class, no reference needed)
        Filetransfer(self.config) #Initialize Filetransfer (static class, no reference needed)
        #self.tracer = Tracer(self.robot) # enable to gather sensor data
        self.sensorhandler = SensorHandler(self.robot)
        self.planner = Planner()
        self.movement = Movement(self.robot)
        self.poscalib = PositionCalibrator(self.robot)
        self.currentpos = _START_COORDINATE

    def init(self):
        global _RUN
        _RUN = True
        self.robot.ALRobotPosture.goToPosture(_INIT_POSTURE, 1)
        self._write_actual_position(self.currentpos)
        #self.sensorhandler.write_operation_modes(1.0) #Laser and Obstacle Detection Off
        return True

    def run(self):
        sub_arrived = self.robot.ALMemory.subscriber("PeoplePerception/JustArrived")
        sub_arrived.signal.connect(self.on_people_detected)
        sub_tablet = self.robot.ALMemory.subscriber("FGButtonClicked")
        sub_tablet.signal.connect(self.on_room_selected)
        Logger.info("ControlFlow", "run", "Start FloorGuide behaviour.")

        while _RUN:
            pass


    def on_people_detected(self, value):
        Logger.info("ControlFlow", "on_people_detected", "Hello, I'm pepper. May I guide you to a room?")
        self.robot.ALRobotPosture.goToPosture(_INIT_POSTURE, 1)
        #show Room Selection and register call back
        TabletHandler.startApp(TabletHandler.getRoomSelectionApp())

    def on_room_selected(self, value):
        TabletHandler.startApp(TabletHandler.getMapApp())
        coordinate = self.planner.get_coor_by_room_name(value)
        if coordinate != None:
            Logger.info("ControlFlow", "onRoomSelected", "I will bring you to the room now. Please stand aside.")
            time.sleep(3)
            self.move_to_room(coordinate, value)
        else:
            Logger.err("ControlFlow", "onRoomSelected", "could not find specified room - abort behavior")
            self.init()

    def move_to_room(self, coordinate, room_name):
        move_success = self.move_to_location(_START_COORDINATE, coordinate)
        if move_success:
            self.announce_destination(room_name)
            self.go_to_start_coordinate()

    def move_to_location(self, start_coordinate, end_coordinate):
        coord_list = self.planner.get_coord_list(start_coordinate, end_coordinate)
        Logger.debug("ControlFlow", "moveToLocation", "I have %d waypoints." % len(coord_list))

        for i in range(len(coord_list)):
            for cmd in self.planner.get_move_cmd_from_coord(self.currentpos, coord_list[i]):

                Logger.info("ControlFlow", "moveToLocation", cmd.getText())
                if not self.movement.move(cmd):
                    Logger.err("ControlFlow", "moveToLocation", "Could not move to the given Position. Is something in my way?")
                    return False
                if cmd.get_isCalibrationCmd():
                    self.robot.ALRobotPosture.goToPosture(_INIT_POSTURE, 1)
                    self.poscalib.calibratePosition()
            self._write_actual_position(self.currentpos)

        return True

    def announce_destination(self, door_name):
        self.robot.ALRobotPosture.goToPosture(_INIT_POSTURE, 1)
        DoorChecker.check_door(door_name)
        Logger.info("ControlFlow", "announceDestination", "I found the correct room, it's directly in front of me")
        time.sleep(5)

    def go_to_start_coordinate(self):
        Logger.info("ControlFlow", "goToStartCoordinate", "Moving back to my initial position")
        self.move_to_location(self.currentpos, _START_COORDINATE)
        global _RUN
        _RUN = False
        self.init()

    def _write_actual_position(self, coordinate):
        pos_obj = {}
        obj = {}
        obj['x'] = coordinate.getX()
        obj['y'] = coordinate.getY()
        obj['degrees'] = coordinate.getDegrees()
        pos_obj['position'] = obj
        with open(_POSITION_LOCAL, 'w') as posfile:
            json.dump(pos_obj, posfile)
        Filetransfer.transfer_file_from_local_to_pepper(_POSITION_LOCAL, _POSITION_REMOTE)
 def __init__(self):
     self.config = PepperConfiguration("Porter")
     robot = Robot(self.config)
     self.camera = robot.ALPhotoCapture