Skip to content

DiffDriveController is not publishing odom due to the wrong timestamp #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xibeisiber opened this issue Feb 25, 2023 · 4 comments
Closed
Labels

Comments

@xibeisiber
Copy link

xibeisiber commented Feb 25, 2023

Hi,

I'm trying to simulate the movement my robot in Ignition Gazebo 6, and configured the DiffDriveController following ros2_control_demos.

After the nodes are launched, I found the odom is not always published (Sometimes published, but most time not).
I checked the diff_drive_controller.cpp and added some printout, find that previous_publish_timestamp_ = get_node()->get_clock()->now(); sometimes can't get the sim time, but rather get the timestamp in Rviz (1.67733e+09).

In the update() function, the odom will be published only if previous_publish_timestamp_ + publish_period_ < time where "time" is passed in as sim time.

I set use_sim_time to be true in the launch file using

    robot_state_publisher_node = Node(
        package="robot_state_publisher",
        executable="robot_state_publisher",
        output="both",
        parameters=[{"use_sim_time": True}, robot_description],
    )

The console output did have "Setting use_sim_time=True for diff_drive_base_controller":

[ruby $(which ign) gazebo-3] [INFO] [controller_manager]: Setting use_sim_time=True for diff_drive_base_controller to match controller manager (see ros2_control#325 for details)]
[ruby $(which ign) gazebo-3] [INFO] [controller_manager]: Loading controller 'arm_forward_position_controller']
[spawner-6] [INFO] [spawner_diff_drive_base_controller]: Loaded diff_drive_base_controller]
[ruby $(which ign) gazebo-3] [INFO] [controller_manager]: Setting use_sim_time=True for arm_forward_position_controller to match controller manager (see ros2_control#325 for details)]
[ruby $(which ign) gazebo-3] [INFO] [controller_manager]: Configuring controller 'ext_forward_position_controller']
[spawner-8] [INFO] [spawner_arm_forward_position_controller]: Loaded arm_forward_position_controller]
[ruby $(which ign) gazebo-3] [INFO] [ext_forward_position_controller]: configure successful]
[ruby $(which ign) gazebo-3] [INFO] [controller_manager]: Configuring controller 'diff_drive_base_controller']
[ruby $(which ign) gazebo-3] [INFO] [diff_drive_base_controller]: Parameters were updated]
[ruby $(which ign) gazebo-3] previous_publish_timestamp_=1.67733e+09

The strange thing is that this not always happens, sometimes it did get the sim time and publish odom.

Environment: ubuntu 22.04, ros2 humble, Ignition Gazebo 6.11.0

Thanks for any help!
Jia

@cangozpi
Copy link

I have the same issue and behaviour as you do.

@bmagyar
Copy link
Member

bmagyar commented Jul 20, 2023

Could you please verify if the issue persists on humble?

Copy link
Contributor

This issue is being labeled as stale because it has been open 45 days with no activity. It will be automatically closed after another 45 days without follow-ups.

@github-actions github-actions bot added the stale label Apr 11, 2025
Copy link
Contributor

This issue was closed because it has been stalled for 45 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants