Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor camera demo #634

Merged
merged 13 commits into from
Dec 18, 2024
2 changes: 1 addition & 1 deletion ros_gz_sim_demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
12 changes: 12 additions & 0 deletions ros_gz_sim_demos/config/camera.yaml
Original file line number Diff line number Diff line change
@@ -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
63 changes: 0 additions & 63 deletions ros_gz_sim_demos/launch/camera.launch.py

This file was deleted.

13 changes: 13 additions & 0 deletions ros_gz_sim_demos/launch/camera.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<launch>
<gz_server
world_sdf_file="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/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>
90 changes: 66 additions & 24 deletions ros_gz_sim_demos/rviz/camera.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -82,56 +106,74 @@ 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
Value: true
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: <Fixed 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
Loading