micro-ROS Utils

micro-ROS Types Utilities

Functions

  Name
MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_utilities_type_info(const rosidl_message_type_support_t * type_support)
Returns a string with the type instronspection data.
MICRO_ROS_UTILITIES_PUBLIC size_t micro_ros_utilities_get_dynamic_size(const rosidl_message_type_support_t * type_support, const micro_ros_utilities_memory_conf_t conf)
Returns the dynamic memory size that will be used for a type.
MICRO_ROS_UTILITIES_PUBLIC size_t micro_ros_utilities_get_static_size(const rosidl_message_type_support_t * type_support, const micro_ros_utilities_memory_conf_t conf)
Returns the static memory size that will be used for a type.
MICRO_ROS_UTILITIES_PUBLIC bool micro_ros_utilities_create_message_memory(const rosidl_message_type_support_t * type_support, void * ros_msg, const micro_ros_utilities_memory_conf_t conf)
Allocates the dynamic memory required for a message.
MICRO_ROS_UTILITIES_PUBLIC bool micro_ros_utilities_create_static_message_memory(const rosidl_message_type_support_t * type_support, void * ros_msg, const micro_ros_utilities_memory_conf_t conf, uint8_t * buffer, size_t buffer_len)
Allocates the memory required for a message in a user-provided buffer.
MICRO_ROS_UTILITIES_PUBLIC bool micro_ros_utilities_destroy_message_memory(const rosidl_message_type_support_t * type_support, void * ros_msg, const micro_ros_utilities_memory_conf_t conf)
Deallocates the dynamic memory of a message.

Functions Documentation

function micro_ros_utilities_type_info

MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_utilities_type_info(
    const rosidl_message_type_support_t * type_support
)

Returns a string with the type instronspection data.

Parameters:

  • type_support ROS 2 typesupport

Return: rosidl_runtime_c__String string containing data


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_utilities_get_dynamic_size

MICRO_ROS_UTILITIES_PUBLIC size_t micro_ros_utilities_get_dynamic_size(
    const rosidl_message_type_support_t * type_support,
    const micro_ros_utilities_memory_conf_t conf
)

Returns the dynamic memory size that will be used for a type.

Parameters:

  • type_support ROS 2 typesupport
  • conf Utils configurator

Return: size_t Size in Bytes that will be used


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_utilities_get_static_size

MICRO_ROS_UTILITIES_PUBLIC size_t micro_ros_utilities_get_static_size(
    const rosidl_message_type_support_t * type_support,
    const micro_ros_utilities_memory_conf_t conf
)

Returns the static memory size that will be used for a type.

Parameters:

  • type_support ROS 2 typesupport
  • conf Utils configurator

Return: size_t Size in Bytes that will be used


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_utilities_create_message_memory

MICRO_ROS_UTILITIES_PUBLIC bool micro_ros_utilities_create_message_memory(
    const rosidl_message_type_support_t * type_support,
    void * ros_msg,
    const micro_ros_utilities_memory_conf_t conf
)

Allocates the dynamic memory required for a message.

Parameters:

  • type_support ROS 2 typesupport
  • ros_msg ROS 2 msg with no type
  • conf Utils configurator

Return: bool true if success


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_utilities_create_static_message_memory

MICRO_ROS_UTILITIES_PUBLIC bool micro_ros_utilities_create_static_message_memory(
    const rosidl_message_type_support_t * type_support,
    void * ros_msg,
    const micro_ros_utilities_memory_conf_t conf,
    uint8_t * buffer,
    size_t buffer_len
)

Allocates the memory required for a message in a user-provided buffer.

Parameters:

  • type_support ROS 2 typesupport
  • ros_msg ROS 2 msg with no type
  • conf Utils configurator
  • buffer User buffer
  • buffer_len User buffer length

Return: bool true if success


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_utilities_destroy_message_memory

MICRO_ROS_UTILITIES_PUBLIC bool micro_ros_utilities_destroy_message_memory(
    const rosidl_message_type_support_t * type_support,
    void * ros_msg,
    const micro_ros_utilities_memory_conf_t conf
)

Deallocates the dynamic memory of a message.

Parameters:

  • type_support ROS 2 typesupport
  • ros_msg ROS 2 msg with no type
  • conf Utils configurator

Return: bool true if success


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

micro-ROS String Utilities

Functions

  Name
MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_string_utilities_init(const char * data)
Create a rosidl_runtime_c__String from a char pointer.
MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_string_utilities_set(rosidl_runtime_c__String str, const char * data)
Create a rosidl_runtime_c__String from a char pointer.
const MICRO_ROS_UTILITIES_PUBLIC char * micro_ros_string_utilities_get_c_str(rosidl_runtime_c__String str)
Returns the char pointer to the rosidl_runtime_c__String data.
rosidl_runtime_c__String micro_ros_string_utilities_append(rosidl_runtime_c__String str, const char * data)
Appends a char pointer to the end of a rosidl_runtime_c__String.
MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_string_utilities_remove_tail_chars(rosidl_runtime_c__String str, const size_t n)
Removes characters from the end of a string.
MICRO_ROS_UTILITIES_PUBLIC void micro_ros_string_utilities_destroy(rosidl_runtime_c__String * str)
Destroys a rosidl_runtime_c__String.

Functions Documentation

function micro_ros_string_utilities_init

MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_string_utilities_init(
    const char * data
)

Create a rosidl_runtime_c__String from a char pointer.

Parameters:

  • data char pointer

Return: rosidl_runtime_c__String string containing data


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_string_utilities_set

MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_string_utilities_set(
    rosidl_runtime_c__String str,
    const char * data
)

Create a rosidl_runtime_c__String from a char pointer.

Parameters:

  • str rosidl_runtime_c__String to set
  • data char pointer

Return: rosidl_runtime_c__String string containing data


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_string_utilities_get_c_str

const MICRO_ROS_UTILITIES_PUBLIC char * micro_ros_string_utilities_get_c_str(
    rosidl_runtime_c__String str
)

Returns the char pointer to the rosidl_runtime_c__String data.

Parameters:

  • str a rosidl_runtime_c__String

Return: const char char pointer


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_string_utilities_append

rosidl_runtime_c__String micro_ros_string_utilities_append(
    rosidl_runtime_c__String str,
    const char * data
)

Appends a char pointer to the end of a rosidl_runtime_c__String.

Parameters:

  • str a rosidl_runtime_c__String
  • data characters to append

Return: rosidl_runtime_c__String new string


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_string_utilities_remove_tail_chars

MICRO_ROS_UTILITIES_PUBLIC rosidl_runtime_c__String micro_ros_string_utilities_remove_tail_chars(
    rosidl_runtime_c__String str,
    const size_t n
)

Removes characters from the end of a string.

Parameters:

  • str a rosidl_runtime_c__String
  • n number of characters to remove

Return: rosidl_runtime_c__String new string


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes

function micro_ros_string_utilities_destroy

MICRO_ROS_UTILITIES_PUBLIC void micro_ros_string_utilities_destroy(
    rosidl_runtime_c__String * str
)

Destroys a rosidl_runtime_c__String.

Parameters:

  • str a rosidl_runtime_c__String

Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes