Simulation logs - osrf/mbzirc GitHub Wiki

Simulation logs of runs on cloudsim are saved to AWS s3 bucket. These are the same logs that are generated by the simulator when run locally, i.e. the logs in /tmp/ign/mbzirc

The teams can download logs for the runs using AWS CLI. See the submission instructions for setting up your AWS credentials.

aws s3 sync s3://cloudsim-mbzirc-logs/<team_name>/ logs

You should see several directories with alphanumeric characters as the directory name. These are unique ids of the runs that have been executed on the cloud simulation platform.

Extract the compressed file with the name <run_id>.tar.gz. Here are the contents inside each run directory:

<run_id>
├── logs
│   ├── events.yml
│   ├── mbzirc_<time_stamp>.log
│   ├── score.yml
│   └── summary.yml
└── playback
    └── state.tlog

The playback/state.tlog file is a recording of the entire simulation run, which can be played back using the simulator.

Notes:

  • if you see a state.tlog-journal file in the same playback directory, that means simulation probably did not shut down gracefully and the log file is in a bad state. For example, during dry run we do not intend to execute the run for the full duration of the challenge and will manually kill the simulation after some time. You may be able recover the file by running:

    # recover the log file - this may take a few mins
    sqlite3 state.tlog ".recover" | sqlite3 new.tlog
    
    # if the above command works fine, rename the new log file back to state.tlog
    mv new.tlog state.tlog

For log files downloaded from s3, they require models to be stored in the same paths as the one in the mbzirc docker container (i.e. /home/developer/mbzirc_ws/. The easiest way to play back the log files is to run them inside docker.

To playback the log:

  1. Launch the mbzirc_sim docker container:

    cd <path_to_mbzirc>/docker
    bash run.bash osrf/mbzirc:mbzirc_sim_latest
  2. The playback log requires access to meshes that are dynamically generated based on your config file. To create those meshes, you need to run the simulation with your config file inside the container. This step should only need to be done once for each new container.

    1. From the host machine, copy your team yaml configuration file into the container that was just started

      # run docker ps to see the container that was just started. Make note of the container id
      docker ps
      
      # copy your yaml config file to the home directory of the docker container
      docker cp <path_to_config_yaml> <container_id>:/home/developer/config.yaml
    2. From inside the docker container, run the simulation once

      ros2 launch mbzirc_ign competition.launch.py world:=coast config_file:=/home/developer/config.yaml
      
    3. Mesh files should be generated. Terminate the simulation.

  3. From inside the docker container, edit the playback.sdf file to point to the directory containing your state.tlog:

    # use your favorite terminal based text editor. You can also install gedit
    vim `ros2 pkg prefix mbzirc_ign`/share/mbzirc_ign/worlds/playback.sdf

    and replace the path: <playback_path>/tmp/ign/mbzirc/playback</playback_path> to point to the parent directory of the log file (not the state.tlog file itself). Do not build / reinstall the workspace otherwise it will override the changes you just made.

  4. Launch the simulator in playback mode inside the container:

    ign gazebo -v 4 `ros2 pkg prefix mbzirc_ign`/share/mbzirc_ign/worlds/playback.sdf

    This should take some time to load. You can ignore these warnings:

    Error [parser.cc:826] Error parsing XML from string: Error=XML_ERROR_EMPTY_DOCUMENT ErrorID=15 (0xf) Line number=0
    
  5. Hit Play - it may take a few seconds to start but the log should start playing.

    mbzirc_log_playback

    You can also use the playback scrubber to fast forward / rewind to a particular time in the run. However, note that for large simulation environments like MBZIRC, the operation may take a few mins to complete.

⚠️ **GitHub.com Fallback** ⚠️