JointState message(s) with heterogeneous position and velocity sensors
Hello,
I'd like to produce JointState messages for a robot (Pepper). The messages are typically stored in a rosbag for debugging using plots and rviz.
The robot has several joints, some of them having position sensors, others having only velocity sensors (wheels).
I'm wondering about the proper way to fit this data in one or several JointState messages.
I tried using NaN for missing data as in:
JointState:
name = ["HeadYaw", "WheelB"]
position = [0.1111, nan]
velocity = [nan, 0.0022]
effort = []
But rviz (or tf?) noisily complains about it. It prints this log for each message:
[ERROR] [1475223793.988530679, 1179.142482190]: Ignoring transform for childframeid "WheelBlink" from authority "unknownpublisher" because of a nan value in the transform (nan nan nan) (nan nan nan nan)
I can imagine workarounds:
- use zeros instead of NaN,
- integrate the velocity to compute a position of NaN,
but I fear to lure users into believing we have position sensors.
Another solution would be to write two JointState messages in the same topic. One for joints with position sensors, another one for joints with velocity sensors, like this:
JointState:
name = ["HeadYaw"]
position = [0.1111]
velocity = []
effort = []
JointState:
name = ["WheelB"]
position = []
velocity = [0.0022]
effort = []
This solution seems clean and a bit more efficient. Is it supported?
When trying it I get spammed by this log
[ERROR] [1475228046.318736664, 1475228032.225733209]: Robot state publisher received an invalid joint state vector
Apparently coming from this check:
if (state->name.size() != state->position.size()){
ROS_ERROR("Robot state publisher received an invalid joint state vector");
return;
}
I suspect the check is wrong, given the JointState message definition:
All arrays in this message should have the same size, or be empty. This is the only way to uniquely associate the joint name with the correct states.
So to summarize, my questions are:
- what is the proper way to fit my data into JointState message(s)?
- Am I right thinking the jointstatelistener log is a bug?
Thank you!
Asked by barthelemy on 2016-09-30 04:59:27 UTC
Answers
Ticket on github: https://github.com/ros/robot_state_publisher/pull/64
Asked by tfoote on 2016-10-17 17:01:52 UTC
Comments