Need to better understand robot_state_publisher [closed]
Update: I believe that this error form the robot_stat_publisher is because I have two different files for the model. One a urdf that for rviz and the other an sdf for gazebo. I think this is causing confusion for the publisher. I have been unsuccessful at getting a single urdf to run under both gazebo and rviz without errors.
I am publishing joint states for wheels to robot_state_publisher that does NOT translate them to tf. Rviz states that there is no transformation between map and wheel. What is robot_state_publisher doing that it thinks joint_states below are not correct? Am I publishing the joint states incorrectly? From looking at the robot_state_publisher.cpp I can not see how it uses the joint state message. It get a tree but I have two models for the same robot. One in sdf for gazebo and one in urdf for rviz. They are loaded under different robot description params.
How can I translate from jointStateMsg directly to TransformStamped message and bypass the robot_state_publisher?
Error: TF_NAN_INPUT: Ignoring transform for child_frame_id "right_wheel" from authority "/robot_state_publisher" because of a nan value in the transform (-nan -nan -nan) (-nan -nan -nan -nan)
The code:
void jointStateCallback1(const control_msgs::JointControllerState msg)
{
sensor_msgs::JointState jointStateMsg;
jointStateMsg.name.resize(1);
jointStateMsg.position.resize(1);
jointStateMsg.velocity.resize(1);
jointStateMsg.header.frame_id = "base_link";
jointStateMsg.header.stamp = msg.header.stamp;
jointStateMsg.name[0] = "joint1";
jointStateMsg.position[0] = msg.process_value;
jointStateMsg.velocity[0] = msg.process_value_dot;
pubJointState.publish(jointStateMsg);
}
From rostopic echo /joint_states
header:
seq: 1805
stamp:
secs: 231
nsecs: 908000000
frame_id: base_link
name: ['joint1']
position: [-1.2626024562217015]
velocity: [0.015212120726772037]
effort: []
---
header:
seq: 1806
stamp:
secs: 231
nsecs: 908000000
frame_id: base_link
name: ['joint2']
position: [0.632293076018593]
velocity: [0.018082079331372874]
effort: []