1818#include < lifecycle_msgs/msg/state.hpp>
1919#include < lifecycle_msgs/msg/transition_event.hpp>
2020
21- #include < boost/program_options.hpp>
22-
2321#include < chrono>
2422#include < memory>
2523#include < string>
@@ -46,47 +44,12 @@ using system_modes::msg::ModeEvent;
4644using lifecycle_msgs::msg::State;
4745using lifecycle_msgs::msg::TransitionEvent;
4846
49- using boost::program_options::value;
50- using boost::program_options::variables_map;
51- using boost::program_options::command_line_parser;
52- using boost::program_options::options_description;
53- using boost::program_options::positional_options_description;
54-
5547using rcl_interfaces::msg::ParameterType;
5648using rcl_interfaces::msg::ParameterEvent;
5749
5850string modelfile, loglevel;
59- options_description options (" Allowed options" );
60-
6151shared_ptr<ModeManager> manager;
6252
63- bool parseOptions (int argc, char * argv[])
64- {
65- options.add_options ()(" help" , " Help message and options" )(
66- " modelfile" , value<string>(&modelfile),
67- " Path to yaml model file" )(
68- " __log_level" , value<string>(&loglevel),
69- " ROS2 log level" )(
70- " ros-args" , value<vector<string>>()->multitoken (), " ROS args" )(
71- " params-file" , value<vector<string>>()->multitoken (), " ROS params file" );
72-
73- positional_options_description positional_options;
74- positional_options.add (" modelfile" , 1 );
75-
76- variables_map map;
77- store (
78- command_line_parser (argc, argv)
79- .options (options)
80- .positional (positional_options)
81- .run (), map);
82- notify (map);
83-
84- if (map.count (" help" )) {
85- return true ;
86- }
87- return false ;
88- }
89-
9053void transition_callback (
9154 const TransitionEvent::SharedPtr msg,
9255 const string & node_name)
@@ -147,26 +110,10 @@ int main(int argc, char * argv[])
147110{
148111 using namespace std ::placeholders;
149112
150- // Handle commandline arguments.
151- try {
152- if (parseOptions (argc, argv)) {
153- cout << " Usage: mode_manager MODELFILE" << std::endl;
154- cout << options;
155- cout << " Or specify the MODELFILE by ROS parameter 'modelfile'." << std::endl << std::endl;
156- return EXIT_SUCCESS;
157- }
158- } catch (const std::exception & e) {
159- cerr << " Error parsing command line: " << e.what () << std::endl;
160- cout << " Usage: mode_manager [MODELFILE]" << std::endl;
161- cout << options;
162- cout << " Or specify the MODELFILE by ROS parameter 'modelfile'." << std::endl << std::endl;
163- return EXIT_FAILURE;
164- }
165-
166113 setvbuf (stdout, NULL , _IONBF, BUFSIZ);
167114 rclcpp::init (argc, argv);
168115
169- manager = std::make_shared<ModeManager>(modelfile );
116+ manager = std::make_shared<ModeManager>();
170117
171118 vector<shared_ptr<rclcpp::Subscription<TransitionEvent>>>
172119 state_sub_;
0 commit comments