def setup(cls, robot): robot._primitive_manager._filter = partial(numpy.sum, axis=0) #cls._name = "cherry" # Doesn't work, i have to find why name = "cherry" if False: cls.vrep_hack(robot) for m in robot.motors: m.compliant_behavior = 'dummy' m.goto_behavior = 'minjerk' m.moving_speed = 70 for m in robot.motors: m.compliant = False m.goal_position = 0 for m in robot.head: m.compliant = True try: attach_primitives(robot) except: print "Cannot add primitives" try: robot.test_gtts.start() except: print "Something goes wrong with gTTS" try: robot.send_ip.start(name) except: print "Unable to send ip to the server"
def setup(self): """ Initialisation de Cherry. Attachements des primitives, initialisation de la camera si besoin """ robot = self.robot for m in robot.motors: m.compliant_behavior = 'safe' m.goto_behavior = 'minjerk' attach_primitives(self, self.isCamera)
def setup(cls, config): print "Robot setup started :" try: robot = from_json(config) except: print "Unable to configure the robot" else: print "Robot configuration successful !" print "Starting motors configuration" for m in robot.motors: m.compliant_behavior = 'dummy' m.goto_behavior = 'minjerk' m.moving_speed = 70 for m in robot.motors: m.compliant = False m.goal_position = 0 print m for m in robot.head: m.compliant = True try: attach_primitives(robot) except: print "Primitives not attached " else: print "Primitives attached successfully" try: robot.test_gtts.start() except: print "Something goes wrong with gTTS" else: print "gTTS OP" return robot
def setup(self): robot = self.robot for m in robot.motors: m.compliant_behavior = 'safe' m.goto_behavior = 'minjerk' #Attach your primitive here # robot.attach_primitive(UpperBodyIdleMotion(robot, 50), 'upper_body_idle') # robot.attach_primitive(HeadIdleMotion(robot, 50), "head_idle") # robot.attach_primitive(YesBehave(robot, 50), "yes_behave") # robot.attach_primitive(WaveBehave(robot, 50), "wave_behave") # robot.attach_primitive(NoBehave(robot, 50), "no_behave") # robot.attach_primitive(CrossArmsBehave(robot), "cross_arms_behave") # robot.attach_primitive(CrossHandsBehave(robot), "cross_hands_behave") # robot.attach_primitive(ShowLeftBehave(robot), "show_left_behave") # robot.attach_primitive(ShowRightBehave(robot), "show_right_behave") # robot.attach_primitive(ShowFrontBehave(robot), "show_front_behave") # robot.attach_primitive(TakeHeadBehave(robot), "take_head_behave") # robot.attach_primitive(TakeLeftEarBehave(robot), "take_left_ear_behave") # robot.attach_primitive(TakeRightEarBehave(robot), "take_right_ear_behave") # robot.attach_primitive(RightHandMouvBehave(robot, 50), "right_hand_mouv_behave") # robot.attach_primitive(ComeMouvBehave(robot, 50), "come_mouv_behave") # robot.attach_primitive(KeepFrontMouvBehave(robot, 50), "keep_front_mouv_behave") # robot.attach_primitive(NormalBehave(robot), "normal_behave") # robot.attach_primitive(SaluteBehave(robot), "salute_behave") # robot.attach_primitive(ThinkBehave(robot), "think_behave") # robot.attach_primitive(CopyArmBehave(robot, 50), "copy_arm_behave") # robot.attach_primitive(BowBehave(robot), "bow_behave") # robot.attach_primitive(TalkOneBehave(robot), "talk_one_behave") # robot.attach_primitive(TalkTwoBehave(robot), "talk_two_behave") # robot.attach_primitive(TalkThreeBehave(robot), "talk_three_behave") # robot.attach_primitive(TalkFourBehave(robot), "talk_four_behave") # robot.attach_primitive(TrackingBehave(robot, self.camera, 50), "tracking_behave") # robot.attach_primitive(Speak(robot), "speak") # robot.attach_primitive(SayHello(robot), "say_hello") # robot.attach_primitive(SayText(robot), "say_text") # robot.attach_primitive(SadBehave(robot), "sad_behave") # robot.attach_primitive(RunLook(robot, self.camera, 50), "run_look") # robot.attach_primitive(Speech(robot), "speech") # robot.attach_primitive(Bonnard1(robot), "bonnard_1") # robot.attach_primitive(Bonnard2(robot), "bonnard_2") # robot.attach_primitive(Bonnard3(robot), "bonnard_3") # robot.attach_primitive(Bonnard4(robot), "bonnard_4") # robot.attach_primitive(Bonnard5(robot), "bonnard_5") # robot.attach_primitive(Bonnard6(robot), "bonnard_6") # # robot.attach_primitive(Eyes(robot), "eyes") # # robot.attach_primitive(Get_reaction(robot), "get_reaction") # # robot.attach_primitive(Get_fond(robot), "get_fond") # # robot.attach_primitive(Basic(robot), "basic") # # robot.attach_primitive(Blink(robot), "blink") # # robot.attach_primitive(Neutral2sleep(robot), "neutral2sleep") # # robot.attach_primitive(Sleep2neutral(robot), "sleep2neutral") # # robot.attach_primitive(Neutral2surprise(robot), "neutral2surprise") # # robot.attach_primitive(Surprise2neutral(robot), "surprise2neutral") # # robot.attach_primitive(Surprise(robot), "surprise") # # robot.attach_primitive(Sleepy(robot), "sleepy") # # robot.attach_primitive(Happy(robot), "happy") # # robot.attach_primitive(Neutral2happy(robot), "neutral2happy") # # robot.attach_primitive(Happy2neutral(robot), "happy2neutral") # # robot.attach_primitive(Neutral2sad(robot), "neutral2sad") # # robot.attach_primitive(Sad2neutral(robot), "sad2neutral") # # robot.attach_primitive(Sad(robot), "sad") attach_primitives(self, self.isCamera)
def setup(cls): print "Robot setup started :" json_data = open('./config/conf.json') data = json.load(json_data) json_data.close() port = data['robot']['port'] name = data['robot']['name'] try: cls.robot = from_json('config/torso.json') except Exception as e: try: cls.robot = from_json('config/torso.json') except Exception as e: raise else: print "Robot configuration successful !" finally: pass raise else: print "Robot configuration successful !" # Attach Gtts try: cls.robot.attach_primitive(SayFR(cls.robot), 'say_fr') cls.robot.attach_primitive(SayEN(cls.robot), 'say_en') cls.robot.attach_primitive(SayES(cls.robot), 'say_es') cls.robot.attach_primitive(SayDE(cls.robot), 'say_de') except Exception as e: print "Something goes wrong with gTTS" raise else: print "gTTS attached successfully" print "Starting motors configuration" for m in cls.robot.motors: m.compliant_behavior = 'dummy' m.goto_behavior = 'minjerk' m.moving_speed = 80 for m in cls.robot.motors: m.compliant = False m.goal_position = 0 print m for m in cls.robot.head: m.compliant = True try: attach_primitives(cls.robot) except: print "Primitives not attached " else: print "Primitives attached successfully" try: cls.robot.torso_idle_motion.start() cls.robot.upper_body_idle_motion.start() # cls.robot.head_idle_motion.start() except Exception as e: raise else: pass # Voice.silent(text="Setup done",lang='en') try: Voice.silent(text="Bonjour, je m'appelle " + name + ", ravi de vous rencontrer.", lang='fr') except: print "WARNING : no response from google tts engine : Check internet connectivity" else: pass return cls.robot