|
| 1 | +# micro-ROS RMW API |
| 2 | + |
| 3 | +TODO. |
| 4 | + |
| 5 | +## Functions |
| 6 | + |
| 7 | +| | Name | |
| 8 | +| -------------- | -------------- | |
| 9 | +| void | **[rmw_uros_set_continous_serialization_callbacks](#function-rmw_uros_set_continous_serialization_callbacks)**(rmw_publisher_t * publisher, rmw_uros_continous_serialization_size size_cb, rmw_uros_continous_serialization serialization_cb)<br>Sets the callback functions for continous serialization for a publisher. | |
| 10 | +| rmw_ret_t | **[rmw_uros_set_custom_transport](#function-rmw_uros_set_custom_transport)**(bool framing, void * args, open_custom_func open_cb, close_custom_func close_cb, write_custom_func write_cb, read_custom_func read_cb)<br>Check if micro-ROS Agent answers to micro-ROS client. | |
| 11 | +| rmw_ret_t | **[rmw_uros_discover_agent](#function-rmw_uros_discover_agent)**(rmw_init_options_t * rmw_options)<br>Fills rmw implementation-specific options with the autodicovered address of an micro-ROS Agent. | |
| 12 | +| rmw_ret_t | **[rmw_uros_init_options](#function-rmw_uros_init_options)**(int argc, const char *const argv[], rmw_init_options_t * rmw_options)<br>Parses command line args and fills rmw implementation-specific options. | |
| 13 | +| rmw_ret_t | **[rmw_uros_options_set_serial_device](#function-rmw_uros_options_set_serial_device)**(const char * dev, rmw_init_options_t * rmw_options)<br>Fills rmw implementation-specific options with the given parameters. | |
| 14 | +| rmw_ret_t | **[rmw_uros_options_set_udp_address](#function-rmw_uros_options_set_udp_address)**(const char * ip, const char * port, rmw_init_options_t * rmw_options)<br>Fills rmw implementation-specific options with the given parameters. | |
| 15 | +| rmw_ret_t | **[rmw_uros_options_set_client_key](#function-rmw_uros_options_set_client_key)**(uint32_t client_key, rmw_init_options_t * rmw_options)<br>Fills rmw implementation-specific options with the given parameters. | |
| 16 | +| rmw_ret_t | **[rmw_uros_ping_agent](#function-rmw_uros_ping_agent)**(const int timeout_ms, const uint8_t attempts)<br>Check if micro-ROS Agent is up and running. | |
| 17 | +| bool | **[rmw_uros_epoch_synchronized](#function-rmw_uros_epoch_synchronized)**()<br>Returns the time synchronization state of the epoch time. | |
| 18 | +| int64_t | **[rmw_uros_epoch_millis](#function-rmw_uros_epoch_millis)**()<br>Returns the epoch time in milliseconds taking into account the offset computed during the time synchronization. | |
| 19 | +| int64_t | **[rmw_uros_epoch_nanos](#function-rmw_uros_epoch_nanos)**()<br>Returns the epoch time in nanoseconds taking into account the offset computed during the time synchronization. | |
| 20 | +| rmw_ret_t | **[rmw_uros_sync_session](#function-rmw_uros_sync_session)**(const int timeout_ms)<br>Synchronizes the session time using the NTP protocol. | |
| 21 | + |
| 22 | + |
| 23 | +## Functions Documentation |
| 24 | + |
| 25 | +### function rmw_uros_set_continous_serialization_callbacks |
| 26 | + |
| 27 | +```cpp |
| 28 | +void rmw_uros_set_continous_serialization_callbacks( |
| 29 | + rmw_publisher_t * publisher, |
| 30 | + rmw_uros_continous_serialization_size size_cb, |
| 31 | + rmw_uros_continous_serialization serialization_cb |
| 32 | +) |
| 33 | +``` |
| 34 | + |
| 35 | +Sets the callback functions for continous serialization for a publisher. |
| 36 | + |
| 37 | +**Parameters**: |
| 38 | + |
| 39 | + * **publisher** publisher where continous serialization is being configured |
| 40 | + * **size_cb** callback that should modify the total serialization size |
| 41 | + * **serialization_cb** callback that should serialize the user part of the message |
| 42 | + |
| 43 | + |
| 44 | +### function rmw_uros_set_custom_transport |
| 45 | + |
| 46 | +```cpp |
| 47 | +rmw_ret_t rmw_uros_set_custom_transport( |
| 48 | + bool framing, |
| 49 | + void * args, |
| 50 | + open_custom_func open_cb, |
| 51 | + close_custom_func close_cb, |
| 52 | + write_custom_func write_cb, |
| 53 | + read_custom_func read_cb |
| 54 | +) |
| 55 | +``` |
| 56 | + |
| 57 | +Check if micro-ROS Agent answers to micro-ROS client. |
| 58 | + |
| 59 | +**Parameters**: |
| 60 | + |
| 61 | + * **framing** Enable XRCE framing. |
| 62 | + * **args** Arguments for open function. |
| 63 | + * **open_cb** Open transport callback. |
| 64 | + * **close_cb** Close transport callback. |
| 65 | + * **write_cb** Write transport callback. |
| 66 | + * **read_cb** Read transport callback. |
| 67 | + |
| 68 | + |
| 69 | +**Return**: |
| 70 | + |
| 71 | + * RMW_RET_OK If correct. |
| 72 | + * RMW_RET_ERROR If invalid. |
| 73 | + |
| 74 | + |
| 75 | +### function rmw_uros_discover_agent |
| 76 | + |
| 77 | +```cpp |
| 78 | +rmw_ret_t rmw_uros_discover_agent( |
| 79 | + rmw_init_options_t * rmw_options |
| 80 | +) |
| 81 | +``` |
| 82 | + |
| 83 | +Fills rmw implementation-specific options with the autodicovered address of an micro-ROS Agent. |
| 84 | + |
| 85 | +**Parameters**: |
| 86 | + |
| 87 | + * **rmw_options** Updated options with rmw specifics. |
| 88 | + |
| 89 | + |
| 90 | +**Return**: |
| 91 | + |
| 92 | + * RMW_RET_OK If arguments were valid and set in rmw_init_options. |
| 93 | + * RMW_RET_TIMEOUT If micro-ROS agent autodiscovery is timeout. |
| 94 | + * RMW_RET_INVALID_ARGUMENT If rmw_init_options is not valid or unexpected arguments. |
| 95 | + |
| 96 | + |
| 97 | +### function rmw_uros_init_options |
| 98 | + |
| 99 | +```cpp |
| 100 | +rmw_ret_t rmw_uros_init_options( |
| 101 | + int argc, |
| 102 | + const char *const argv[], |
| 103 | + rmw_init_options_t * rmw_options |
| 104 | +) |
| 105 | +``` |
| 106 | + |
| 107 | +Parses command line args and fills rmw implementation-specific options. |
| 108 | + |
| 109 | +**Parameters**: |
| 110 | + |
| 111 | + * **argc** Number of arguments. |
| 112 | + * **argv** Arguments. |
| 113 | + * **rmw_options** Updated options with rmw specifics. |
| 114 | + |
| 115 | + |
| 116 | +**Return**: |
| 117 | + |
| 118 | + * RMW_RET_OK If arguments were valid and set in rmw_init_options. |
| 119 | + * RMW_RET_INVALID_ARGUMENT If rmw_init_options is not valid or unexpected arguments. |
| 120 | + |
| 121 | + |
| 122 | +`rmw_init_options allocator` is used to allocate the specific rmw options. |
| 123 | + |
| 124 | + |
| 125 | +### function rmw_uros_options_set_serial_device |
| 126 | + |
| 127 | +```cpp |
| 128 | +rmw_ret_t rmw_uros_options_set_serial_device( |
| 129 | + const char * dev, |
| 130 | + rmw_init_options_t * rmw_options |
| 131 | +) |
| 132 | +``` |
| 133 | + |
| 134 | +Fills rmw implementation-specific options with the given parameters. |
| 135 | + |
| 136 | +**Parameters**: |
| 137 | + |
| 138 | + * **dev** Serial device. |
| 139 | + * **rmw_options** Updated options with rmw specifics. |
| 140 | + |
| 141 | + |
| 142 | +**Return**: |
| 143 | + |
| 144 | + * RMW_RET_OK If arguments were valid and set in rmw_init_options. |
| 145 | + * RMW_RET_INVALID_ARGUMENT If rmw_init_options is not valid or unexpected arguments. |
| 146 | + |
| 147 | + |
| 148 | +### function rmw_uros_options_set_udp_address |
| 149 | + |
| 150 | +```cpp |
| 151 | +rmw_ret_t rmw_uros_options_set_udp_address( |
| 152 | + const char * ip, |
| 153 | + const char * port, |
| 154 | + rmw_init_options_t * rmw_options |
| 155 | +) |
| 156 | +``` |
| 157 | + |
| 158 | +Fills rmw implementation-specific options with the given parameters. |
| 159 | + |
| 160 | +**Parameters**: |
| 161 | + |
| 162 | + * **ip** Agent IP address. |
| 163 | + * **port** Agent UDP port. |
| 164 | + * **rmw_options** Updated options with rmw specifics. |
| 165 | + |
| 166 | + |
| 167 | +**Return**: |
| 168 | + |
| 169 | + * RMW_RET_OK If arguments were valid and set in rmw_init_options. |
| 170 | + * RMW_RET_INVALID_ARGUMENT If rmw_init_options is not valid or unexpected arguments. |
| 171 | + |
| 172 | + |
| 173 | +### function rmw_uros_options_set_client_key |
| 174 | + |
| 175 | +```cpp |
| 176 | +rmw_ret_t rmw_uros_options_set_client_key( |
| 177 | + uint32_t client_key, |
| 178 | + rmw_init_options_t * rmw_options |
| 179 | +) |
| 180 | +``` |
| 181 | + |
| 182 | +Fills rmw implementation-specific options with the given parameters. |
| 183 | + |
| 184 | +**Parameters**: |
| 185 | + |
| 186 | + * **client_key** MicroXRCE-DDS client key. |
| 187 | + * **rmw_options** Updated options with rmw specifics. |
| 188 | + |
| 189 | + |
| 190 | +**Return**: |
| 191 | + |
| 192 | + * RMW_RET_OK If arguments were valid and set in rmw_init_options. |
| 193 | + * RMW_RET_INVALID_ARGUMENT If rmw_init_options is not valid or unexpected arguments. |
| 194 | + |
| 195 | + |
| 196 | +### function rmw_uros_ping_agent |
| 197 | + |
| 198 | +```cpp |
| 199 | +rmw_ret_t rmw_uros_ping_agent( |
| 200 | + const int timeout_ms, |
| 201 | + const uint8_t attempts |
| 202 | +) |
| 203 | +``` |
| 204 | + |
| 205 | +Check if micro-ROS Agent is up and running. |
| 206 | + |
| 207 | +**Parameters**: |
| 208 | + |
| 209 | + * **timeout_ms** Timeout in ms (per attempt). |
| 210 | + * **attempts** Number of tries before considering the ping as failed. |
| 211 | + |
| 212 | + |
| 213 | +**Return**: |
| 214 | + |
| 215 | + * RMW_RET_OK If micro-ROS Agent is available. |
| 216 | + * RMW_RET_ERROR If micro-ROS Agent is not available. |
| 217 | + |
| 218 | + |
| 219 | +This function can be called even when the micro-ROS context has not yet been initialized by the application logics. |
| 220 | + |
| 221 | + |
| 222 | +### function rmw_uros_epoch_synchronized |
| 223 | + |
| 224 | +```cpp |
| 225 | +bool rmw_uros_epoch_synchronized() |
| 226 | +``` |
| 227 | + |
| 228 | +Returns the time synchronization state of the epoch time. |
| 229 | + |
| 230 | +**Return**: true if last time synchronization succeded and false otherwise |
| 231 | + |
| 232 | +### function rmw_uros_epoch_millis |
| 233 | + |
| 234 | +```cpp |
| 235 | +int64_t rmw_uros_epoch_millis() |
| 236 | +``` |
| 237 | + |
| 238 | +Returns the epoch time in milliseconds taking into account the offset computed during the time synchronization. |
| 239 | + |
| 240 | +**Return**: |
| 241 | + |
| 242 | + * epoch time in milliseconds. |
| 243 | + * 0 if session is not initialized. |
| 244 | + |
| 245 | + |
| 246 | +### function rmw_uros_epoch_nanos |
| 247 | + |
| 248 | +```cpp |
| 249 | +int64_t rmw_uros_epoch_nanos() |
| 250 | +``` |
| 251 | + |
| 252 | +Returns the epoch time in nanoseconds taking into account the offset computed during the time synchronization. |
| 253 | + |
| 254 | +**Return**: |
| 255 | + |
| 256 | + * epoch time in nanoseconds. |
| 257 | + * 0 if session is not initialized. |
| 258 | + |
| 259 | + |
| 260 | +### function rmw_uros_sync_session |
| 261 | + |
| 262 | +```cpp |
| 263 | +rmw_ret_t rmw_uros_sync_session( |
| 264 | + const int timeout_ms |
| 265 | +) |
| 266 | +``` |
| 267 | + |
| 268 | +Synchronizes the session time using the NTP protocol. |
| 269 | + |
| 270 | +**Parameters**: |
| 271 | + |
| 272 | + * **timeout_ms** The waiting time in milliseconds. |
| 273 | + |
| 274 | + |
| 275 | +**Return**: |
| 276 | + |
| 277 | + * RMW_RET_OK when success. |
| 278 | + * RMW_RET_ERROR If no session is running or the synchronization fails. |
| 279 | + |
| 280 | + |
| 281 | + |
| 282 | + |
| 283 | + |
| 284 | + |
| 285 | +------------------------------- |
0 commit comments