本文整理汇总了Python中moveit_commander.MoveGroupCommander.set_pose_targets方法的典型用法代码示例。如果您正苦于以下问题:Python MoveGroupCommander.set_pose_targets方法的具体用法?Python MoveGroupCommander.set_pose_targets怎么用?Python MoveGroupCommander.set_pose_targets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moveit_commander.MoveGroupCommander
的用法示例。
在下文中一共展示了MoveGroupCommander.set_pose_targets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MoveGroupCommander
# 需要导入模块: from moveit_commander import MoveGroupCommander [as 别名]
# 或者: from moveit_commander.MoveGroupCommander import set_pose_targets [as 别名]
from std_msgs.msg import Header
moveit_error_dict = {}
for name in MoveItErrorCodes.__dict__.keys():
if not name[:1] == '_':
code = MoveItErrorCodes.__dict__[name]
moveit_error_dict[code] = name
if __name__=='__main__':
rospy.init_node("pose_goal_test11")
rospy.loginfo("Starting up move group commander for right arm")
right_arm_mgc = MoveGroupCommander("right_arm_torso")
goal_point = Point(0.4, -0.2, 1.1)
goal_ori = Quaternion(0.0,0.0,0.0,1.0)
right_arm_mgc.set_pose_reference_frame('base_link')
list_goals = []
for i in range(1):
goal_point.z += 0.05
rospy.loginfo(str(i) + ": Setting new goal:\n " + str(goal_point))
list_goals.append(Pose(goal_point, goal_ori))
rospy.loginfo("list of goals:\n" + str(list_goals))
right_arm_mgc.set_pose_targets(list_goals)
rospy.loginfo("go()")
right_arm_mgc.go()
示例2: SmartGrasper
# 需要导入模块: from moveit_commander import MoveGroupCommander [as 别名]
# 或者: from moveit_commander.MoveGroupCommander import set_pose_targets [as 别名]
#.........这里部分代码省略.........
joint_positions=joint_positions)
timer = Timer(0.0, self.__start_ctrl)
timer.start()
time.sleep(0.1)
self.__unpause_physics.call()
self.__reset_world.call()
def get_object_pose(self):
"""
Gets the pose of the ball in the world frame.
@return The pose of the ball.
"""
return self.__get_pose_srv.call(self.__current_model_name, "world").pose
def get_tip_pose(self):
"""
Gets the current pose of the robot's tooltip in the world frame.
@return the tip pose
"""
return self.arm_commander.get_current_pose(self.arm_commander.get_end_effector_link()).pose
def move_tip_absolute(self, target):
"""
Moves the tooltip to the absolute target in the world frame
@param target is a geometry_msgs.msg.Pose
@return True on success
"""
self.arm_commander.set_start_state_to_current_state()
self.arm_commander.set_pose_targets([target])
plan = self.arm_commander.plan()
if not self.arm_commander.execute(plan):
return False
return True
def move_tip(self, x=0., y=0., z=0., roll=0., pitch=0., yaw=0.):
"""
Moves the tooltip in the world frame by the given x,y,z / roll,pitch,yaw.
@return True on success
"""
transform = PyKDL.Frame(PyKDL.Rotation.RPY(pitch, roll, yaw),
PyKDL.Vector(-x, -y, -z))
tip_pose = self.get_tip_pose()
tip_pose_kdl = posemath.fromMsg(tip_pose)
final_pose = toMsg(tip_pose_kdl * transform)
self.arm_commander.set_start_state_to_current_state()
self.arm_commander.set_pose_targets([final_pose])
plan = self.arm_commander.plan()
if not self.arm_commander.execute(plan):
return False
return True
def send_command(self, command, duration=0.2):
"""
Send a dictionnary of joint targets to the arm and hand directly.
@param command: a dictionnary of joint names associated with a target:
{"H1_F1J1": -1.0, "shoulder_pan_joint": 1.0}
@param duration: the amount of time it will take to get there in seconds. Needs to be bigger than 0.0