-
Notifications
You must be signed in to change notification settings - Fork 162
6. Processing Data Logs
Quad Logger also contains a script to process the bags and generate MATLAB figures and animations, and automatically saves them into our specified file structure. Run
cd quad_logger/bags
cp quad_log.bag <bag_name>.bag
roscd quad_logger/scripts
matlab
In MATLAB, open the processLog.m script and set the following variables:
- Set the
trialNamevariable to your<bag_name>, or leave as a blank string (this will open a UI where you can select your bagfile directly). - Set the
namespacevariable to your<robot_ns>(the namespace of the robot set inquad_gazebo.launch). - set
bAnimateto true or false depending on whether you would like to see the trajectory animated in the body frame (MATLAB is unable to visualize floating base URDFs). - set
bSaveto true or false depending on whether you would like to save all the data and figures to a video. If yet, this will create (or overwrite) a folder namedtrialNameinquad_logger/logswith all your data.
You can also run matlab without the desktop GUI (matlab -nodesktop), and call processLog(<bag_name>) from the command window. This will automatically animate and save the data.
The folder created from bSave = true will be ignored by git.
In ROS 2, bag files are no longer single .bag files as in ROS 1, but instead are stored as directories that contain metadata and split data files (e.g., metadata.yaml, data_0.db3, etc.). To read these bags in MATLAB, the corresponding custom message types must first be generated so that MATLAB can interpret the topics correctly. This is done with ROS 2 Message Generation in the MATLAB terminal:
ros2genmsg('~/ros2_ws/src/quad-sdk')
rehash toolboxcacheclearRecord data:
roslaunch quad_utils logging.launch
Visualize data:
roslaunch quad_utils quad_visualization.launch
roscd quad_logger/bags
rosbag play quad_log.bag
Use the "Reset" button in RViz to flash and rerun a new bag.
Record data:
ros2 launch quad_utils logging.py
Visualize data:
ros2 launch quad_utils quad_visualization.py
cd quad_logger/bags
ros2 bag play quad_log_bag/
Use the "Reset" button in RViz to flash and rerun a new bag.