Skip to content

Cloudsim Log Playback

Angela Maio edited this page Jun 30, 2023 · 22 revisions

After you have submitted a solution through the Portal, you will have access to the logs generated by Gazebo and ROS. It may take multiple hours to finish running a submission. The factors that affect run time include availability of GPU EC2 instances, size and configuration of you robot team, and complexity of the simulated world. If you want a faster turn-around time, then use a smaller robot team or utilize the /subt/finish ROS service to terminate an solution.

Playback a state log file

A state log file, ending in .tlog, contains simulation state, such as pose information for all models. It's possible to playback a state log file using Ignition Gazebo to visualize a run using the Ignition Gazebo GUI.

It's possible that there is also a .tlog-journal file present. You can ignore this file.

Step 1: Download and unpack a log file

On each simulation row listed on the Submissions card on your dashboard (make sure to login) is a download icon. Click this button to open a drop-down menu that lists the available logs. The first menu option, called "Download Logs" contains the simulation state log and SubT scoring logs. The other menu options contain logs for each robot on your team.

Choose the "Download Logs" from the drop down menu, and patiently wait for the logs to download.

Untar the log file using tar xvf <downloaded log file>. You should see a logs directory appear in your current working directory.

Step 2: Playback the log file

There is ongoing work to support recording and playing back log files from different paths. In the mean time, there are two options for log playback.

Playback in docker container.

you can play back the logs inside one of the subt docker containers, e.g. subt_shell:

cd <path_to_subt>/docker
./build.bash subt_shell 
./run.bash subt_shell

In a separate terminal, copy the log file into the docker container

docker cp state.tlog <docker_container_name>:<path>

To playback the log file inside the docker container:

ign gazebo -v 4 -r --playback <path_to_dir_containing_the_logfile>

Local playback

Create a symbolic link named developer to your home directory:

cd /home
sudo ln -s yourusername developer

Then playback as usual:

LC_ALL=C ign gazebo -v 4 -r --playback <path_to_dir_containing_the_logfile>

Step 3: Seek

You can skip to specific timestamps using the following service, replacing <time_stamp> with your desired simulation time.

ign service -s /world/default/playback/control --reqtype ignition.msgs.LogPlaybackControl --reptype ignition.msgs.Boolean --timeout 5000 --req "seek: {sec: <time_stamp>}, pause: false"

Events log

A time series of events are recorded in the events.yml file. Each event has a type field that indicates what kind of event occurred and a time_sec field that indicates when, in simulation time, the event occurred. The following is a list of events types.

  1. Dead Battery: Logged when a robot's battery run out.

    - event:
      type: dead_battery
      time_sec: <sim_time_seconds>
      robot: <robot_name>
    
  2. Breadcrumb deployment: Logged when a breadcrumb deployment is attempted.

    - event:
      type: breadcrumb_deploy
      time_sec: <sim_time_seconds>
      robot: <robot_name>
    
  3. Marsupial detachment: Logged when a child vehicle detaches from a parent vehicle.

    - event:
      type: detach
      time_sec: <sim_time_seconds>
      robot: <child_robot_name>
    
  4. Region of interest: Logged when a robot enters or leaves a region of interest.

    - event:
      type: detect
      time_sec: <sim_time_seconds>
      detector: <tile_or_artifact_name>
      robot: <robot_name>
      state: [enter, exit] # Indicates if the robot has entered or exited the artifact region.
      extra:
        <key>: <value>
    

    Potential key:value pairs include:

     1. `type: artifact_proximity` Indicates a robot has entered/exited a region around an artifact
     2. `type: vertical` Indicates a robot has entered/exited a vertical shaft.
     3. `type: decision` Indicates a robot has reached a branch in the tunnel.
     4. `type: elevation` Indicates a robot is traversing a tile with elevation.
     5. `count: N` Indicates how many robots are inside the region
    
  5. Failed artifact report Logged when an artifact report is attempted, but fails due to a rule violation.

    - event:
      type: [artifact_report_score_finished, artifact_report_not_started, artifact_report_limit_reached, artifact_report_unknown_artifact]
      time_sec: <sim_time_seconds>
      total_score: <total_score>
    
  6. Attempted artifact report Logged when an artifact report is attempted.

    - event:
      type: artifact_report_attempt
      time_sec: <sim_time_seconds>
      reported_pose: <reported_pose_of_the_artifact_converted_to_world_coords>
      reported_artifact_type: <artifact_type>
      closest_artifact_name: <model_name_of_the_artifact>
      distance: <distance_between_reported_and_actual_pose>
      points_scored: <points_scored_from_this_attempt>
      total_score: <total_score>
    
  7. Flip Logged when a robot flips over.

    - event:
      type: flip
      time_sec: <sim_time_seconds>
      robot: <robot_name>
    
  8. Collision Logged when a robot is disabled due to collision damage.

    - event:
      type: collision
      time_sec: <sim_time_seconds>
      robot: <robot_name>
    
  9. Start Logged when a simulation run starts.

    - event:
      type: started
      time_sec: <sim_time_seconds>
    
  10. Finished Logged when a simulation run finishes.

    - event:
      type: finished
      time_sec: <sim_time_seconds>
      elapsed_real_time: <elapsed_real_time_seconds>
      elapsed_sim_time: <elapsed_sim_time_seconds>
      total_score: <total_score>
    
  11. Duplicate artifact report Logged when a duplicate artifact report is attempted.

    - event:
      type: duplicate_artifact_report
      time_sec: <sim_time_seconds>
      reported_pose: <reported_pose_of_the_artifact>
      reported_artifact_type: <artifact_type>
    
  12. Unknown artifact report Logged when an unknown artifact report occurs.

    - event:
      type: unknown_artifact_type
      time_sec: <sim_time_seconds>
      reported_pose: <reported_pose_of_the_artifact>
      reported_artifact_type: <artifact_type>
    
  13. Rock fall Logged when a dynamic rock fall deployment occurs.

    - event:
      type: rock_fall
      time_sec: <sim_time_seconds>
      model: <rock_fall_model_name>
    
  14. Dynamic Collapse Logged when a dynamic tunnel collapse deployment occurs.

    - event:
      type: dynamic_collapse
      time_sec: <sim_time_seconds>
      model: <dynamic_collapse_model_name>
    
  15. Fog Logged when a dynamic fog deployment occurs.

    - event:
      type: fog
      time_sec: <sim_time_seconds>
      model: <fog_model_name>
    
  16. Max breadcrumb Logged when a robot runs out of breadcrumb deployments.

    - event:
      type: max_breadcrumb_deploy
      time_sec: <sim_time_seconds>
      robot: <robot_name>
    

Run log

The run.yml file contains detailed information about a simulation run. The following information is recorded in this file.

world_name: <name_of_the_simulation_world>
robots:
  <robot_name>:
    platform: <platform_name>
    config: <sensor_configuration_name>
marsupials:
  <parent robot name>: <child robot name>
artifacts_found: <number of artifacts found>
robot_count: <total robot count>
unique_robot_count: <total number of unique robots>
sim_time: <total simulation time>
real_time: <total real time>
artifact_report_count: <Number of artifact reports>
duplicate_report_count: <Number of duplicate reports>
closest_artifact_report:
  name: <Name of artifact>
  type: <Type of artifact>
  true_pos: <True X Y Z position in world coords>
  reported_pos: <Reported X Y Z position converted to world coords>
  distance: <Distance between reported and true position>
first_artifact_report: <First artifact report time in seconds>
last_artifact_report: <Last artifact report time in seconds>
mean_time_between_successful_artifact_reports: <Mean time between artifact reports in seconds>
greatest_distance_traveled: <Greatest distance traveled by a robot in meters>
greatest_distance_traveled_robot: <Name of the robot that traveled the greatest distance>
greatest_euclidean_distance_from_start: <Greatest Euclidean distance from the starting area>
greatest_euclidean_distance_from_start_robot: <Name of the robot that traveled the greatest Euclidean distance from the starting area>
total_distance_traveled: <Total distance traveled by all of the robots>
greatest_max_vel: <Greatest maximum velocity in m/s>
greatest_max_vel_robot: <Name of the robot that achieved the greatest_max_vel>
greatest_avg_vel: <Greatest average velocity in m/s>
greatest_avg_vel_robot: <Name of the robot that achieved the greatest_avg_vel>
greatest_elevation_gain: <Greatest elevation gain in m>
greatest_elevation_gain_robot: <Name of the robot that achieved the greatest_elevation_gain>
greatest_elevation_loss:  <Greatest elevation loss in m>
greatest_elevation_loss_robot: <Name of the robot that achieved the greatest_elevation_loss>
total_elevation_gain: <Total elevation gain of all of the robots>
total_elevation_loss: <Total elevation loss of all of the robots>
max_elevation_reached: <Maximum elevation reached in m>
max_elevation_reached_robot: <Name of the robot that achieved the maximum elevation>
min_elevation_reached: <Minimum elevation reached in m>
min_elevation_reached_robot: <Name of the robot that achieved the minimum elevation>

Robot position data

Each robot will record its location over time in a file in the pos-data subdirectory. Each line within one of the log files has the following format

sim_time_seconds sim_time_nanoseconds x y z

The x,y,z components are in the global coordinate frame. An entry is added to these log files whenever a robot moves more than 1 meter from its previous position.

You can use these log files to plot the path of a robot. If you have gnuplot installed, then you could plot the x,y path of a robot using something similar to

> plot 'file-pose.data' using 3:4 with lines;

Ignition Gazebo server log

Ignition Gazebo logs information, warnings, and errors to the server_console.log file. You can use this log file to help debug simulation errors.

Deprecated log files

  1. subt_<CIRCUIT>_<DATETIME>.log has been superseded by events.yml and run.yml.
Clone this wiki locally