Main Page
Namespaces
Classes
Files
File List
File Members
src
setup_assistant_main.cpp
Go to the documentation of this file.
1
/*********************************************************************
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2012, Willow Garage, Inc.
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 Willow Garage 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
37
#include "
widgets/setup_assistant_widget.h
"
38
#include <
ros/ros.h
>
39
#include <QApplication>
40
#include <QMessageBox>
41
#include <boost/program_options.hpp>
42
#include <signal.h>
43
#include <locale.h>
44
45
static
void
siginthandler
(
int
param)
46
{
47
QApplication::quit();
48
}
49
50
void
usage
(boost::program_options::options_description& desc,
int
exit_code)
51
{
52
std::cout << desc << std::endl;
53
exit(exit_code);
54
}
55
56
int
main
(
int
argc,
char
** argv)
57
{
58
// Parse parameters
59
namespace
po = boost::program_options;
60
61
// Declare the supported options
62
po::options_description
desc
(
"Allowed options"
);
63
desc.add_options()(
"help,h"
,
"Show help message"
)(
"debug,g"
,
"Run in debug/test mode"
)(
64
"urdf_path,u"
, po::value<std::string>(),
"Optional, path to URDF file in ROS package"
)(
65
"config_pkg,c"
, po::value<std::string>(),
"Optional, pass in existing config package to load"
);
66
67
// Process options
68
po::variables_map vm;
69
try
70
{
71
po::store(po::parse_command_line(argc, argv, desc), vm);
72
po::notify(vm);
73
74
if
(vm.count(
"help"
))
75
usage
(desc, 0);
76
}
77
catch
(
const
std::exception& e)
78
{
79
std::cerr << e.what() << std::endl;
80
usage
(desc, 1);
81
}
82
// Start ROS Node
83
ros::init
(argc, argv,
"moveit_setup_assistant"
,
ros::init_options::NoSigintHandler
);
84
85
// ROS Spin
86
ros::AsyncSpinner
spinner
(1);
87
spinner.
start
();
88
89
ros::NodeHandle
nh;
90
91
// Create Qt Application
92
QApplication qtApp(argc, argv);
93
// numeric values should always be POSIX
94
setlocale(LC_NUMERIC,
"C"
);
95
96
// Load Qt Widget
97
moveit_setup_assistant::SetupAssistantWidget
saw(
NULL
, vm);
98
saw.setMinimumWidth(980);
99
saw.setMinimumHeight(550);
100
// saw.setWindowState( Qt::WindowMaximized );
101
102
saw.show();
103
104
signal(SIGINT,
siginthandler
);
105
106
// Wait here until Qt App is finished
107
const
int
result = qtApp.exec();
108
109
// Shutdown ROS
110
ros::shutdown
();
111
112
return
result;
113
}
usage
void usage(boost::program_options::options_description &desc, int exit_code)
Definition:
setup_assistant_main.cpp:50
NULL
#define NULL
ros::NodeHandle
moveit_setup_assistant::SetupAssistantWidget
Definition:
setup_assistant_widget.h:91
ros::init_options::NoSigintHandler
NoSigintHandler
desc
desc
ros::init
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
siginthandler
static void siginthandler(int param)
Definition:
setup_assistant_main.cpp:45
spinner
void spinner()
ros::AsyncSpinner::start
void start()
main
int main(int argc, char **argv)
Definition:
setup_assistant_main.cpp:56
ros.h
setup_assistant_widget.h
ros::shutdown
ROSCPP_DECL void shutdown()
ros::AsyncSpinner
moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sun Oct 18 2020 13:19:28