Overview

The Replay Mode feature in MORAI SIM enables playback of recorded vehicle movements within the simulation environment. Replay Mode is available either when a corresponding rosbag file is available or when interfacing with MORAI SIM with an external ROS environment. This feature relies on rosbag data format, which you can read up about here - rosbag.

There are two different methods of replaying rosbag data.

  • Rosbag Replay: rosbag files are replayed by importing them directly into the simulator.

  • Network Replay: rosbag files are played back within a separate ROS environment but communicate the data to the simulator through a rosbridge connection.

Rosbag Replay

Access the Rosbag Replay tool from the main menu bar. Go to PlayMode >> Replay >> Rosbag Replay to bring up the Rosbag File Manager window.

  1. Select a rosbag file from the file list to load it into the simulator. To search in other system folders, click the Explorer button to bring up the file explorer.

  2. If the loading task is successful, the Message Type should load display the default ROS message type /ReplayInfo.

  3. Click the Start button on the bottom of the window to bring up the Replayer Control Panel.

  4. Click the Play button (▷) button found in the Replayer Control Panel to begin data replay.

The Replayer Control Panel

The Replayer Control panel is self-explanatory in that it controls how the rosbag data files are replayed. By default, it appears along the upper-left corner of the main simulation screen.

With the Replayer Control panel, users can:

  • Play, rewind, and fast-forward playback using the main playback controls.

  • Use the scrubber (seek bar) to search for a specific time marker.

  • Control the overall playback speed (from 1.0x up to 10x speed)

  • Numbers indicate the Unix timestamp values of the rosbag data file and the current position of the playback file.

Users can save and load replay settings as well. Saved scenarios can be found by navigating to Scenario - Save&Load.

Replayer Settings

When using the Rosbag Replay mode, the simulator itself is playing the rosbag files and does not automatically broadcast the data. The Bridge Setting panel, however, lets users connect the simulator to a ROS system.

  • Bridge Setting

    • The Rosbag data from the replay can be published and viewed in ROS.

    • ROS message details

      • Message Type: morai_msgs/ReplayInfo

      • Default Topic: /ReplayInfo

  • Select Replay / Offset / Sensor Frame Rate

    • Select Replay: Check if Ego, NPC, Vehicle, Pedestrian is replayed while playing Rosbag file.

    • Height Offset: Set Z-axis offset for Ego Vehicle

      • If the vehicle clashes with ground while Rosbag is replayed as shown in the figure below, use Height Offset function to properly adjust the Ego Vehicle position.

    • Heading Offset: Heading-wise offset for Ego-vehicle

    • Sensor Frame Rate: Sensor data save rate (Hz) for vehicle-attached sensor during Rosbag Replay

  • Camera Setting

    • Perspective View: Free view of the camera

    • Top View: Top-down view

    • Vehicle View: Third-person view of the vehicle

  • Rosbag Replay control using ROS message

    • ROS messages can be published to control replay functions.

    • Options, perspective, and replay speed of the replay can be controlled.

      • Refer to detailed control instructions in the following link

  • Select Mode Option in Rosbag Replay Window

    • VEHICLE: Surrounding vehicles are shown as-is

    • BOX: Surrounding vehicles are shown as boxes

Vehicle display

Box display

Network Replay

  • Rosbag file is played in ROS environment by subscribing to data via rosbridge

    Enter IP and Port numbers in Bridge Setting to set up rosbridge IP and Port numbers for playing Rosbag file in ROS environment

  1. Select ‘Connect’ to check Replayer Control Panel in upper left-hand corner.

  2. Check and select Dataset and Draw Mode.

  3. Play Rosbag file in ROS environment

Option

  • Replayer Control Panel

    • After connection is established, the perspective of the Rosbag replay simulation can be selected from the Replayer Control Panel.

      • Perspective View : Free view of the camera

      • Top View : Top-down view

      • Vehicle View : Third-person view of the vehicle

    • After connection is established and Replayer Control Panel is popped up, the replay is executed using Rosbag file published by Ubuntu

  • ROS Environment Setting

    • Run Ros bridge

      • $ roslaunch rosbridge_server rosbridge_websocket.launch

    • Play Rosbag file

      • Change terminal directory to Rosbag file save location

      • $ rosbag play (Rosbag filename.bag)

      • The published data after Rosbag play can be viewed by using rqt function

ETC

Generate Rosbag File

  • Rosbag file can be generated by saving ROS Topic data in .bag format in Ubuntu environment.

  • In Ubuntu environment, connect with rosbridge after starting Simulator.

  • Check ROS Topic

    • $ rostopic list

    • Displays a list of connected ROS Topics

  • ROSbag file generation

    • $ rosbag record /ReplayInfo_topic

      • ReplayInfo_topic includes the following data.

        • Ego related information

          • ego_acc

          • ego_brake

          • ego_steer

          • ego_orientation_x

          • ego_orientation_y

          • ego_orientation_z

          • ego_orientation_w

          • ego_linearAcceleration_x

          • ego_linearAcceleration_y

          • ego_linearAcceleration_z

        • Object(NPC Vehicle, Pedestrian, Obstacle) related information

          • num_of_object

          • object_type

          • object_id

          • pose_x :

          • pose_y

          • pose_z

          • heading

          • size_x

          • size_y

          • size_z

          • velocity

      • Refer to following link for detailed description of ROS messages

    • While running Rosbag record, .bag files are saved in the current terminal directory.

Save Rosbag File

  • Move the generated Rosbag file into Data\SaveFile\Rosbag of Launcher folder.

Click Replay Mode - Rosbag Replay in top menu, click ‘Open’ to view Rosbag save file directory

Rosbag Replay Examples

Download the sample rosbag example from this link.

  • Rosbag Replay example video

  • Network Replay example video