-
Notifications
You must be signed in to change notification settings - Fork 12
ROS bag analysis
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
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
- Create a lambda to run the notebook
- Lambda / notebook saves the movie to S3 for racer to review / download
Timekeeper updates Start
- Select car for the race
- 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
- Once the car has stopped (or a stop command has been sent via SSM as now we know the car on track)
- Grab the ROS bag from the car
- Remove the ROS bag from the car (save storage space)
- Send to analyse lambda (DREM needs to know the model raced)
Notes
- Add to the table of races the car(s) that were used in that race (in case of car failure)
- At the end of the run generate a pre-signed key to upload the ROS Bag to from the car (SSM)
- If there is trackside failure we need to allow for a physical car swap
- 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)
- Should it be an optional thing ?
- Can only run on hacked cars ;-)