Robotics StackExchange | Archived questions

Understanding JointHandle

Hi all,

currently, I am trying to write a hardwareinterface.cpp for my robot, more specifically, the write() part. According to this tutorial link, the below JointHandle writes the desired command into the cmd variable, which is **the output of my `"positioncontrollers/JointTrajectoryController"`**.

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

My question is if the cmd value is the result of my JointTrajectoryController. Then, it should correspond to the control points of my arm_controller/follow_joint_trajectory/goal, however as you can see from the below outputs, it seems like the cmd[1] value only considers the last value -0.3561511482429065. Is my assumption correct? If yes, how could I change the cmd values so that they sequentially follow the control points?

cmd[1] output:

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

armcontroller/followjoint_trajectory/goal output:

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, 0.0, 0.0]
        velocities: [0.0, 0.0, 0.0, 0.0, 0.0]
        accelerations: [0.0, 0.0, 0.0, 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.0, 0.0, 0.0, 0.0]
        accelerations: [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

Asked by xman236 on 2021-03-07 06:49:04 UTC

Comments

Answers