0
$\begingroup$

I am using ros2_control framework to control the motor wheel of my robot and to publish odometry data. However, I have encountered an unusual issue where the odometry data is being published at only half the specified frequency as set in the publish_rate parameter in the ros2_control configuration file. For instance, when I set the publish_rate to 50, upon checking the odometery data, it is only being published at 25. Similarly, when I set the publish_rate to 80, I am observing a publication rate of only 40. Could you please review the attached configuration file to investigate this matter?

  ros__parameters:
    update_rate: 100 # Hz

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

    diffbot_base_controller:
      type: diff_drive_controller/DiffDriveController

diffbot_base_controller:
  ros__parameters:
    left_wheel_names: ["left_wheel_joint"]
    right_wheel_names: ["right_wheel_joint"]

    wheel_separation: 0.4582
    #wheels_per_side: 1  # actually 2, but both are controlled by 1 signal
    wheel_radius: 0.081

    wheel_separation_multiplier: 1.0
    left_wheel_radius_multiplier: 1.0
    right_wheel_radius_multiplier: 1.0

    publish_rate: 80.0
    odom_frame_id: odom
    base_frame_id: base_link
    pose_covariance_diagonal : [0.001, 0.001, 0.001, 0.001, 0.001, 0.01] #[0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
    twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.01] #[0.001, 0.001, 0.001, 0.001, 0.001, 0.01]

    open_loop: false #true
    enable_odom_tf: true #true

    cmd_vel_timeout: 0.5
    #publish_limited_velocity: true
    use_stamped_vel: false
    #velocity_rolling_window_size: 10

    # Velocity and acceleration limits
    # Whenever a min_* is unspecified, default to -max_*
    linear.x.has_velocity_limits: true
    linear.x.has_acceleration_limits: true
    linear.x.has_jerk_limits: false
    linear.x.max_velocity: 1.0
    linear.x.min_velocity: -1.0
    linear.x.max_acceleration: 1.0
    linear.x.max_jerk: 0.0
    linear.x.min_jerk: 0.0

    angular.z.has_velocity_limits: true
    angular.z.has_acceleration_limits: true
    angular.z.has_jerk_limits: false
    angular.z.max_velocity: 1.0
    angular.z.min_velocity: -1.0
    angular.z.max_acceleration: 1.0
    angular.z.min_acceleration: -1.0
    angular.z.max_jerk: 0.0
    angular.z.min_jerk: 0.0 ```
$\endgroup$
4
  • $\begingroup$ Can you please provide some more information, e.g. ROS 2 version and if you are using simulation (which one) or real robot (which hardware interface, are you using ros2_control_node?) $\endgroup$ Sep 13, 2023 at 11:59
  • $\begingroup$ Thank you for your response. I am using the ROS 2 'Humble' version with a physical robot, and yes, I am utilizing the 'ros2_control_node'. $\endgroup$ Sep 14, 2023 at 9:19
  • 1
    $\begingroup$ do you use a public ros2_control hardware component for your robot, or have you written a custom one? At which rate does the joint_state_publisher publish /joint_state topic? $\endgroup$ Sep 14, 2023 at 9:25
  • $\begingroup$ Yes, I am utilizing the public hardware interface. However, I have created my own custom functions which are used inside the 'read', 'write', and 'on_init' functions of the ROS 2 control hardware interface class. Additionally, the frequency of the '/joint_state' topic is 100 Hz. $\endgroup$ Sep 14, 2023 at 9:35

1 Answer 1

0
$\begingroup$

This bug was fixed with rolling already, see this PR. I requested a backport to humble now, but this can take a while to get synced and released. In the meantime, you can use this branch and compile it from source.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.