moveit_msgs.msg.DisplayTrajectory说明它处在于/opt/ros/kinetic/share/moveit_msgs/msg中,根据它的意思应该用来描述轨迹的数据
moveit_msgs.msg.DisplayTrajectory
DisplayTrajectory.msg文件
# The model id for which this path has been generated
string model_id
# The representation of the path contains position values for all the joints that are moving along the path; a sequence of trajectories may be specified
RobotTrajectory[] trajectory
# The robot state is used to obtain positions for all/some of the joints of the robot.
# It is used by the path display node to determine the positions of the joints that are not specified in the joint path message above.
# If the robot state message contains joint position information for joints that are also mentioned in the joint path message, the positions in the joint path message will overwrite the positions specified in the robot state message.
RobotState trajectory_start
在move_group_python_interface_tutorial.py中,发布的moveit_msgs.msg.DisplayTrajectory Topic
1、RobotTrajectory[] trajectory是用作描述规划出来的所有点的信息,即后面笛卡尔空间规划的plan的内容
2、RobotState trajectory_start是用来描述所有动作做完后,当前位姿的描述;即get_current_state()描述的数据
关于moveIt中的路径数据格式如下
get_current_state()
robot = moveit_commander.RobotCommander()
print(robot.get_current_state())
joint_state:
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: "/panda_link0"
name: [panda_joint1, panda_joint2, panda_joint3, panda_joint4, panda_joint5, panda_joint6,
panda_joint7, panda_finger_joint1, panda_finger_joint2]
position: [0.0, -0.785, 0.0, -2.356, 0.0, 1.571, 0.785, 0.0, 0.0]
velocity: []
effort: []
multi_dof_joint_state:
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: "/panda_link0"
joint_names: []
transforms: []
twist: []
wrench: []
attached_collision_objects: []
is_diff: False
get_current_joint_values()
group_name = "panda_arm"
group = moveit_commander.MoveGroupCommander(group_name)
joint_goal = group.get_current_joint_values()
print(joint_goal)
运行结果
[0.0, -0.785, 0.0, -2.356, 0.0, 1.571, 0.785]
Pose()用于终端位姿控制的数据格式
pose_goal = geometry_msgs.msg.Pose()
#Pose是package-geometry下的package-msg下module-_Pose.py中的一个类
print(type(pose_goal),pose_goal)
运行结果
(<class 'geometry_msgs.msg._Pose.Pose'>, position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 0.0)
=获取当前终端位姿=
group_name = "panda_arm"#实例化MoveGroupCommander时,要告知要对哪个规划组操作
group = moveit_commander.MoveGroupCommander(group_name)
print(group.get_current_pose())
运行结果
header:
seq: 0
stamp:
secs: 1547624918
nsecs: 159564018
frame_id: "/panda_link0"
pose:
position:
x: 0.39996640324
y: 0.100050615081
z: 0.399971251322
orientation:
x: -0.000392486972669
y: 0.000416667882622
z: -0.000463858524582
w: 0.999999728589
笛卡尔空间规划
(plan, fraction) = group.compute_cartesian_path(
waypoints, # waypoints to follow
0.01, # eef_step
0.0)
print(type(plan),plan)
运行结果
<class 'moveit_msgs.msg._RobotTrajectory.RobotTrajectory'>, joint_trajectory:
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: "/panda_link0"
joint_names: [panda_joint1, panda_joint2, panda_joint3, panda_joint4, panda_joint5, panda_joint6,
panda_joint7]
positions: [1.7212127976332623, -1.7623114702290454, -1.660959375298973, -2.556586802657265, 1.3890841871991568, 1.6815821262488053, -1.134578918574009]
velocities: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
accelerations: [3.567880573386783, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
effort: []
time_from_start:
secs: 0
nsecs: 0
-
positions: [1.7464749091880396, -1.7628, -1.6713015849424724, -2.548441804676543, 1.3794759487690107, 1.6748594992086496, -1.1528345819135906]
velocities: [0.36690849102062467, -0.002052656937526152, -0.14599096557197652, 0.12422255921182063, -0.13269943332119652, -0.10216631008057422, -0.26004976732091556]
accelerations: [3.6756343771876514, 0.04879563681125981, -1.404474287911395, 1.3259235911492153, -1.2351307312082205, -1.0857440599778532, -2.535040152941138]
effort: []
time_from_start:
secs: 0
nsecs: 118999372