Main Page
Namespaces
Classes
Files
File List
File Members
src
tools
csv_to_controller_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 datas to CSV for Matlab/etc analysis
37
*/
38
39
#include <
ros_control_boilerplate/tools/csv_to_controller.h
>
40
41
// Command line arguments
42
#include <gflags/gflags.h>
43
44
DEFINE_string
(csv_path,
""
,
"File location to load recoded data from"
);
45
DEFINE_string
(joint_trajectory_action,
""
,
"Which action server to send commands to"
);
46
DEFINE_string
(controller_state_topic,
""
,
"Where to subscribe the controller state"
);
47
48
int
main
(
int
argc,
char
** argv)
49
{
50
google::SetVersionString(
"0.0.1"
);
51
google::SetUsageMessage(
"Utility to load commands from a CSV"
);
52
google::ParseCommandLineFlags(&argc, &argv,
true
);
53
54
ros::init
(argc, argv,
"csv_to_controller"
);
55
ROS_INFO_STREAM_NAMED
(
"main"
,
"Starting CSVToController..."
);
56
57
// Get file name
58
if
(FLAGS_csv_path.empty())
59
{
60
ROS_ERROR_STREAM_NAMED
(
"csv_to_controller"
,
"No file name passed in"
);
61
return
0;
62
}
63
ROS_INFO_STREAM_NAMED
(
"csv_to_controller"
,
"Reading from file "
<< FLAGS_csv_path);
64
65
// Allow the action server to recieve and send ros messages
66
ros::AsyncSpinner
spinner
(2);
67
spinner.
start
();
68
69
ros_control_boilerplate::CSVToController
converter(FLAGS_joint_trajectory_action, FLAGS_controller_state_topic);
70
converter.
loadAndRunCSV
(FLAGS_csv_path);
71
72
ROS_INFO_STREAM_NAMED
(
"main"
,
"Shutting down."
);
73
ros::shutdown
();
74
75
return
0;
76
}
ROS_ERROR_STREAM_NAMED
#define ROS_ERROR_STREAM_NAMED(name, args)
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()
main
int main(int argc, char **argv)
Definition:
csv_to_controller_main.cpp:48
ros_control_boilerplate::CSVToController
Definition:
csv_to_controller.h:57
DEFINE_string
DEFINE_string(csv_path,"","File location to load recoded data from")
csv_to_controller.h
ros::shutdown
ROSCPP_DECL void shutdown()
ros::AsyncSpinner
ros_control_boilerplate::CSVToController::loadAndRunCSV
void loadAndRunCSV(const std::string &file_name)
Definition:
csv_to_controller.cpp:86
ros_control_boilerplate
Author(s): Dave Coleman
autogenerated on Sat Jun 8 2019 18:06:49