Diff drive controller publishing TFs and odometry with NANs
In my launch file that I use to bring up my robot, I launch a robot_state_publisher
and a diff_drive_controller
. I have also configured my urdf such that I would expect the following TFs (from parent to child frame) in this order: odom
-> base_footprint
-> base_link
When I bring up my robot and run rosrun tf tf_echo base_footprint base_link
I get the following error printed in the console:
At time 0.000
- Translation: [0.000, 0.000, 0.025]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
in RPY (radian) [0.000, -0.000, 0.000]
in RPY (degree) [0.000, -0.000, 0.000]
Error: TF_NAN_INPUT: Ignoring transform for child_frame_id "base_footprint" from authority "unknown_publisher" because of a nan value in the transform (nan -nan 0.000000) (nan nan nan nan)
rostopic echo /odom
reveals the following, that there are multiple nan's in the odom message (while the robot is not moving and no cmd_vels are being published)
header:
seq: 455
stamp:
secs: 1584298695
nsecs: 56166660
frame_id: "odom"
child_frame_id: "base_footprint"
pose:
pose:
position:
x: nan
y: nan
z: 0.0
orientation:
x: nan
y: nan
z: nan
w: nan
covariance: [0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000.0]
twist:
twist:
linear:
x: nan
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: nan
covariance: [0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1000.0]
---
I've confirmed that it is definitely the diff_drive_controller
that is causing the NAN problem by removing it from my launch file and using rosrun tf tf_echo base_footprint base_link
to check if the error was still present, and it was not.
Furthermore, if I run the navigation stack both of these errors go away. However, they persist if I try to SLAM using gmapping. Has anyone else had this issue before? How can I fix diff_drive_controller
to not publish NANs?
Here is a link to my repository, all of the relevant code is the the hw_interface
(diff_drive_controller) and launch
directories.