ROS中的moveit_msgs.msg.DisplayTrajectory数据

moveit_msgs.msg.DisplayTrajectory说明它处在于/opt/ros/kinetic/share/moveit_msgs/msg中,根据它的意思应该用来描述轨迹的数据

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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值