Skip to content

Commit

Permalink
Refactor triggered_camera demo (#645)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
caguero and ahcorde authored Dec 18, 2024
1 parent 5cc492c commit 6c0f01f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 65 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 @@ -56,7 +56,7 @@ Using the regular bridge:

To use a camera that only publishes information when triggered:

ros2 launch ros_gz_sim_demos triggered_camera.launch.py
ros2 launch ros_gz_sim_demos triggered_camera.launch.xml

Trigger the camera:

Expand Down
18 changes: 18 additions & 0 deletions ros_gz_sim_demos/config/triggered_camera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# triggered_cammera configuration.
- topic_name: "/camera"
ros_type_name: "sensor_msgs/msg/Image"
gz_type_name: "gz.msgs.Image"
lazy: true
direction: GZ_TO_ROS

- topic_name: "/camera_info"
ros_type_name: "sensor_msgs/msg/CameraInfo"
gz_type_name: "gz.msgs.CameraInfo"
lazy: true
direction: GZ_TO_ROS

- topic_name: "/camera/trigger"
ros_type_name: "std_msgs/msg/Bool"
gz_type_name: "gz.msgs.Boolean"
lazy: true
direction: ROS_TO_GZ
64 changes: 0 additions & 64 deletions ros_gz_sim_demos/launch/triggered_camera.launch.py

This file was deleted.

13 changes: 13 additions & 0 deletions ros_gz_sim_demos/launch/triggered_camera.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<launch>
<gz_server
world_sdf_file="triggered_camera_sensor.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/triggered_camera.yaml"
use_composition="True" />
<node pkg="rviz2" exec="rviz2" args="-d $(find-pkg-share ros_gz_sim_demos)/rviz/camera.rviz" />
<node pkg="tf2_ros" exec="static_transform_publisher" args="--frame-id camera_link --child-frame-id camera/link/camera --roll 1.570796327 --yaw 1.570796327" />
<executable cmd="gz sim -g" />
</launch>

0 comments on commit 6c0f01f

Please sign in to comment.