imu
Bridge IMU sensor from gazebo to ros
Gazebo
Add imu plugin to world
add imu plugin to world |
---|
| <plugin
filename="gz-sim-imu-system"
name="gz::sim::systems::Imu">
</plugin>
|
sensor |
---|
| <sensor name="imu" type="imu">
<always_on>1</always_on>
<update_rate>50</update_rate>
<visualize>true</visualize>
<topic>imu</topic>
<enable_metrics>true</enable_metrics>
</sensor>
|
urdf
Don't forget to shroud with <gazebo reference="link name">
tag
ROS
cli
| ros2 run ros_gz_bridge parameter_bridge /imu@sensor_msgs/msg/Imu[gz.msgs.IMU
#
Creating GZ->ROS Bridge: [/imu (gz.msgs.IMU) -> /imu (sensor_msgs/msg/Imu)] (Lazy 0)
|
bridge file
| - ros_topic_name: "/imu"
gz_topic_name: "/imu"
ros_type_name: "sensor_msgs/msg/Imu"
gz_type_name: "gz.msgs.IMU"
direction: GZ_TO_ROS
|
launch
TODO: check this coda again
imu_bridge.launch.py |
---|
| from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from pathlib import Path
PKG_BRINGUP = 'turtlebot_bringup'
BRIDGE_CONFIG = "gz_bridge.yaml"
CONFIG_FOLDER = "config"
def generate_launch_description():
ld = LaunchDescription()
bridge_file = Path(get_package_share_directory(PKG_BRINGUP)) \
.joinpath(CONFIG_FOLDER) \
.joinpath(BRIDGE_CONFIG) \
.as_posix()
ros_gz_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
arguments=[
'--ros-args',
'-p',
f"config_file:={bridge_file}"
],
parameters=[
{'use_sim_time': True},
{'qos_overrides./imu.publisher.reliability': 'best_effort'}
],
)
ld.add_action(ros_gz_bridge)
return ld
|