joint_state_publisher reading only one joint from robot/joint_state
I'm attempting to write my robot state to jointstatepublisher to be viewed in RVIZ, but jointstatepublisher is only reading one joint from each message. How do I get jointstatepublisher to update the entire state?
My node myrobotsimulator is publishing jointState messages at 10hz to topic /myrobot/jointstates, which is read by jointstatepublisher (also running at 10Hz). Each message contains seven joint state values.
example:
header:
seq: 210
stamp:
secs: 1571243618
nsecs: 169618145
frame_id: ''
name: [j1, j2, j3, j4, j5, j6, j7]
position: [0.25346757744592685, 0.25346757744592685, 0.25346757744592685, 0.25346757744592685, 0.25346757744592685, 0.25346757744592685, 0.03767337887229634]
velocity: []
effort: []
But jointstatepublisher only updates j4. The other six joints never get updated. If each jointState message contains only one joint, then jointstatepublisher updates that joint as expected. But if I publish joint states one at a time at 70Hz, jointstatepublisher only manages to read a few of them, maybe 20%.
Is there some incorrect syntax in my messages? Is it a timing issue? It seems like we should be able to do just about anything at 10Hz. How do I get jointstatepublisher to update the entire robot, and not just one joint?
Asked by travisLlado on 2019-10-16 11:57:37 UTC
Answers
Initially I tried writing directly to robot_state_publisher, but for some reason that caused my URDF to fall apart (all robot links would appear at the origin) so I wrote to joint_state_publisher instead and that worked somewhat. After I finished writing my joint_state test node, I switched it back to write directly to robot_state_publisher again instead of joint_state_publisher and now everything works perfectly. I don't know what the problem was.
Asked by travisLlado on 2019-10-17 14:19:39 UTC
Comments
Without seeing code (ie: the code that populates your
JointState
msgs) it's going to be hard to say anything.Let's not focus on the publication rate so much, as that is most likely completely irrelevant here.
Asked by gvdhoorn on 2019-10-16 14:46:21 UTC
There isn't anything technically wrong with what you are trying to do... but why do you even need a
joint_state_publisher
. Might it be easier to run arobot_state_publisher
and remap it'sjoint_states
topic to listen tomy_robot/joint_states
? At the very least, this could help with debugging. @gvdhoorn is correct that seeing the code publishing themy_robot/joint_states
topic would be helpful, but it could also be helpful to see a launch file or set of command line commands to see how you've configured therobot_state_publisher
andjoint_state_publisher
Asked by jarvisschultz on 2019-10-16 14:54:22 UTC