Function rcl_ros_clock_init

Function Documentation

rcl_ret_t rcl_ros_clock_init(rcl_clock_t *clock, rcl_allocator_t *allocator)

Initialize a clock as a RCL_ROS_TIME time source.

This will allocate all necessary internal structures, and initialize variables. It is specifically setting up a RCL_ROS_TIME time source.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No [1]

Uses Atomics

No

Lock-Free

Yes

[2] Function is reentrant, but concurrent calls on the same object are not safe. Thread-safety is also affected by that of the object.

Parameters:
  • clock[in] the handle to the clock which is being initialized

  • allocator[in] The allocator to use for allocations

Returns:

RCL_RET_OK if the time source was successfully initialized, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_BAD_ALLOC if allocating memory failed, or

Returns:

RCL_RET_ERROR an unspecified error occur.