Skip to content

feat(sim): add a temporary camera to the simulated robot - #68

Merged
AksonovSergei merged 2 commits into
mainfrom
65-temporary-simulation-camera
Nov 11, 2026
Merged

AksonovSergei merged 2 commits into
mainfrom
65-temporary-simulation-camera

Conversation

@Fastroof

Copy link
Copy Markdown
Contributor

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.

  • xacro argument camera (default false) includes camera.xacro. [sim_robot.launch.py](http://sim_robot.launch.py/) (and so [sim.launch.py](http://sim.launch.py/))
    has a launch argument camera, default true; [robot.launch.py](http://robot.launch.py/) / [hw.launch.py](http://hw.launch.py/) do not enable it. A separate
    argument, not sim_mode: a real camera will be enabled on the robot the same way.
  • Sensor: 640×480 at 30 Hz instead of 1920×1080 (Resolve camera image transmission latency #32), the noise is kept. The numbers are written in
    camera.xacro directly, as in lidar.xacro, not as xacro properties: they are used once, next to their tags.
  • Mount: a temporary one, until the real camera is chosen, in camera.xacro (a comment says so), as the lidar
    mount is in lidar.xacro. The camera is on the front face of the body (x 0.11, z 0.09 from base_link), below
    the top of the body (z 0.112 by the mesh), so it does not block the lidar (z 0.12).
  • Bridge, as in turtlebot3_gazebo: image_bridge (ros_gz_image) in [sim_robot.launch.py](http://sim_robot.launch.py/) for
    /camera/image_raw, as it adds the image_transport topics (compressed, ...), runs only with the camera;
    /camera/camera_info in gz_bridge.yaml with the other topics. frame_id is the optical frame
    camera_rgb_frame (REP 103). The Gazebo topics get the robot_ns prefix (Namespace of the simulated robot for a shared simulation #64), the ROS topics are
    /camera/... in any case: image_transport names its topics from the topic before the remapping, so each
    transport (compressed, compressedDepth, theora, zstd) is remapped.
  • RViz: a Camera display of /camera/image_raw (Reliable), disabled by default (the same config is used for
    the real robot).
  • README: the camera topics and camera:=false in Simulation on a PC.

How it was tested

  • simulation
  • real robot (overlay or branch image)

Simulation ([sim.launch.py](http://sim.launch.py/), headless on an NVIDIA GPU, empty world unless stated):

  • Rate by the header stamps over 10 s after a warm-up: 30.3 Hz in Gazebo (camera and lidar, no frame skipped),
    30.3 Hz for a reliable subscriber of /camera/image_raw and for /camera/image_raw/compressed.
    A best effort subscriber of the raw image (as ros2 topic hz) gets 26–27.5 Hz: a frame of 921 kB is many
    DDS fragments, and best effort does not resend a lost one. The publisher (image_bridge) is reliable, so
    the RViz display is Reliable too. 640×480 rgb8, frame_id camera_rgb_frame; the image_transport
    topics (compressed, ...) are there.
  • TF base_link → camera_rgb_frame: xyz 0.11 0 0.09, rpy −π/2 0 −π/2.
  • Orientation, with boxes 1.5 m in front of the robot: a red one straight ahead is in the horizontal centre of the
    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 no camera_link in robot_description; only the empty
    /camera/camera_info of the bridge config stays (no publisher in Gazebo).
  • xacro robot.urdf.xacro sim_mode:=false (as [robot.launch.py](http://robot.launch.py/)): no camera_link.
  • warehouse real time factor: 1.00 with the camera, 1.00 without it (average over 20 s).
  • RViz (view_robot.rviz with the Camera display ticked, warehouse): the image is upright, looks forward and
    follows the robot when it turns.
  • KPI Rover hub arena (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_info
    and the image_transport topics /camera/image_raw/compressed, ... at 29.8–30.3 Hz. The arena steps 10 ms, so
    the gaps between frames are 30 or 40 ms.
  • KPI Rover hub, a new user from the first login (user03): KPI Rover GUI → Shared arena → Join → Put in, then
    RViz 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

  • One topic per PR
  • README / docs updated if the behaviour or the usage changed
  • Breaking change (topics, parameters, launch arguments used by applications) is marked with ! in the title

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>.
@Fastroof Fastroof linked an issue Nov 11, 2026 that may be closed by this pull request
@AksonovSergei
AksonovSergei enabled auto-merge (squash) November 11, 2026 20:16
@AksonovSergei
AksonovSergei merged commit 3a90d1a into main Nov 11, 2026
3 checks passed
@AksonovSergei
AksonovSergei deleted the 65-temporary-simulation-camera branch November 11, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a temporary camera to the robot model for the simulation

2 participants