示例#1
0
 def set_open_goal(self,
                   tip_link,
                   object_name,
                   object_link_name,
                   root_link=None,
                   goal_joint_state=None,
                   weight=WEIGHT_ABOVE_CA):
     """
     :type tip_link: str
     :param tip_link: tip of manipulator (gripper) which is used
     :type object_name str
     :param object_name
     :type object_link_name str
     :param object_link_name handle to grasp
     :type root_link: str
     :param root_link: default is root link of robot
     :type goal_joint_state: float
     :param goal_joint_state: how far to open
     """
     constraint = Constraint()
     params = {
         u'tip_link': tip_link,
         u'object_name': object_name,
         u'object_link_name': object_link_name
     }
     if root_link:
         params[u'root_link'] = root_link
     if goal_joint_state:
         params[u'goal_joint_state'] = goal_joint_state
     if weight:
         params[u'weight'] = weight
     constraint.parameter_value_pair = json.dumps(params)
     self.cmd_seq[-1].constraints.append(constraint)
示例#2
0
 def set_json_goal(self, constraint_type, **kwargs):
     constraint = Constraint()
     constraint.type = constraint_type
     for k, v in kwargs.items():
         if isinstance(v, Message):
             kwargs[k] = convert_ros_message_to_dictionary(v)
     constraint.parameter_value_pair = json.dumps(kwargs)
     self.cmd_seq[-1].constraints.append(constraint)
示例#3
0
 def set_json_goal(self, constraint_type, **kwargs):
     """
     Set a goal for any of the goals defined in Constraints.py
     :param constraint_type: Name of the Goal
     :type constraint_type: str
     :param kwargs: maps constraint parameter names to values. Values should be float, str or ros messages.
     :type kwargs: dict
     """
     constraint = Constraint()
     constraint.type = constraint_type
     for k, v in kwargs.items():
         if isinstance(v, Message):
             kwargs[k] = convert_ros_message_to_dictionary(v)
     constraint.parameter_value_pair = json.dumps(kwargs)
     self.cmd_seq[-1].constraints.append(constraint)
示例#4
0
 def set_json_goal(self, constraint_type, **kwargs):
     constraint = Constraint()
     constraint.type = constraint_type
     constraint.parameter_value_pair = json.dumps(kwargs)
     self.cmd_seq[-1].constraints.append(constraint)