Created
May 25, 2019 06:09
-
-
Save svarnypetr/5bad476eb6da2d97bf0f2ca00d2b2a4f to your computer and use it in GitHub Desktop.
ROS experiments bulk data extractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| :' | |
| If you have multiple rosbags each in its own folder and need to extract some experimental data from them. | |
| The gist shows how to run processing scripts that are part of a ROS package and also export some ROS topics. | |
| A workspace needs to be sourced before this script is ran! | |
| ' | |
| ROS_PACKAGE=your_ros_package | |
| roscore & | |
| sleep 10 | |
| rosparam set use_sim_time true | |
| # For every folder in the current folder that starts with 'experiment' | |
| for D in `find . -type d -name 'experiment*'` | |
| do | |
| cd $D | |
| BAG=`find . -type f -name '*.bag'` | |
| rosrun ROS_PACKAGE python_script.py & | |
| rostopic echo -p /topic > exported_topic.csv & | |
| rosbag play --clock $BAG | |
| cd .. | |
| #we kill the nodes and topics to start new ones in the next folder. We can still use the same roscore | |
| rosnode kill python_script_node | |
| pkill rostopic | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment