def __init__(self, grammar, enabled):
        """Constructor for GrammarState.

        @type grammar: string
        @param grammar: The grammar name that you want enabled or disable.

        @type enabled: boolean
        @param enabled: If False, 0 or None, the grammar will be disabled. Enabled otherwise.

        """

        def asr_request_cb(userdata, old_request):
            if enabled:
                print "ASR: Enabling grammar '%s'" % grammar
            else:
                print "ASR: Disabling grammar '%s'" % grammar
            update = asrupdate()
            update.enable_grammar = grammar
            update.active = bool(enabled)

            return update

        ServiceState.__init__(self,
            GRAMMAR_ACTION_NAME, recognizerService,
            request_cb=asr_request_cb)
 def __init__(self, service_name, service_spec, **args):
     """
     Init method also initializes timer and executions counter
     """
     ServiceState.__init__(self, service_name = service_name, service_spec = service_spec, **args)
     self.total_time = 0
     self.num_executions = 0
Exemple #3
0
 def __init__(self, leftArmEnabled=True, rightArmEnabled=True):
     ServiceState.__init__(self,
                           '/enable_arms_walking_srv',
                           SetArmsEnabled,
                           request=SetArmsEnabledRequest(
                               left_arm=leftArmEnabled,
                               right_arm=rightArmEnabled))
Exemple #4
0
 def __init__(self, frame='/map'):
     ServiceState.__init__(
         self,
         'move_base/make_plan',
         GetPlan,
         input_keys=['x', 'y', 'yaw', 'start_x', 'start_y', 'start_yaw'],
         request_cb=self.__request_cb)
     self.frame = frame
Exemple #5
0
	def __init__(self):
		# Class constructor
		ServiceState.__init__(self, '/nao_shopping_list/checkObjects',
									checkObjects,
									outcomes=['succeeded'],
									input_keys=['shopping_list'],
									output_keys=['shopping_list'],
									response_cb=self.shopping_list_response_cb)
 def __init__(self, service, name_template="capture%03d.png"):
     ServiceState.__init__(self,
                           service,
                           SaveFile,
                           request_cb=self._request_cb,
                           response_cb=self._response_cb)
     self._name_template = name_template
     self._n = 0
 def __init__(self, frame="/map"):
     ServiceState.__init__(
         self,
         "move_base/make_plan",
         GetPlan,
         input_keys=["x", "y", "yaw", "start_x", "start_y", "start_yaw"],
         request_cb=self.__request_cb,
     )
     self.frame = frame
 def __init__(self):
     def resp_cb(ud, response):
         ud.resp_text = response.question_guess_response
         if response.is_guess:
             return 'game_finished'
         return 'continue_game'
     ServiceState.__init__(self, '/akinator_srv', AkinatorQA,
                           output_keys=['resp_text'], request_slots=['question_response'],
                           outcomes=['game_finished', 'continue_game'], response_cb=resp_cb)
 def __init__(self):
     event = BehaviourEventRequest()
     event.name = 'presentToPerson'
     
     #event.name = 'say'
     #arg = BehaviourArgument()
     #arg.key = 'text'
     #arg.value = 'Hello World'
     #event.arguments = [arg,]
     ServiceState.__init__(self, '/behaviour', BehaviourEvent, request = event)
Exemple #10
0
 def __init__(self):
     service = '/clopema_planner/grasp_it'
     ServiceState.__init__(self,
                           service,
                           ClopemaGraspIt,
                           request_slots=[
                               'ik_link', 'poses', 'frame_id',
                               'offset_minus', 'offset_plus'
                           ],
                           response_cb=self.result_cb,
                           output_keys=['trajectory'])
Exemple #11
0
    def __init__(self, objective=None):
        # Private attributes
        input_keys = []
        if not objective:
            input_keys = ['objective']
            self._objective = None
        elif not isinstance(objective, Pose2D):
            self._objective = Pose2D(objective[0], objective[1], objective[2])
        else:
            self._objective = objective

        # Class constructor
        ServiceState.__init__(self, '/cmd_pose_srv', CmdPoseService, outcomes=['succeeded'], request_cb=self.move_to_request_cb, input_keys=input_keys)
Exemple #12
0
 def __init__(self):
     service = '/clopema_planner/grasp_from_table'
     ServiceState.__init__(self,
                           service,
                           ClopemaGraspFromTable,
                           request_slots=[
                               'ik_link', 'poses', 'frame_id', 'table_desk',
                               'offset_minus', 'offset_plus',
                               'offset_table_plus', 'offset_table_minus',
                               'grasping_angle'
                           ],
                           response_cb=self.result_cb,
                           output_keys=['trajectory'])
Exemple #13
0
    def __init__(self, twist_msg):
        self._twist = twist_msg
        input_keys = []
        if not twist_msg:
            input_keys = ['velocity']

        # Method to define the request
        def walk_request_cb(ud, request):
            if (not self._twist):
                self._twist = ud.velocity
            walk_request = CmdVelServiceRequest()
            walk_request.twist = self._twist
            return walk_request

        ServiceState.__init__(self, '/cmd_vel_srv', CmdVelService, input_keys=input_keys, request_cb=walk_request_cb)
Exemple #14
0
    def __init__(self, objective=None):
        # Private attributes
        input_keys = []
        if not objective:
            input_keys = ['objective']
            self._objective = None
        elif not isinstance(objective, Pose2D):
            self._objective = Pose2D(objective[0], objective[1], objective[2])
        else:
            self._objective = objective

        # Class constructor
        ServiceState.__init__(self,
                              '/cmd_pose_srv',
                              CmdPoseService,
                              outcomes=['succeeded'],
                              request_cb=self.move_to_request_cb,
                              input_keys=input_keys)
Exemple #15
0
    def __init__(self, twist_msg):
        self._twist = twist_msg
        input_keys = []
        if not twist_msg:
            input_keys = ['velocity']

        # Method to define the request
        def walk_request_cb(ud, request):
            if (not self._twist):
                self._twist = ud.velocity
            walk_request = CmdVelServiceRequest()
            walk_request.twist = self._twist
            return walk_request

        ServiceState.__init__(self,
                              '/cmd_vel_srv',
                              CmdVelService,
                              input_keys=input_keys,
                              request_cb=walk_request_cb)
 def __init__(self):
     ServiceState.__init__(self, '/RH/integration/MoveRobotRandom', RobotIntegration, input_keys=['noImages'],
                           request_slots=['arm'], response_cb=self._res_cb, response_slots=['numPos', 'succeed'])
     self.counter = 0;
Exemple #17
0
 def __init__(self):
     ServiceState.__init__(self, '/stop_walk_srv', Empty)
Exemple #18
0
 def __init__(self):
     ServiceState.__init__(self, '/stop_walk_srv', Empty)
 def __init__(self):
     ServiceState.__init__(self, '/RH/calibration/captureHandEye', HandEyeCalibration, request_slots=['doIt'],
                           response_cb=self._res_cb, response_slots=['status_message', 'success'])
     self.counter = 1;
 def __init__(self):
     ServiceState.__init__(self, '/stop_recognition', Empty)
Exemple #21
0
 def __init__(self):
     ServiceState.__init__(self, '/clopema_planner/linear_interpolation_dual', ClopemaLinearInterpolationDual(),
                           request_cb=self._req_cb, input_keys=['ik_link_1', 'poses_1', 'ik_link_2', 'poses_2'],
                           response_cb=self._res_cb, output_keys=['trajectory'])
Exemple #22
0
 def __init__(self):
     ServiceState.__init__(self, '/clopema_planner/joint_interpolation', ClopemaJointInterpolation(),
                           request_cb=self._req_cb, input_keys=['robot', 'goals'],
                           response_cb=self._res_cb, output_keys=['trajectory'])
 def __init__(self):
     ServiceState.__init__(self, '/RH/calibration/cameraCalibration', CameraCalibration, request_slots=['doIt'],
                           response_cb=self._res_cb, response_slots=['status_message', 'success'])
 def __init__(self):
     ServiceState.__init__(self, '/RosPatrolService/stop', Empty)        
 def __init__(self, feedback_to_provide=None):
     ServiceState.__init__(self, '/RosPatrolService/start', Empty, output_keys=['action_feedback'])
     self._dyn_reconfigure_client = dynamic_reconfigure.client.Client('/move_base/PalLocalPlanner')
     self.feedback = feedback_to_provide
Exemple #26
0
 def __init__(self):
     ServiceState.__init__(self, '/body_stiffness/enable', Empty)
 def __init__(self):
     ServiceState.__init__(self, '/stop_recognition', Empty)
 def __init__(self):
     ServiceState.__init__(self, '/RH/integration/RobotInit', RobotIntegration, request_slots=['arm'], output_keys=['noImages'],
                           response_cb=self._res_cb, response_slots=['numPos'])
     self.counter = 0;
 def __init__(self):
     ServiceState.__init__(self, '/RH/calibration/processTarget', CameraCalibration, request_slots=['doIt'], input_keys=['noImages'], response_cb=self._res_cb, response_slots=['status_message', 'success'])
     self.counter = 1;
Exemple #30
0
 def __init__(self, frame='/map'):
     ServiceState.__init__(self, 'move_base/make_plan', GetPlan,
                           input_keys=['x', 'y', 'yaw', 'start_x', 'start_y', 'start_yaw'],
                           request_cb=self.__request_cb)
     self.frame = frame
Exemple #31
0
 def __init__(self, *args, **kwargs):
     ServiceState.__init__(self, '/footstep_srv', StepTargetService, *args,
                           **kwargs)