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">
<hardware>
omitted for clarity
</hardware>
<joint name="left_wheel_joint">
omitted for clarity
</joint>
<joint name="right_wheel_joint">
omitted for clarity
</joint>
<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>
</sensor>
</ros2_control>
And this is what the controller yaml looks like
controller_manager:
ros__parameters:
update_rate: 30
# use_sim_time: true
diff_cont:
type: diff_drive_controller/DiffDriveController
joint_broad:
type: joint_state_broadcaster/JointStateBroadcaster
imu_sensor:
type: imu_sensor_broadcaster/ImuSensorBroadcaster
imu_sensor:
ros__parameters:
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.