Skip to content

Add a temporary camera to the robot model for the simulation #65

Closed

Description

@AksonovSergei

Goal

Work with a camera in the simulation (object detection #40, visual SLAM #20, student applications) before the real robot has one. The camera is temporary and simulation-only: the model of the real robot does not change.

Current state

  • camera.xacro exists: camera_link on the front of the body, the optical frame camera_rgb_frame, a Gazebo camera sensor (1920×1080, 30 Hz, Gaussian noise) publishing camera/image_raw and camera/camera_info.
  • It is not used: the include in robot.urdf.xacro is commented out.
  • gz_bridge.yaml bridges only clock, scan and the IMU, no camera topics.

What to do

  1. Switchable camera. A xacro argument camera (default false) includes camera.xacro. sim.launch.py gets a launch argument camera (default true) and passes it to xacro. robot.launch.py / hw.launch.py do not enable it, so robot_description and TF of the real robot stay as they are. A separate argument, not sim_mode: when a real camera is mounted, it is enabled on the robot the same way.
  2. Sensor settings. 1920×1080 at 30 Hz is heavy for the simulation and for DDS (see the latency in Resolve camera image transmission latency #32). Defaults like 640×480 at 15–30 Hz, with resolution and rate as xacro properties. Keep the noise.
  3. Mount pose as parameters. The position is now ${base_x_size/2} 0 ${base_z_size}, and base_z_size is not the body height (see Review the URDF dimensions against the real robot #55). Make x/y/z/pitch xacro properties next to the other dimensions, with a comment that it is a temporary mount until the real camera is chosen.
  4. Bridge. Image through ros_gz_image (image_bridge, gives image_transport, e.g. compressed images), camera_info through the parameter bridge. Topics /camera/image_raw, /camera/camera_info, frame_id = the optical frame (REP 103: z forward, x right, y down).
  5. RViz. An Image display of /camera/image_raw in the RViz config of the simulation (may be disabled by default).
  6. Docs. README: the camera topics and camera:=false in Simulation on a PC.

Done when

  • ros2 launch kpi_rover_bringup sim.launch.py publishes /camera/image_raw and /camera/camera_info at the configured rate (ros2 topic hz), the image is upright and looks forward in RViz, the TF of the optical frame is correct (an object in front of the robot is in the centre of the image).
  • sim.launch.py camera:=false gives the model without the camera.
  • robot_description of robot.launch.py does not contain camera_link (check with xacro ... | grep camera).
  • The real time factor in warehouse with the camera stays close to the one without it (state both numbers in the PR).

Related

#40 Object detection, #20 Visual SLAM, #55 URDF dimensions, #32 camera image latency.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions