From b7021077098c590272f745daeaccd6dfe346cc67 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 18 Dec 2024 00:35:20 +0100 Subject: [PATCH 1/6] Update README.md to include Ionic (#677) Signed-off-by: Addisu Z. Taddese --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 44712ff9..cbb17998 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ Iron | Garden | [humble](https://github.com/gazebosim/ros_gz/tree/iron) | only f Iron | Harmonic | [humble](https://github.com/gazebosim/ros_gz/tree/iron) | only from source Jazzy | Garden | [ros2](https://github.com/gazebosim/ros_gz/tree/ros2) | only from source [^2] Jazzy | Harmonic | [jazzy](https://github.com/gazebosim/ros_gz/tree/jazzy) | https://packages.ros.org -Rolling | Fortress | [humble](https://github.com/gazebosim/ros_gz/tree/humble) | https://packages.ros.org Rolling | Garden | [ros2](https://github.com/gazebosim/ros_gz/tree/ros2) | only from source [^2] Rolling | Harmonic | [ros2](https://github.com/gazebosim/ros_gz/tree/ros2) | only from source +Rolling | Ionic | [ros2](https://github.com/gazebosim/ros_gz/tree/ros2) | https://packages.ros.org [^1]: Binaries for these pairings are provided from the packages.osrfoundation.org repository. Refer to https://gazebosim.org/docs/latest/ros_installation for installation instructions. [^2]: Note that the Gazebo version on this row has reached end-of-life. From 7b11ef8b64eb4198f2fab60880830499653579d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 18 Dec 2024 12:56:45 +0100 Subject: [PATCH 2/6] Refactor camera demo (#634) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero Co-authored-by: Alejandro Hernández Cordero --- ros_gz_sim_demos/README.md | 2 +- ros_gz_sim_demos/config/camera.yaml | 12 +++ ros_gz_sim_demos/launch/camera.launch.py | 63 ---------------- ros_gz_sim_demos/launch/camera.launch.xml | 13 ++++ ros_gz_sim_demos/rviz/camera.rviz | 90 +++++++++++++++++------ 5 files changed, 92 insertions(+), 88 deletions(-) create mode 100644 ros_gz_sim_demos/config/camera.yaml delete mode 100644 ros_gz_sim_demos/launch/camera.launch.py create mode 100644 ros_gz_sim_demos/launch/camera.launch.xml diff --git a/ros_gz_sim_demos/README.md b/ros_gz_sim_demos/README.md index e3b64601..2774a009 100644 --- a/ros_gz_sim_demos/README.md +++ b/ros_gz_sim_demos/README.md @@ -52,7 +52,7 @@ Using the image bridge (unidirectional, uses [image_transport](http://wiki.ros.o Using the regular bridge: - ros2 launch ros_gz_sim_demos camera.launch.py + ros2 launch ros_gz_sim_demos camera.launch.xml To use a camera that only publishes information when triggered: diff --git a/ros_gz_sim_demos/config/camera.yaml b/ros_gz_sim_demos/config/camera.yaml new file mode 100644 index 00000000..17fa88f9 --- /dev/null +++ b/ros_gz_sim_demos/config/camera.yaml @@ -0,0 +1,12 @@ +# Camera bridge 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 diff --git a/ros_gz_sim_demos/launch/camera.launch.py b/ros_gz_sim_demos/launch/camera.launch.py deleted file mode 100644 index aaa5fc49..00000000 --- a/ros_gz_sim_demos/launch/camera.launch.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2019 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.actions import IncludeLaunchDescription -from launch.conditions import IfCondition -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration - -from launch_ros.actions import Node - - -def generate_launch_description(): - - pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') - pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') - - gz_sim = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': '-r camera_sensor.sdf'}.items(), - ) - - # RViz - rviz = Node( - package='rviz2', - executable='rviz2', - arguments=['-d', os.path.join(pkg_ros_gz_sim_demos, 'rviz', 'camera.rviz')], - condition=IfCondition(LaunchConfiguration('rviz')) - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/camera@sensor_msgs/msg/Image@gz.msgs.Image', - '/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo'], - output='screen' - ) - - return LaunchDescription([ - DeclareLaunchArgument('rviz', default_value='true', - description='Open RViz.'), - gz_sim, - bridge, - rviz - ]) diff --git a/ros_gz_sim_demos/launch/camera.launch.xml b/ros_gz_sim_demos/launch/camera.launch.xml new file mode 100644 index 00000000..a608ac93 --- /dev/null +++ b/ros_gz_sim_demos/launch/camera.launch.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/ros_gz_sim_demos/rviz/camera.rviz b/ros_gz_sim_demos/rviz/camera.rviz index 81398197..10cb0a27 100644 --- a/ros_gz_sim_demos/rviz/camera.rviz +++ b/ros_gz_sim_demos/rviz/camera.rviz @@ -6,15 +6,13 @@ Panels: Expanded: - /Global Options1 - /Camera1 - - /Camera1/Status1 - /Image1 Splitter Ratio: 0.5 - Tree Height: 557 + Tree Height: 577 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties Expanded: - - /2D Nav Goal1 - /Publish Point1 Name: Tool Properties Splitter Ratio: 0.5886790156364441 @@ -46,14 +44,19 @@ Visualization Manager: Value: true - Class: rviz_default_plugins/Camera Enabled: true + Far Plane Distance: 100 Image Rendering: background and overlay Name: Camera Overlay Alpha: 0.5 - Queue Size: 10 - Topic: /camera - Unreliable: false + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /camera Value: true Visibility: + CameraInfo: true Grid: true Image: true Value: true @@ -65,14 +68,35 @@ Visualization Manager: Min Value: 0 Name: Image Normalize Range: true - Queue Size: 10 - Topic: /camera - Unreliable: false + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /camera + Value: true + - Alpha: 0.5 + Class: rviz_default_plugins/CameraInfo + Color: 85; 255; 255 + Edge color: 125; 125; 125 + Enabled: true + Far clip: 1 + Name: CameraInfo + Not show side polygons: true + Show edges: true + Show polygons: true + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /camera_info Value: true Enabled: true Global Options: Background Color: 48; 48; 48 - Fixed Frame: camera/link/camera + Fixed Frame: camera_link Frame Rate: 30 Name: root Tools: @@ -82,12 +106,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 @@ -95,43 +137,43 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 19.73822784423828 + Distance: 5.7260661125183105 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false Focal Point: - X: 0 - Y: 0 - Z: 0 + X: -0.0462728813290596 + Y: 0.5716152787208557 + Z: -0.3677769899368286 Focal Shape Fixed Size: true Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 0.7903980016708374 + Pitch: 0.2603982985019684 Target Frame: Value: Orbit (rviz) - Yaw: 0.785398006439209 + Yaw: 1.5503973960876465 Saved: ~ Window Geometry: Camera: collapsed: false Displays: collapsed: false - Height: 702 + Height: 735 Hide Left Dock: false Hide Right Dock: false Image: collapsed: false - QMainWindow State: 000000ff00000000fd00000004000000000000015600000268fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b00000268000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c0000026100000001000001c700000268fc0200000005fb0000000c00430061006d006500720061010000003b0000011f0000002800fffffffb0000000a0049006d0061006700650100000160000001430000002800fffffffb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b000002f8000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000000320000026800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd00000004000000000000015600000281fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005d00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003f00000281000000cc00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000017e00000281fc0200000005fb0000000c00430061006d006500720061010000003f0000012a0000001700fffffffb0000000a0049006d006100670065010000016f000001510000001700fffffffb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b000002f8000000a900fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000001cc0000028100000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Tool Properties: collapsed: false Views: collapsed: false - Width: 859 - X: 517 - Y: 361 + Width: 1196 + X: 2707 + Y: 234 From f06eb0c0d2631a0a5319c28c644bbb325d44a7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 18 Dec 2024 17:42:00 +0100 Subject: [PATCH 3/6] Refactor gpu_lidar_bridge demo (#636) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactor gpu_lidar_bridge demo Signed-off-by: Carlos Agüero --- ros_gz_sim_demos/README.md | 2 +- ros_gz_sim_demos/config/gpu_lidar.yaml | 12 +++ .../launch/gpu_lidar_bridge.launch.py | 65 ---------------- .../launch/gpu_lidar_bridge.launch.xml | 13 ++++ ros_gz_sim_demos/rviz/gpu_lidar_bridge.rviz | 74 ++++++++++++------- 5 files changed, 74 insertions(+), 92 deletions(-) create mode 100644 ros_gz_sim_demos/config/gpu_lidar.yaml delete mode 100644 ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.py create mode 100644 ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.xml diff --git a/ros_gz_sim_demos/README.md b/ros_gz_sim_demos/README.md index 2774a009..dc00d300 100644 --- a/ros_gz_sim_demos/README.md +++ b/ros_gz_sim_demos/README.md @@ -114,7 +114,7 @@ GPU lidar data can be obtained as: Using the bridge: - ros2 launch ros_gz_sim_demos gpu_lidar_bridge.launch.py + ros2 launch ros_gz_sim_demos gpu_lidar_bridge.launch.xml *TODO*: Blocked by `ros_gz_point_cloud` [issue](https://github.com/gazebosim/ros_gz/issues/40). diff --git a/ros_gz_sim_demos/config/gpu_lidar.yaml b/ros_gz_sim_demos/config/gpu_lidar.yaml new file mode 100644 index 00000000..3a549383 --- /dev/null +++ b/ros_gz_sim_demos/config/gpu_lidar.yaml @@ -0,0 +1,12 @@ +# GPU lidar configuration. +- topic_name: "/lidar" + ros_type_name: "sensor_msgs/msg/LaserScan" + gz_type_name: "gz.msgs.LaserScan" + lazy: true + direction: GZ_TO_ROS + +- topic_name: "/lidar/points" + ros_type_name: "sensor_msgs/msg/PointCloud2" + gz_type_name: "gz.msgs.PointCloudPacked" + lazy: true + direction: GZ_TO_ROS diff --git a/ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.py b/ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.py deleted file mode 100644 index 42998efa..00000000 --- a/ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2019 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.actions import IncludeLaunchDescription -from launch.conditions import IfCondition -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration - -from launch_ros.actions import Node - - -def generate_launch_description(): - - pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') - pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') - - gz_sim = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')), - launch_arguments={ - 'gz_args': '-r gpu_lidar_sensor.sdf' - }.items(), - ) - - # RViz - rviz = Node( - package='rviz2', - executable='rviz2', - arguments=['-d', os.path.join(pkg_ros_gz_sim_demos, 'rviz', 'gpu_lidar_bridge.rviz')], - condition=IfCondition(LaunchConfiguration('rviz')) - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['lidar@sensor_msgs/msg/LaserScan@gz.msgs.LaserScan', - '/lidar/points@sensor_msgs/msg/PointCloud2@gz.msgs.PointCloudPacked'], - output='screen' - ) - - return LaunchDescription([ - gz_sim, - DeclareLaunchArgument('rviz', default_value='true', - description='Open RViz.'), - bridge, - rviz, - ]) diff --git a/ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.xml b/ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.xml new file mode 100644 index 00000000..c56f551a --- /dev/null +++ b/ros_gz_sim_demos/launch/gpu_lidar_bridge.launch.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/ros_gz_sim_demos/rviz/gpu_lidar_bridge.rviz b/ros_gz_sim_demos/rviz/gpu_lidar_bridge.rviz index 318229b3..a45ccf6b 100644 --- a/ros_gz_sim_demos/rviz/gpu_lidar_bridge.rviz +++ b/ros_gz_sim_demos/rviz/gpu_lidar_bridge.rviz @@ -5,15 +5,12 @@ Panels: Property Tree Widget: Expanded: - /Global Options1 - - /LaserScan1/Status1 - - /PointCloud21/Status1 Splitter Ratio: 0.504601240158081 - 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 @@ -63,13 +60,17 @@ Visualization Manager: Min Intensity: 0 Name: LaserScan Position Transformer: XYZ - Queue Size: 10 Selectable: true Size (Pixels): 3 Size (m): 0.009999999776482582 Style: Flat Squares - Topic: /lidar - Unreliable: false + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /lidar Use Fixed Frame: true Use rainbow: true Value: true @@ -83,30 +84,33 @@ Visualization Manager: Channel Name: intensity Class: rviz_default_plugins/PointCloud2 Color: 255; 255; 255 - Color Transformer: "" + Color Transformer: Intensity Decay Time: 0 Enabled: true Invert Rainbow: false Max Color: 255; 255; 255 - Max Intensity: 4096 + Max Intensity: 0 Min Color: 0; 0; 0 Min Intensity: 0 Name: PointCloud2 - Position Transformer: "" - Queue Size: 10 + Position Transformer: XYZ Selectable: true Size (Pixels): 3 Size (m): 0.009999999776482582 Style: Flat Squares - Topic: /lidar/points - Unreliable: false + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /lidar/points Use Fixed Frame: true Use rainbow: true Value: true Enabled: true Global Options: Background Color: 48; 48; 48 - Fixed Frame: model_with_lidar/link/gpu_lidar + Fixed Frame: map Frame Rate: 30 Name: root Tools: @@ -116,12 +120,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 @@ -129,25 +151,25 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 15.735194206237793 + Distance: 15.508606910705566 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false Focal Point: - X: 2.550645589828491 - Y: -0.290515273809433 - Z: -1.1467934846878052 + X: 3.5016579627990723 + Y: -0.3921697437763214 + Z: -0.31346774101257324 Focal Shape Fixed Size: true Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 0.7253980040550232 + Pitch: 0.7553980350494385 Target Frame: Value: Orbit (rviz) - Yaw: 3.7385823726654053 + Yaw: 3.6435835361480713 Saved: ~ Window Geometry: Displays: @@ -155,7 +177,7 @@ Window Geometry: Height: 846 Hide Left Dock: false Hide Right Dock: true - QMainWindow State: 000000ff00000000fd0000000400000000000001ef000002f8fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000002ed00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002f8000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f8fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b000002f8000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000002bb000002f800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd0000000400000000000001ef000002f0fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005d00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000002ed00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003f000002f0000000cc00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f8fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b000002f8000000a900fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000002bb000002f000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Tool Properties: @@ -163,5 +185,5 @@ Window Geometry: Views: collapsed: true Width: 1200 - X: 338 - Y: 1176 + X: 1286 + Y: 353 From 5dc7ac2e39bb4c5fdf8c074f66c5b1ca4dfd2762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 18 Dec 2024 21:12:43 +0100 Subject: [PATCH 4/6] Refactor diff_drive demo (#635) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero Signed-off-by: Alejandro Hernández Cordero Co-authored-by: Alejandro Hernández Cordero --- ros_gz_sim_demos/README.md | 4 +- ros_gz_sim_demos/config/diff_drive.yaml | 36 ++++++ ros_gz_sim_demos/launch/diff_drive.launch.py | 69 ----------- ros_gz_sim_demos/launch/diff_drive.launch.xml | 17 +++ ros_gz_sim_demos/package.xml | 1 + ros_gz_sim_demos/rviz/diff_drive.rviz | 111 +++++++++++++++--- 6 files changed, 151 insertions(+), 87 deletions(-) create mode 100644 ros_gz_sim_demos/config/diff_drive.yaml delete mode 100644 ros_gz_sim_demos/launch/diff_drive.launch.py create mode 100644 ros_gz_sim_demos/launch/diff_drive.launch.xml diff --git a/ros_gz_sim_demos/README.md b/ros_gz_sim_demos/README.md index dc00d300..354ba263 100644 --- a/ros_gz_sim_demos/README.md +++ b/ros_gz_sim_demos/README.md @@ -68,9 +68,9 @@ Trigger the camera: Send commands to a differential drive vehicle and listen to its odometry. - ros2 launch ros_gz_sim_demos diff_drive.launch.py + ros2 launch ros_gz_sim_demos diff_drive.launch.xml -Then unpause and send a command +Then send a command ros2 topic pub /model/vehicle_blue/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 5.0}, angular: {z: 0.5}}" diff --git a/ros_gz_sim_demos/config/diff_drive.yaml b/ros_gz_sim_demos/config/diff_drive.yaml new file mode 100644 index 00000000..96d656c2 --- /dev/null +++ b/ros_gz_sim_demos/config/diff_drive.yaml @@ -0,0 +1,36 @@ +# Diff drive configuration. +- topic_name: "/model/vehicle_blue/cmd_vel" + ros_type_name: "geometry_msgs/msg/Twist" + gz_type_name: "gz.msgs.Twist" + lazy: true + direction: ROS_TO_GZ + +- topic_name: "/model/vehicle_blue/odometry" + ros_type_name: "nav_msgs/msg/Odometry" + gz_type_name: "gz.msgs.Odometry" + lazy: true + direction: GZ_TO_ROS + +- topic_name: "/model/vehicle_green/cmd_vel" + ros_type_name: "geometry_msgs/msg/Twist" + gz_type_name: "gz.msgs.Twist" + lazy: true + direction: ROS_TO_GZ + +- topic_name: "/model/vehicle_green/odometry" + ros_type_name: "nav_msgs/msg/Odometry" + gz_type_name: "gz.msgs.Odometry" + lazy: true + direction: GZ_TO_ROS + +- ros_topic_name: "/tf" + gz_topic_name: "/model/vehicle_green/tf" + ros_type_name: "tf2_msgs/msg/TFMessage" + gz_type_name: "gz.msgs.Pose_V" + direction: GZ_TO_ROS + +- ros_topic_name: "/tf" + gz_topic_name: "/model/vehicle_blue/tf" + ros_type_name: "tf2_msgs/msg/TFMessage" + gz_type_name: "gz.msgs.Pose_V" + direction: GZ_TO_ROS diff --git a/ros_gz_sim_demos/launch/diff_drive.launch.py b/ros_gz_sim_demos/launch/diff_drive.launch.py deleted file mode 100644 index 2d656d1e..00000000 --- a/ros_gz_sim_demos/launch/diff_drive.launch.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2019 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.actions import IncludeLaunchDescription -from launch.conditions import IfCondition -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration - -from launch_ros.actions import Node - - -def generate_launch_description(): - - pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') - pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') - - gz_sim = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')), - launch_arguments={ - 'gz_args': '-r diff_drive.sdf' - }.items(), - ) - - # RViz - rviz = Node( - package='rviz2', - executable='rviz2', - arguments=['-d', os.path.join(pkg_ros_gz_sim_demos, 'rviz', 'diff_drive.rviz')], - condition=IfCondition(LaunchConfiguration('rviz')) - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/model/vehicle_blue/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist', - '/model/vehicle_blue/odometry@nav_msgs/msg/Odometry@gz.msgs.Odometry', - '/model/vehicle_green/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist', - '/model/vehicle_green/odometry@nav_msgs/msg/Odometry@gz.msgs.Odometry'], - parameters=[{'qos_overrides./model/vehicle_blue.subscriber.reliability': 'reliable', - 'qos_overrides./model/vehicle_green.subscriber.reliability': 'reliable'}], - output='screen' - ) - - return LaunchDescription([ - gz_sim, - DeclareLaunchArgument('rviz', default_value='true', - description='Open RViz.'), - bridge, - rviz - ]) diff --git a/ros_gz_sim_demos/launch/diff_drive.launch.xml b/ros_gz_sim_demos/launch/diff_drive.launch.xml new file mode 100644 index 00000000..c09bab7f --- /dev/null +++ b/ros_gz_sim_demos/launch/diff_drive.launch.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/ros_gz_sim_demos/package.xml b/ros_gz_sim_demos/package.xml index 414af4fe..433f3f23 100644 --- a/ros_gz_sim_demos/package.xml +++ b/ros_gz_sim_demos/package.xml @@ -25,6 +25,7 @@ rviz_imu_plugin rviz2 sdformat_urdf + tf2_ros xacro ament_lint_auto diff --git a/ros_gz_sim_demos/rviz/diff_drive.rviz b/ros_gz_sim_demos/rviz/diff_drive.rviz index e647f4c9..a43e216a 100644 --- a/ros_gz_sim_demos/rviz/diff_drive.rviz +++ b/ros_gz_sim_demos/rviz/diff_drive.rviz @@ -6,14 +6,13 @@ Panels: Expanded: - /Global Options1 - /Odometry1 - - /Odometry1/Status1 + - /Odometry2 Splitter Ratio: 0.5 Tree Height: 701 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties Expanded: - - /2D Nav Goal1 - /Publish Point1 Name: Tool Properties Splitter Ratio: 0.5886790156364441 @@ -25,6 +24,24 @@ Panels: Visualization Manager: Class: "" Displays: + - 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: + Value: true - Angle Tolerance: 0.10000000149011612 Class: rviz_default_plugins/Odometry Covariance: @@ -56,13 +73,57 @@ Visualization Manager: Shaft Length: 1 Shaft Radius: 0.05000000074505806 Value: Arrow - Topic: /model/vehicle_blue/odometry - Unreliable: false + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /model/vehicle_blue/odometry + Value: true + - Angle Tolerance: 0.10000000149011612 + Class: rviz_default_plugins/Odometry + Covariance: + Orientation: + Alpha: 0.5 + Color: 255; 255; 127 + Color Style: Unique + Frame: Local + Offset: 1 + Scale: 1 + Value: true + Position: + Alpha: 0.30000001192092896 + Color: 204; 51; 204 + Scale: 1 + Value: true + Value: true + Enabled: true + Keep: 100 + Name: Odometry + Position Tolerance: 0.10000000149011612 + Shape: + Alpha: 1 + Axes Length: 1 + Axes Radius: 0.10000000149011612 + Color: 255; 25; 0 + Head Length: 0.30000001192092896 + Head Radius: 0.10000000149011612 + Shaft Length: 1 + Shaft Radius: 0.05000000074505806 + Value: Arrow + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /model/vehicle_green/odometry Value: true Enabled: true Global Options: Background Color: 48; 48; 48 - Fixed Frame: vehicle_blue/odom + Fixed Frame: world Frame Rate: 30 Name: root Tools: @@ -72,12 +133,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 @@ -85,25 +164,25 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 68.66040802001953 + Distance: 21.00491714477539 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false Focal Point: - X: -1.2689772844314575 - Y: 10.203336715698242 - Z: -2.8907392024993896 + X: -0.4080231189727783 + Y: 0.40098077058792114 + Z: 2.436375617980957 Focal Shape Fixed Size: true Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 1.5697963237762451 + Pitch: 0.5847957730293274 Target Frame: Value: Orbit (rviz) - Yaw: 0.8253979682922363 + Yaw: 0.4803982973098755 Saved: ~ Window Geometry: Displays: @@ -119,5 +198,5 @@ Window Geometry: Views: collapsed: false Width: 1200 - X: 325 - Y: 158 + X: 554 + Y: 154 From 5cc492c4f32d9da2f0abef90f3404226f6c75d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 18 Dec 2024 21:50:10 +0100 Subject: [PATCH 5/6] Refactor rgbd_camera_bridge demo (#643) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero Co-authored-by: Alejandro Hernández Cordero --- ros_gz_sim_demos/README.md | 2 +- .../config/rgbd_camera_bridge.yaml | 38 +++++++++ .../launch/rgbd_camera_bridge.launch.py | 76 ----------------- .../launch/rgbd_camera_bridge.launch.xml | 13 +++ ros_gz_sim_demos/rviz/rgbd_camera_bridge.rviz | 81 ++++++++++++++----- 5 files changed, 114 insertions(+), 96 deletions(-) create mode 100644 ros_gz_sim_demos/config/rgbd_camera_bridge.yaml delete mode 100644 ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.py create mode 100644 ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.xml diff --git a/ros_gz_sim_demos/README.md b/ros_gz_sim_demos/README.md index 354ba263..cfd53bb5 100644 --- a/ros_gz_sim_demos/README.md +++ b/ros_gz_sim_demos/README.md @@ -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). diff --git a/ros_gz_sim_demos/config/rgbd_camera_bridge.yaml b/ros_gz_sim_demos/config/rgbd_camera_bridge.yaml new file mode 100644 index 00000000..f2dfb2e2 --- /dev/null +++ b/ros_gz_sim_demos/config/rgbd_camera_bridge.yaml @@ -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 diff --git a/ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.py b/ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.py deleted file mode 100644 index fbb8e444..00000000 --- a/ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2019 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.actions import IncludeLaunchDescription -from launch.conditions import IfCondition -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration - -from launch_ros.actions import Node - - -def generate_launch_description(): - - pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') - pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') - - gz_sim = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')), - launch_arguments={ - 'gz_args': '-r sensors_demo.sdf' - }.items(), - ) - - # RViz - rviz = Node( - package='rviz2', - executable='rviz2', - arguments=[ - '-d', os.path.join(pkg_ros_gz_sim_demos, 'rviz', 'rgbd_camera_bridge.rviz') - ], - condition=IfCondition(LaunchConfiguration('rviz')) - ) - - remappings = [('/camera', '/camera/image'), - ('/camera_info', '/camera/camera_info')] - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=[ - '/camera@sensor_msgs/msg/Image@gz.msgs.Image', - '/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo', - '/rgbd_camera/image@sensor_msgs/msg/Image@gz.msgs.Image', - '/rgbd_camera/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo', - '/rgbd_camera/depth_image@sensor_msgs/msg/Image@gz.msgs.Image', - '/rgbd_camera/points@sensor_msgs/msg/PointCloud2@gz.msgs.PointCloudPacked' - ], - output='screen', - remappings=remappings, - ) - - return LaunchDescription([ - gz_sim, - DeclareLaunchArgument('rviz', default_value='true', - description='Open RViz.'), - bridge, - rviz, - ]) diff --git a/ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.xml b/ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.xml new file mode 100644 index 00000000..ef8bd03f --- /dev/null +++ b/ros_gz_sim_demos/launch/rgbd_camera_bridge.launch.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/ros_gz_sim_demos/rviz/rgbd_camera_bridge.rviz b/ros_gz_sim_demos/rviz/rgbd_camera_bridge.rviz index 58955045..30dd5004 100644 --- a/ros_gz_sim_demos/rviz/rgbd_camera_bridge.rviz +++ b/ros_gz_sim_demos/rviz/rgbd_camera_bridge.rviz @@ -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 @@ -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 @@ -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 @@ -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: 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: @@ -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 @@ -130,7 +173,7 @@ Window Geometry: Hide Right Dock: false Image: collapsed: false - QMainWindow State: 000000ff00000000fd000000040000000000000174000002f8fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000002ed00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002f8000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f8fc0200000005fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a0049006d006100670065010000003b000002020000002800fffffffb0000000a0049006d0061006700650100000243000000f00000002800fffffffb0000000a0056006900650077007300000000cf00000264000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000221000002f800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd000000040000000000000174000002f0fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005d00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000002ed00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003f000002f0000000cc00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f0fc0200000005fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a0049006d006100670065010000003f000001fd0000001700fffffffb0000000a0049006d0061006700650100000242000000ed0000001700fffffffb0000000a0056006900650077007300000000cf00000264000000a900fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000221000002f000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Tool Properties: @@ -138,5 +181,5 @@ Window Geometry: Views: collapsed: false Width: 1200 - X: 375 - Y: 1116 + X: 1312 + Y: 378 From 6c0f01f594c4eda3e931d68b6bfc60628a56b510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 18 Dec 2024 22:03:52 +0100 Subject: [PATCH 6/6] Refactor triggered_camera demo (#645) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero Co-authored-by: Alejandro Hernández Cordero --- ros_gz_sim_demos/README.md | 2 +- ros_gz_sim_demos/config/triggered_camera.yaml | 18 ++++++ .../launch/triggered_camera.launch.py | 64 ------------------- .../launch/triggered_camera.launch.xml | 13 ++++ 4 files changed, 32 insertions(+), 65 deletions(-) create mode 100644 ros_gz_sim_demos/config/triggered_camera.yaml delete mode 100644 ros_gz_sim_demos/launch/triggered_camera.launch.py create mode 100644 ros_gz_sim_demos/launch/triggered_camera.launch.xml diff --git a/ros_gz_sim_demos/README.md b/ros_gz_sim_demos/README.md index cfd53bb5..fd989eda 100644 --- a/ros_gz_sim_demos/README.md +++ b/ros_gz_sim_demos/README.md @@ -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: diff --git a/ros_gz_sim_demos/config/triggered_camera.yaml b/ros_gz_sim_demos/config/triggered_camera.yaml new file mode 100644 index 00000000..ec6cbb85 --- /dev/null +++ b/ros_gz_sim_demos/config/triggered_camera.yaml @@ -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 diff --git a/ros_gz_sim_demos/launch/triggered_camera.launch.py b/ros_gz_sim_demos/launch/triggered_camera.launch.py deleted file mode 100644 index c13144f1..00000000 --- a/ros_gz_sim_demos/launch/triggered_camera.launch.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2022 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.actions import IncludeLaunchDescription -from launch.conditions import IfCondition -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration - -from launch_ros.actions import Node - - -def generate_launch_description(): - - pkg_ros_gz_sim_demos = get_package_share_directory('ros_gz_sim_demos') - pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim') - - gz_sim = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': '-r triggered_camera_sensor.sdf'}.items(), - ) - - # RViz - rviz = Node( - package='rviz2', - executable='rviz2', - arguments=['-d', os.path.join(pkg_ros_gz_sim_demos, 'rviz', 'camera.rviz')], - condition=IfCondition(LaunchConfiguration('rviz')) - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/camera@sensor_msgs/msg/Image@gz.msgs.Image', - '/camera/trigger@std_msgs/msg/Bool@gz.msgs.Boolean', - '/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo'], - output='screen' - ) - - return LaunchDescription([ - DeclareLaunchArgument('rviz', default_value='true', - description='Open RViz.'), - gz_sim, - bridge, - rviz - ]) diff --git a/ros_gz_sim_demos/launch/triggered_camera.launch.xml b/ros_gz_sim_demos/launch/triggered_camera.launch.xml new file mode 100644 index 00000000..6320d977 --- /dev/null +++ b/ros_gz_sim_demos/launch/triggered_camera.launch.xml @@ -0,0 +1,13 @@ + + + + + + +