Main Page
Namespaces
Classes
Files
File List
File Members
src
tools
controller_to_csv_main.cpp
Go to the documentation of this file.
1
/*********************************************************************
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2015, University of Colorado, Boulder
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
*
11
* * Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* * Redistributions in binary form must reproduce the above
14
* copyright notice, this list of conditions and the following
15
* disclaimer in the documentation and/or other materials provided
16
* with the distribution.
17
* * Neither the name of the Univ of CO, Boulder nor the names of its
18
* contributors may be used to endorse or promote products derived
19
* from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
* POSSIBILITY OF SUCH DAMAGE.
33
*********************************************************************/
34
35
/* Author: Dave Coleman
36
Desc: Records ros_control ControllerState data to CSV for Matlab/etc analysis
37
*/
38
39
#include <
ros_control_boilerplate/tools/controller_to_csv.h
>
40
41
// Command line arguments
42
#include <gflags/gflags.h>
43
44
DEFINE_string
(csv_path,
"/tmp/recorded_trajectory_1.csv"
,
"File location to save recoded data to"
);
45
DEFINE_string
(topic,
"/robot/position_trajectory_controller/state"
,
"ROS topic to subscribe to"
);
46
47
int
main
(
int
argc,
char
** argv)
48
{
49
google::SetVersionString(
"0.0.1"
);
50
google::SetUsageMessage(
"Utility to record controller topic to a CSV"
);
51
google::ParseCommandLineFlags(&argc, &argv,
true
);
52
53
ros::init
(argc, argv,
"controller_to_csv"
,
ros::init_options::AnonymousName
);
54
ROS_INFO_STREAM_NAMED
(
"main"
,
"Starting ControllerToCSV..."
);
55
56
// Allow the action server to recieve and send ros messages
57
ros::AsyncSpinner
spinner
(2);
58
spinner.
start
();
59
60
const
std::string topic = FLAGS_topic;
61
const
std::string csv_path = FLAGS_csv_path;
62
ros_control_boilerplate::ControllerToCSV
converter(topic);
63
converter.
startRecording
(csv_path);
64
65
ROS_INFO_STREAM_NAMED
(
"main"
,
"Type Ctrl-C to end and save"
);
66
ros::spin
();
67
68
ROS_INFO_STREAM_NAMED
(
"main"
,
"Shutting down."
);
69
ros::shutdown
();
70
71
return
0;
72
}
ros::init_options::AnonymousName
AnonymousName
ros::init
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROS_INFO_STREAM_NAMED
#define ROS_INFO_STREAM_NAMED(name, args)
spinner
void spinner()
ros::AsyncSpinner::start
void start()
ros_control_boilerplate::ControllerToCSV
Definition:
controller_to_csv.h:51
ros::spin
ROSCPP_DECL void spin()
DEFINE_string
DEFINE_string(csv_path,"/tmp/recorded_trajectory_1.csv","File location to save recoded data to")
ros::shutdown
ROSCPP_DECL void shutdown()
ros_control_boilerplate::ControllerToCSV::startRecording
void startRecording(const std::string &file_name)
Start the data collection.
Definition:
controller_to_csv.cpp:111
main
int main(int argc, char **argv)
Definition:
controller_to_csv_main.cpp:47
ros::AsyncSpinner
controller_to_csv.h
ros_control_boilerplate
Author(s): Dave Coleman
autogenerated on Sat Jun 8 2019 18:06:49