ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi.

First, I have to say that the nav2 slam works fine on the first run (95% of times), when the robot is just booted. When I stop the nav2 after brining it up using the launch file using ctrl-C and run it again (after waiting some time until nodes disappear from the list "ros2 node list", I encounter these random problems that I described above.

Here is the result of echoing the transforms:

$ ros2 run tf2_ros tf2_echo odom scan_link
[INFO] [1687963541.009601577] [tf2_echo]: Waiting for transform odom ->  scan_link: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
At time 1687963541.596396082
- Translation: [-0.020, 0.000, 1.239]
- Rotation: in Quaternion [0.004, 0.000, 1.000, -0.005]
At time 1687963542.595545666
- Translation: [-0.020, 0.000, 1.239]
- Rotation: in Quaternion [0.004, 0.000, 1.000, -0.005]
At time 1687963543.597899375
- Translation: [-0.020, 0.000, 1.239]
- Rotation: in Quaternion [0.004, 0.000, 1.000, -0.005]

Another transform:

$ ros2 run tf2_ros tf2_echo odom base_footprint 2.0
[INFO] [1687968194.440594135] [tf2_echo]: Waiting for transform odom ->  base_footprint: Invalid frame ID "odom" passed to canTransform argument target_frame - fram
e does not exist
At time 1687968194.881034063
- Translation: [-0.023, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
At time 1687968195.385934743
- Translation: [-0.023, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
At time 1687968195.881188582
- Translation: [-0.023, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
At time 1687968196.380709922
- Translation: [-0.023, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]

Note that the above command publishes at the rate of 1 by default. Here is the actual rate with which the tf is published:

$ ros2 topic hz /tf
average rate: 56.453
        min: 0.003s max: 0.029s std dev: 0.00917s window: 58
average rate: 56.138
        min: 0.001s max: 0.029s std dev: 0.00901s window: 114
average rate: 56.053
        min: 0.001s max: 0.029s std dev: 0.00904s window: 171
average rate: 55.940
        min: 0.001s max: 0.029s std dev: 0.00903s window: 228
average rate: 55.870
        min: 0.001s max: 0.029s std dev: 0.00904s window: 285
average rate: 55.826
        min: 0.001s max: 0.029s std dev: 0.00902s window: 342
average rate: 55.825
        min: 0.001s max: 0.031s std dev: 0.00907s window: 398

And the scan:

$ ros2 topic hz /scan
average rate: 12.826
        min: 0.072s max: 0.081s std dev: 0.00351s window: 14
average rate: 12.830
        min: 0.072s max: 0.081s std dev: 0.00337s window: 27
average rate: 12.833
        min: 0.072s max: 0.082s std dev: 0.00324s window: 40
average rate: 12.849
        min: 0.072s max: 0.082s std dev: 0.00318s window: 53
average rate: 12.844
        min: 0.072s max: 0.082s std dev: 0.00304s window: 66

Also, as can be seen in my nav2 config file, all "transform_tolerance:" values are set to 1.0. I think that is the time duration of 1.0 second, which is way larger than the publishing period of the transforms. {Am I right here?]

transform_tolerance: 1.0

I would like to mention that the tf tree graph from rqt_tf_tree shows all frames are connected.

Anything else I can try? If all fails, I will have to restart the robot's computer every time I am testing nav2 for fine tuning.

Thanks so much!