Skip to content

Commit

Permalink
Refactor rgbd_camera_bridge demo (#643)
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 5dc7ac2 commit 5cc492c
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 96 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 @@ -171,7 +171,7 @@ Using the image bridge (unidirectional, uses [image_transport](http://wiki.ros.o

Using the regular bridge:

ros2 launch ros_gz_sim_demos rgbd_camera_bridge.launch.py
ros2 launch ros_gz_sim_demos rgbd_camera_bridge.launch.xml

*TODO*: Blocked by `ros_gz_point_cloud` [issue](https://github.com/gazebosim/ros_gz/issues/40).

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

- ros_topic_name: "/camera/camera_info"
gz_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: "/rgbd_camera/image"
ros_type_name: "sensor_msgs/msg/Image"
gz_type_name: "gz.msgs.Image"
lazy: true
direction: GZ_TO_ROS

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

- topic_name: "/rgbd_camera/depth_image"
ros_type_name: "sensor_msgs/msg/Image"
gz_type_name: "gz.msgs.Image"
lazy: true
direction: GZ_TO_ROS

- topic_name: "/rgbd_camera/points"
ros_type_name: "sensor_msgs/msg/PointCloud2"
gz_type_name: "gz.msgs.PointCloudPacked"
lazy: true
direction: GZ_TO_ROS
76 changes: 0 additions & 76 deletions ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.py

This file was deleted.

13 changes: 13 additions & 0 deletions ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<launch>
<gz_server
world_sdf_file="sensors_demo.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/rgbd_camera_bridge.yaml"
use_composition="True" />
<node pkg="rviz2" exec="rviz2" args="-d $(find-pkg-share ros_gz_sim_demos)/rviz/rgbd_camera_bridge.rviz" />
<node pkg="tf2_ros" exec="static_transform_publisher" args="--frame-id rgbd_camera --child-frame-id rgbd_camera/link/rgbd_camera" />
<executable cmd="gz sim -g" />
</launch>
81 changes: 62 additions & 19 deletions ros_gz_sim_demos/rviz/rgbd_camera_bridge.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ Panels:
Property Tree Widget:
Expanded:
- /Global Options1
- /PointCloud21/Status1
Splitter Ratio: 0.3251533806324005
Tree Height: 701
Tree Height: 688
- Class: rviz_common/Selection
Name: Selection
- Class: rviz_common/Tool Properties
Expanded:
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
Expand Down Expand Up @@ -44,13 +42,16 @@ Visualization Manager:
Min Intensity: 0
Name: PointCloud2
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.05000000074505806
Style: Flat Squares
Topic: /rgbd_camera/points
Unreliable: false
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /rgbd_camera/points
Use Fixed Frame: true
Use rainbow: true
Value: true
Expand All @@ -61,9 +62,12 @@ Visualization Manager:
Min Value: 0
Name: Image
Normalize Range: false
Queue Size: 10
Topic: /rgbd_camera/depth_image
Unreliable: false
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /rgbd_camera/depth_image
Value: true
- Class: rviz_default_plugins/Image
Enabled: true
Expand All @@ -72,14 +76,35 @@ Visualization Manager:
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 10
Topic: /rgbd_camera/image
Unreliable: false
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /rgbd_camera/image
Value: true
- Alpha: 0.5
Cell Size: 1
Class: rviz_default_plugins/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: rgbd_camera/link/rgbd_camera
Fixed Frame: rgbd_camera
Frame Rate: 30
Name: root
Tools:
Expand All @@ -89,12 +114,30 @@ Visualization Manager:
- Class: rviz_default_plugins/Measure
Line color: 128; 128; 0
- Class: rviz_default_plugins/SetInitialPose
Topic: /initialpose
Covariance x: 0.25
Covariance y: 0.25
Covariance yaw: 0.06853891909122467
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /initialpose
- Class: rviz_default_plugins/SetGoal
Topic: /move_base_simple/goal
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /move_base_simple/goal
- Class: rviz_default_plugins/PublishPoint
Single click: true
Topic: /clicked_point
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /clicked_point
Transformation:
Current:
Class: rviz_default_plugins/TF
Expand Down Expand Up @@ -130,13 +173,13 @@ Window Geometry:
Hide Right Dock: false
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd000000040000000000000174000002f8fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000002ed00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002f8000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f8fc0200000005fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a0049006d006100670065010000003b000002020000002800fffffffb0000000a0049006d0061006700650100000243000000f00000002800fffffffb0000000a0056006900650077007300000000cf00000264000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000221000002f800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd000000040000000000000174000002f0fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005d00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000002ed00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003f000002f0000000cc00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f0fc0200000005fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a0049006d006100670065010000003f000001fd0000001700fffffffb0000000a0049006d0061006700650100000242000000ed0000001700fffffffb0000000a0056006900650077007300000000cf00000264000000a900fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000221000002f000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 1200
X: 375
Y: 1116
X: 1312
Y: 378

0 comments on commit 5cc492c

Please sign in to comment.