Skip to content

ROS bag analysis

David Smith edited this page Jan 9, 2024 · 2 revisions

Using DeepRacer Scripts it's possible to update the car to enable the creation of a ROS bag when the car is running, first off your car needs to be running the development code which is installed using dev-stack-* and then needs to have logging enabled:

Open and edit the file

sudo vi /opt/aws/deepracer/start_ros.sh

as below (changing the ros2 launch line)

ros2 launch deepracer_launcher deepracer_launcher.py camera_resize:=False camera_fps:=30 logging_enable:=True

(note: camera running at 30 fps is the default behaviour)

and then restart the DeepRacer service

sudo systemctl restart deepracer-*

Now when a model is selected from the car console and Start is pressed to begin a run a ROS bag is created in /opt/aws/deepracer/logs/ with the directory format deepracer-bag-YYYYMMDD-HHMMSS

Analysis of the ROS bag can be performed using the Jupyter notebook in larsll-deepracer-logging

Get the ROS bag off the car

scp -r [email protected]:/opt/aws/deepracer/logs/deepracer-bag-YYYYMMDD-HHMMSS ./logs

Build the container

docker build -t <image-name> .

Run the container

docker run -ti -p 8888:8888 -v `pwd`:/workspace/analysis -v ./logs:/workspace/logs <image-name>

You also need access to the model.pb and model_metadata.json for the notebook, update the lines in the notebook as below:

bag_path = '/workspace/logs/deepracer-bag-YYYYMMDD-HHMMSS'
metadata_json = '/workspace/logs/models/model-name/model_metadata.json'
model_pb = '/workspace/logs/models/model-name/agent/model.pb'

(note: this is easiest if you just decompress the model-name-model.tar.gz file into the logs directory)

...and then you can run the notebook to do the analysis

Building into DREM

Cars need to be running the correct version of the software with the ROS Bag logging functionality, and it needs to be enabled

Analyse lambda

  1. Create a lambda to run the notebook
  2. Lambda / notebook saves the movie to S3 for racer to review / download

Timekeeper updates Start

  1. Select car for the race
  2. Select the models that could be used in the race (considering racers might change models in their run (but this will create a new ROS bag)) or update the ROS bag to include the model raced info

End

  1. Once the car has stopped (or a stop command has been sent via SSM as now we know the car on track)
  2. Grab the ROS bag from the car
  3. Remove the ROS bag from the car (save storage space)
  4. Send to analyse lambda (DREM needs to know the model raced)

Notes

  1. Add to the table of races the car(s) that were used in that race (in case of car failure)
  2. At the end of the run generate a pre-signed key to upload the ROS Bag to from the car (SSM)
  3. If there is trackside failure we need to allow for a physical car swap
  4. Start / Stop in the race if the car is "running away" so would still be part of the same ROS bag (15 second window TBC)
  5. Should it be an optional thing ?
  6. Can only run on hacked cars ;-)
Clone this wiki locally