Skip to content

Commit

Permalink
Refactor magnetometer demo (#638)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored Dec 13, 2024
1 parent 52ee43e commit e1f578a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 64 deletions.
2 changes: 1 addition & 1 deletion ros_gz_sim_demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Publishes IMU readings.

Publishes magnetic field readings.

ros2 launch ros_gz_sim_demos magnetometer.launch.py
ros2 launch ros_gz_sim_demos magnetometer.launch.xml

![](images/magnetometer_demo.png)

Expand Down
6 changes: 6 additions & 0 deletions ros_gz_sim_demos/config/magnetometer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Magnetometer configuration.
- topic_name: "/magnetometer"
ros_type_name: "sensor_msgs/msg/MagneticField"
gz_type_name: "gz.msgs.Magnetometer"
lazy: true
direction: GZ_TO_ROS
63 changes: 0 additions & 63 deletions ros_gz_sim_demos/launch/magnetometer.launch.py

This file was deleted.

12 changes: 12 additions & 0 deletions ros_gz_sim_demos/launch/magnetometer.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<launch>
<gz_server
world_sdf_file="sensors.sdf"
use_composition="True"
create_own_container="True" />
<ros_gz_bridge
bridge_name="ros_gz_bridge"
config_file="$(find-pkg-share ros_gz_sim_demos)/config/magnetometer.yaml"
use_composition="True" />
<node pkg="rqt_topic" exec="rqt_topic" args="-t" />
<executable cmd="gz sim -g" />
</launch>

0 comments on commit e1f578a

Please sign in to comment.