So I've managed to implement the hardware interface/abstraction for the imu that is connected to an Arduino mega. Now I have to implement a controller and the one I'd like to use (its the only for imu) is the IMU Sensor Broadcaster but I have no idea how to set it up in the controller yaml. The documentation is very sparse on this so I'm lost.

This is what my urdf for ros2 control looks like, the bottom part is for the imu sensor

        <ros2_control name="RealRobot" type="system">
            omitted for clarity
        <joint name="left_wheel_joint">
            omitted for clarity
        <joint name="right_wheel_joint">
            omitted for clarity
        <sensor name="imu_sensor">
            <state_interface name="orientation.x"/>
            <state_interface name="orientation.y"/>
            <state_interface name="orientation.z"/>
            <state_interface name="angular_velocity.x"/>
            <state_interface name="angular_velocity.y"/>
            <state_interface name="angular_velocity.z"/>
            <state_interface name="linear_acceleration.x"/>
            <state_interface name="linear_acceleration.y"/>
            <state_interface name="linear_acceleration.z"/>
            <param name="frame_id">imu_link</param>

And this is what the controller yaml looks like

     update_rate: 30
     # use_sim_time: true

       type: diff_drive_controller/DiffDriveController

       type: joint_state_broadcaster/JointStateBroadcaster

       type: imu_sensor_broadcaster/ImuSensorBroadcaster


      interface_names.orientation.x: imu_sensor/orientation.x
      interface_names.orientation.y: imu_sensor/orientation.y
      interface_names.orientation.z: imu_sensor/orientation.z

      interface_names.angular_velocity.x: imu_sensor/angular_velocity.x
      interface_names.angular_velocity.y: imu_sensor/angular_velocity.y
      interface_names.angular_velocity.z: imu_sensor/angular_velocity.z

      interface_names.linear_acceleration.x: imu_sensor/linear_acceleration.x
      interface_names.linear_acceleration.y: imu_sensor/linear_acceleration.y
      interface_names.linear_acceleration.z: imu_sensor/linear_acceleration.z

      frame_id: imu_link

I think I might've put the interface name wrong but I'm not sure. The other controllers I've configured start up just fine, only the IMU sensor doesn't. Any help is greatly appreciated.


1 Answer 1


you only have to define the name of your imu sensor to be able to configure it. You can find what parameters are needed by the imu_sensor_broadcaster here : https://github.com/ros-controls/ros2_controllers/blob/master/imu_sensor_broadcaster/src/imu_sensor_broadcaster_parameters.yaml. Ideally, by specifying sensor_name and the frame_id should be good


    sensor_name: "imu_sensor"
    frame_id:  "imu_sensor_frame"

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.