rcl  beta1
C API providing common ROS client library functionality.
Typedefs | Functions
graph.h File Reference
#include <rmw/rmw.h>
#include <rmw/types.h>
#include "rosidl_generator_c/service_type_support.h"
#include "rcl/macros.h"
#include "rcl/client.h"
#include "rcl/node.h"
#include "rcl/visibility_control.h"

Go to the source code of this file.

Typedefs

typedef rmw_topic_names_and_types_t rcl_topic_names_and_types_t
 

Functions

rcl_topic_names_and_types_t rcl_get_zero_initialized_topic_names_and_types (void)
 Return a rcl_topic_names_and_types_t struct with members initialized to NULL. More...
 
rcl_ret_t rcl_get_topic_names_and_types (const rcl_node_t *node, rcl_topic_names_and_types_t *topic_names_and_types)
 Return a list of topic names and their types. More...
 
rcl_ret_t rcl_destroy_topic_names_and_types (rcl_topic_names_and_types_t *topic_names_and_types)
 Destroy a struct which was previously given to rcl_get_topic_names_and_types. More...
 
rcl_ret_t rcl_count_publishers (const rcl_node_t *node, const char *topic_name, size_t *count)
 Return the number of publishers on a given topic. More...
 
rcl_ret_t rcl_count_subscribers (const rcl_node_t *node, const char *topic_name, size_t *count)
 Return the number of subscriptions on a given topic. More...
 
rcl_ret_t rcl_service_server_is_available (const rcl_node_t *node, const rcl_client_t *client, bool *is_available)
 Check if a service server is available for the given service client. More...
 

Typedef Documentation

§ rcl_topic_names_and_types_t

Function Documentation

§ rcl_get_zero_initialized_topic_names_and_types()

rcl_topic_names_and_types_t rcl_get_zero_initialized_topic_names_and_types ( void  )

Return a rcl_topic_names_and_types_t struct with members initialized to NULL.

§ rcl_get_topic_names_and_types()

rcl_ret_t rcl_get_topic_names_and_types ( const rcl_node_t node,
rcl_topic_names_and_types_t topic_names_and_types 
)

Return a list of topic names and their types.

This function returns a list of topic names in the ROS graph and their types.

The node parameter must not be NULL, and must point to a valid node.

The topic_names_and_types parameter must be allocated and zero initialized. The topic_names_and_types is the output for this function, and contains allocated memory. Therefore, it should be passed to rcl_destroy_topic_names_and_types() when it is no longer needed. Failing to do so will result in leaked memory.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Maybe [1]

[1] implementation may need to protect the data structure with a lock

Parameters
[in]nodethe handle to the node being used to query the ROS graph
[out]topic_names_and_typeslist of topic names and their types
Returns
RCL_RET_OK if the query was successful, or
RCL_RET_NODE_INVALID if the node is invalid, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.

§ rcl_destroy_topic_names_and_types()

rcl_ret_t rcl_destroy_topic_names_and_types ( rcl_topic_names_and_types_t topic_names_and_types)

Destroy a struct which was previously given to rcl_get_topic_names_and_types.

The topic_names_and_types parameter must not be NULL, and must point to an already allocated rcl_topic_names_and_types_t struct that was previously passed to a successful rcl_get_topic_names_and_types() call.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in,out]topic_names_and_typesstruct to be destroyed
Returns
RCL_RET_OK if successful, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.

§ rcl_count_publishers()

rcl_ret_t rcl_count_publishers ( const rcl_node_t node,
const char *  topic_name,
size_t *  count 
)

Return the number of publishers on a given topic.

This function returns the number of publishers on a given topic.

The node parameter must not be NULL, and must point to a valid node.

The topic_name parameter must not be NULL, and must not be an empty string. It should also follow the topic name rules.

Todo:
TODO(wjwwood): link to the topic name rules.

The count parameter must not be NULL, and must point to a valid bool. The count parameter is the output for this function and will be set.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Maybe [1]

[1] implementation may need to protect the data structure with a lock

Parameters
[in]nodethe handle to the node being used to query the ROS graph
[in]topic_namethe name of the topic in question
[out]countnumber of publishers on the given topic
Returns
RCL_RET_OK if the query was successful, or
RCL_RET_NODE_INVALID if the node is invalid, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.

§ rcl_count_subscribers()

rcl_ret_t rcl_count_subscribers ( const rcl_node_t node,
const char *  topic_name,
size_t *  count 
)

Return the number of subscriptions on a given topic.

This function returns the number of subscriptions on a given topic.

The node parameter must not be NULL, and must point to a valid node.

The topic_name parameter must not be NULL, and must not be an empty string. It should also follow the topic name rules.

Todo:
TODO(wjwwood): link to the topic name rules.

The count parameter must not be NULL, and must point to a valid bool. The count parameter is the output for this function and will be set.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Maybe [1]

[1] implementation may need to protect the data structure with a lock

Parameters
[in]nodethe handle to the node being used to query the ROS graph
[in]topic_namethe name of the topic in question
[out]countnumber of subscriptions on the given topic
Returns
RCL_RET_OK if the query was successful, or
RCL_RET_NODE_INVALID if the node is invalid, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.

§ rcl_service_server_is_available()

rcl_ret_t rcl_service_server_is_available ( const rcl_node_t node,
const rcl_client_t client,
bool *  is_available 
)

Check if a service server is available for the given service client.

This function will return true for is_available if there is a service server available for the given client.

The node parameter must not be NULL, and must point to a valid node.

The client parameter must not be NULL, and must point to a valid client.

The given client and node must match, i.e. the client must have been created using the given node.

The is_available parameter must not be NULL, and must point a bool variable. The result of the check will be stored in the is_available parameter.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Maybe [1]

[1] implementation may need to protect the data structure with a lock

Parameters
[in]nodethe handle to the node being used to query the ROS graph
[in]clientthe handle to the service client being queried
[out]is_availableset to true if there is a service server available, else false
Returns
RCL_RET_OK if the check was made successfully (regardless of the service readiness), or
RCL_RET_NODE_INVALID if the node is invalid, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.