5 #include <ros/master.h>
12 #include <boost/process.hpp>
22 static boost::process::child ROSCORE;
23 static bool ROSCORE_INIT{
false};
26 void shutdown(
int sig)
29 RBX_INFO(
"Shutting down with signal %s.", strsignal(sig));
49 if (!ros::master::check())
54 ROSCORE = boost::process::child(
"rosmaster",
55 boost::process::std_in.close(),
56 boost::process::std_out > boost::process::null,
57 boost::process::std_err > boost::process::null
68 ROS::ROS(
int argc,
char **argv,
const std::string &name,
unsigned int threads) : argc_(argc), argv_(argv)
70 ros::init(argc, argv, name, ros::init_options::NoSigintHandler);
73 signal(SIGINT, shutdown);
74 signal(SIGSEGV, shutdown);
78 SPINNER.
reset(
new ros::AsyncSpinner(threads));
98 ros::waitForShutdown();
ROS(int argc, char **argv, const std::string &name="robowflex", unsigned int threads=1)
Constructor. Start-up ROS. If Boost version is greater than 1.64, rosmaster is started if it is not a...
std::vector< std::string > getArgs() const
Get command-line arguments without ROS parameters.
void wait() const
Waits for the process to be killed via some means (normally Ctrl-C)
~ROS()
Destructor. Shutdown ROS.
#define RBX_WARN(fmt,...)
Output a warning logging message.
#define RBX_ERROR(fmt,...)
Output a error logging message.
#define RBX_INFO(fmt,...)
Output a info logging message.
Main namespace. Contains all library classes and functions.
void explode()
Trigger a SEGSEGV.