ROS1:了解 JointHandle

问题描述

目前,我正在尝试为我的机器人编写一个 hardware_interface.cpp,更具体地说,是 write() 部分。根据本教程 link,下面的 JointHandle 将所需的命令写入 cmd 变量,这是我的 "position_controllers/JointTrajectoryController"输出

hardware_interface::JointHandle pos_handle_jnt1(jnt_state_interface.getHandle("my_jnt1"),&cmd[1]);

我的问题是,cmd 值是否是我的 JointTrajectoryController 的结果。然后,它应该对应于我的 arm_controller/follow_joint_trajectory/goal 的控制点,但是从下面的输出中可以看出,cmd[1] 值似乎只考虑最后一个-0.3561511482429065。我的假设正确吗?如果是,我如何更改 cmd 值,使其按顺序跟随控制点?

cmd[1] 输出

data: 0.0
---
data: 0.0
---
data: -3.98925667212e-15
---
data: -0.0247069448233
---
data: -0.0914327800274
---
data: -0.204322084785
---
data: -0.299599915743
---
data: -0.347527623177
---
data: -0.356151133776
---
data: -0.356151133776

arm_controller/follow_joint_trajectory/目标输出

goal:    trajectory: 
    header: 
      seq: 0
      stamp: 
        secs: 0
        nsecs:         0
      frame_id: "world"
    joint_names: 
      - my_jnt0
      - my_jnt1
      - my_jnt2
      - my_jnt3
      - my_jnt4
    points: 
      - 
        positions: [0.0,0.0,0.0]
        veLocities: [0.0,0.0]
        accelerations: [0.0,0.0]
        effort: []
        time_from_start: 
          secs: 0
          nsecs:         0
      - 
        positions: [0.0,-0.05878427698533184,0.052137219402668085,0.01525140182758336,-0.008604344244919617]
        veLocities: [0.0,-0.25354584381866674,0.21981604582029537,0.0684385954630451,-0.03470879746467376]
        accelerations: [0.0,-0.7591462700998434,0.6374586363274559,0.2157806286696093,-0.09409299489722199]
        effort: []
        time_from_start: 
          secs: 0
          nsecs: 401565155
      - 
        positions: [0.0,-0.11760003078838882,0.10265220884352354,0.03137742873451792,-0.01642960678965265]
        veLocities: [0.0,-0.4111519142259137,0.34665203354962104,0.11616224268468915,-0.05166236200839654]
        accelerations: [0.0,-0.6937200222775882,0.5067983550049543,0.23741297594133587,-0.05049130866870113]
        effort: []
        time_from_start: 
          secs: 0
          nsecs: 564623473
      - 
        positions: [0.0,-0.17660465200207817,0.1516744862678577,0.04843293156577636,-0.023502765831555902]
        veLocities: [0.0,-0.46552335392135913,0.38017464952978736,0.1381194904499298,-0.052770786058357985]
        accelerations: [0.0,-0.06172943703754964,-0.05243103983785829,0.07382859050259587,0.04033188637281179]
        effort: []
        time_from_start: 
          secs: 0
          nsecs: 692449766
      - 
        positions: [0.0,-0.23594297332022304,0.19930756371414443,0.06648442181566575,-0.029849012209587134]
        veLocities: [0.0,-0.41515666971470355,0.3281799281944251,0.12910905650802884,-0.04213231498775033]
        accelerations: [0.0,0.7433632579075067,-0.6663072406196392,-0.18762405610758165,0.11056803881971504]
        effort: []
        time_from_start: 
          secs: 0
          nsecs: 818850323
      - 
        positions: [0.0,-0.29574983988306314,0.24563234375109627,0.08561085006591221,-0.035493353933945315]
        veLocities: [0.0,-0.2548766998411054,0.19531459272193535,0.08271469381554367,-0.0231525866963735]
        accelerations: [0.0,0.7419441302240752,-0.5894321277847724,-0.22884581633389578,0.07633381389459255]
        effort: []
        time_from_start: 
          secs: 0
          nsecs: 984581526
      - 
        positions: [0.0,-0.3561511482429065,0.2907088114687755,0.10590452327134249,-0.04046218649721141]
        veLocities: [0.0,0.7339993202908858,-0.5477711917890713,-0.24660959743206826,0.06038146893025332]
        effort: []
        time_from_start: 
          secs: 1
          nsecs: 390267826   path_tolerance: []   goal_tolerance: []   goal_time_tolerance: 
    secs: 0
    nsecs:         0

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)