Repository navigation
feat(sim): add a temporary camera to the simulated robot - #68
Merged
Merged
Conversation
Refs #65. The camera is simulation-only until the real robot gets one: - xacro argument camera (default false) includes camera.xacro; sim_robot.launch.py passes camera:=true by default, robot.launch.py / hw.launch.py do not enable it. - 640x480 at 30 Hz, the noise is kept; a temporary mount on the front of the body. - image_bridge for /camera/image_raw (image_transport), /camera/camera_info in gz_bridge.yaml, frame camera_rgb_frame (optical, REP 103); the Gazebo topics get the robot_ns prefix. - RViz: a Camera display of /camera/image_raw, disabled by default. README: the camera topics.
In a namespace (robot_ns) image_transport named the compressed topics after the Gazebo topic (/<robot_ns>/camera/image_raw/compressed); each transport is remapped to /camera/image_raw/<transport>.
AksonovSergei
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #65
What and why
A camera in the simulation for object detection (#40), visual SLAM (#20) and student applications before the real
robot has one. It is temporary and simulation-only: the model of the real robot does not change.
camera(defaultfalse) includescamera.xacro.[sim_robot.launch.py](http://sim_robot.launch.py/)(and so[sim.launch.py](http://sim.launch.py/))has a launch argument
camera, defaulttrue;[robot.launch.py](http://robot.launch.py/)/[hw.launch.py](http://hw.launch.py/)do not enable it. A separateargument, not
sim_mode: a real camera will be enabled on the robot the same way.camera.xacrodirectly, as inlidar.xacro, not as xacro properties: they are used once, next to their tags.camera.xacro(a comment says so), as the lidarmount is in
lidar.xacro. The camera is on the front face of the body (x 0.11, z 0.09 frombase_link), belowthe top of the body (z 0.112 by the mesh), so it does not block the lidar (z 0.12).
turtlebot3_gazebo:image_bridge(ros_gz_image) in[sim_robot.launch.py](http://sim_robot.launch.py/)for/camera/image_raw, as it adds theimage_transporttopics (compressed, ...), runs only with the camera;/camera/camera_infoingz_bridge.yamlwith the other topics.frame_idis the optical framecamera_rgb_frame(REP 103). The Gazebo topics get therobot_nsprefix (Namespace of the simulated robot for a shared simulation #64), the ROS topics are/camera/...in any case:image_transportnames its topics from the topic before the remapping, so eachtransport (compressed, compressedDepth, theora, zstd) is remapped.
/camera/image_raw(Reliable), disabled by default (the same config is used forthe real robot).
camera:=falsein Simulation on a PC.How it was tested
Simulation (
[sim.launch.py](http://sim.launch.py/), headless on an NVIDIA GPU, empty world unless stated):30.3 Hz for a
reliablesubscriber of/camera/image_rawand for/camera/image_raw/compressed.A
best effortsubscriber of the raw image (asros2 topic hz) gets 26–27.5 Hz: a frame of 921 kB is manyDDS fragments, and best effort does not resend a lost one. The publisher (
image_bridge) isreliable, sothe RViz display is
Reliabletoo. 640×480rgb8,frame_idcamera_rgb_frame; theimage_transporttopics (compressed, ...) are there.
base_link→camera_rgb_frame: xyz 0.11 0 0.09, rpy −π/2 0 −π/2.image (x 320 of 640), a green one to the left (+y) is on the left (x 153), a blue one above is above (y 158 against
286); the horizon is in the middle of the image, the ground below it.
camera:=false: no camera in Gazebo and nocamera_linkinrobot_description; only the empty/camera/camera_infoof the bridge config stays (no publisher in Gazebo).xacro robot.urdf.xacro sim_mode:=false(as[robot.launch.py](http://robot.launch.py/)): nocamera_link.warehousereal time factor: 1.00 with the camera, 1.00 without it (average over 20 s).view_robot.rvizwith the Camera display ticked,warehouse): the image is upright, looks forward andfollows the robot when it turns.
garden,robot_ns:=user01 load_controllers:=false): Gazebo topics/user01/camera/image_raw,/user01/camera/camera_info; in the session/camera/image_raw,/camera/camera_infoand the
image_transporttopics/camera/image_raw/compressed, ... at 29.8–30.3 Hz. The arena steps 10 ms, sothe gaps between frames are 30 or 40 ms.
user03): KPI Rover GUI → Shared arena → Join → Put in, thenRViz with the Camera display ticked shows the garden from the robot.
Real robot: nothing changes for it, the camera is off by default in
[description.launch.py](http://description.launch.py/).Checklist
!in the title