rclcpp  beta1
C++ ROS Client Library API
Functions
rclcpp::utilities Namespace Reference

Functions

void init (int argc, char *argv[])
 Initialize communications via the rmw implementation and set up a global signal handler. More...
 
bool ok ()
 Check rclcpp's status. More...
 
void shutdown ()
 Notify the signal handler and rmw that rclcpp is shutting down. More...
 
void on_shutdown (std::function< void(void)> callback)
 Register a function to be called when shutdown is called. More...
 
rcl_guard_condition_tget_sigint_guard_condition (rcl_wait_set_t *waitset)
 Get a handle to the rmw guard condition that manages the signal handler. More...
 
void release_sigint_guard_condition (rcl_wait_set_t *waitset)
 Release the previously allocated guard condition that manages the signal handler. More...
 
bool sleep_for (const std::chrono::nanoseconds &nanoseconds)
 Use the global condition variable to block for the specified amount of time. More...
 

Function Documentation

§ init()

void rclcpp::utilities::init ( int  argc,
char *  argv[] 
)

Initialize communications via the rmw implementation and set up a global signal handler.

Parameters
[in]argcNumber of arguments.
[in]argvArgument vector. Will eventually be used for passing options to rclcpp.

§ ok()

bool rclcpp::utilities::ok ( )

Check rclcpp's status.

Returns
True if SIGINT hasn't fired yet, false otherwise.

§ shutdown()

void rclcpp::utilities::shutdown ( )

Notify the signal handler and rmw that rclcpp is shutting down.

§ on_shutdown()

void rclcpp::utilities::on_shutdown ( std::function< void(void)>  callback)

Register a function to be called when shutdown is called.

Calling the callbacks is the last thing shutdown() does.

§ get_sigint_guard_condition()

rcl_guard_condition_t* rclcpp::utilities::get_sigint_guard_condition ( rcl_wait_set_t waitset)

Get a handle to the rmw guard condition that manages the signal handler.

The first time that this function is called for a given waitset a new guard condition will be created and returned; thereafter the same guard condition will be returned for the same waitset. This mechanism is designed to ensure that the same guard condition is not reused across waitsets (e.g., when using multiple executors in the same process). Will throw an exception if initialization of the guard condition fails.

Parameters
waitsetPointer to the rcl_wait_set_t that will be using the resulting guard condition.
Returns
Pointer to the guard condition.

§ release_sigint_guard_condition()

void rclcpp::utilities::release_sigint_guard_condition ( rcl_wait_set_t waitset)

Release the previously allocated guard condition that manages the signal handler.

If you previously called get_sigint_guard_condition() for a given waitset to get a sigint guard condition, then you should call release_sigint_guard_condition() when you're done, to free that condition. Will throw an exception if get_sigint_guard_condition() wasn't previously called for the given waitset.

Parameters
waitsetPointer to the rcl_wait_set_t that was using the resulting guard condition.

§ sleep_for()

bool rclcpp::utilities::sleep_for ( const std::chrono::nanoseconds nanoseconds)

Use the global condition variable to block for the specified amount of time.

Parameters
[in]nanosecondsA std::chrono::duration representing how long to sleep for.
Returns
True if the condition variable did not timeout.