-
Notifications
You must be signed in to change notification settings - Fork 8
Recording Data
While it is possible to record rosbag files using the C++ and Python API, I found it cumbersome to use the API as well as be confident that I was not losing messages, etc. The rosbag command line tools have been developed and used for a very long time and so I wrote a quick script that uses python to call and kill processes when triggered.
This tool is most useful for data logging (as the package name suggests). For more fine-tuned message recording, etc. I would not recommend using this package. The package is intended to capture a lot of data on several topics running at the full hz.
The launch file for starting the data logger can be found in launch/record.launch
. This launch file calls a single node logger.py
that facilitates starting and stopping recording.
Within the launch file there are several rosparams that can be set to specify what topics to record and the data location. You can also programatically set these after launching the logger class by publishing to the correct c6_task_topic
. This allows you to change data storage location and sets the topics you wish to record on the fly.
-
datapath
: this parameter can be set in the roslaunch file and specifies the location in your home directory that you wish the data to be written to. The default value isdata/c6_data
-
record_topics
: This can be set in the roslaunch file AND changed using a LogControl msg. This tells logger which topics to log. The topics are separated by a single space. Example can be found in therecord.launch
file -
data_prefix
: This will append a string to the beginning of all of the filenames. So for example, if the prefix is collection, then the filename can end up being collection_DATE.bag -
log_flag_topic
: This is the topic that the logger will listen to. It expects the topic to publish a singlestd_msgs/Bool
message. True to start, False to stop. Changing this topic allows you to have multiple different logger nodes that can be triggered from different topics and record different data.
LogControl.msg allows several parameters that the logger has to be changed on the fly.
Data is stored in the specified datapath
directory where the taskName and skillName determine the hierarchy that data is stored in. For example, if default values are used, the data is stored at:
~/data/c6_data/default_task/default_skill/<bag files>
. Changing the taskName and skillName allows the logger to place bag files into different directories based on a task or skill that is being recorded (or whatever you designate as how you want the data stored)
-
taskName
(string): Name of the task being performed (see above) -
skillName
(string): Name of the skill being performed (see above) -
topics
(string): A string of topics to record. Same as the launch file, multiple topics can be listed as long as they are separated by a space -
playback
(bool): Simple boolean that will append playback vs. recording to the bagfile name -
runName
(string): This allows a specific name to be given to the bagfile when recording. Highly useful for changing this on the fly based on what action/data is being recorded. -
actionType
(string): Unused currently
To start recording, you have to publish "True" or "False" to the log_flag_topic
that can be changed in the launch file to whatever topic name you'd like.