POSIM v1.0.1Platform for Ocean Simulation · Documentation
Documentation menu
POSIM / Beginner guides

View & record sensor data

Start one sensor, confirm that fresh measurements arrive, then open a viewer or record a short run. The simulator stays running in Terminal A while these tools run in Terminal B.

Receive a camera image

Follow Prepare your terminals to open Terminal A and Terminal B in the same environment. Stop the previous simulation in A with Ctrl+C, then start this camera scene in A. Gazebo opens in the desktop prepared by your installation guide.

ros2 launch posim_demos posim_sensor.launch.py \
  namespace:=underwater_camera world_name:=camera_tutorial \
  x:=10 z:=-93.5 pitch:=0.3 yaw:=3.14 \
  paused:=false gui:=true headless:=false

In Terminal B:

ros2 topic echo --no-daemon /underwater_camera/simulated_image \
  sensor_msgs/msg/Image --once --no-arr

Check nonzero width and height, encoding and timestamp. --no-arr hides the pixel array from terminal output. To see the image, use an RViz Image display subscribed to this topic. Underwater camera explains the attenuation settings.

Visualization and recording

Choose RViz displays matching the message type.

POSIM-specific messages are defined in posim_interfaces. Install and source these definitions on each separate ROS client.

Find sensor topics and message types in the camera, pressure, DVL, USBL and sonar references. Ocean currents and spherical coordinates also expose ROS services for changing experiment inputs.

This standalone camera launch does not create a ROS /clock publisher. To include simulation time in the recording, prepare Terminal C in the same ROS environment as A and B and keep this one-way bridge running. Do not start a second bridge if /clock already has a publisher.

ros2 run ros_gz_bridge parameter_bridge '/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'

Back in Terminal B, confirm that a clock message arrives before recording:

ros2 topic echo --no-daemon /clock rosgraph_msgs/msg/Clock --once
ros2 bag record -o camera_run --topics /underwater_camera/simulated_image /clock

Press Ctrl+C to finish recording. Choose a new output directory for each run. Inspect the saved topic counts:

ros2 bag info camera_run

After recording, check that the bag contains both the image topic and /clock. Stop the bridge in Terminal C with Ctrl+C before replaying the bag.

Stop the simulator before replaying the observations on the same topics:

ros2 bag play camera_run