You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
micro-ROS Clients can synchronize their epoch time with the connected Agent, this can be very useful when working in embedded environments that do not provide any time synchronization mechanism.
14
+
This utility is based on the NTP protocol, taking into account delays caused by the transport layer. An usage example can be found on [`micro-ROS-demos/rclc/epoch_synchronization`](https://github.com/micro-ROS/micro-ROS-demos/blob/galactic/rclc/epoch_synchronization/main.c).
12
15
13
16
```c
14
-
boolrmw_uros_epoch_synchronized();
15
-
int64_trmw_uros_epoch_millis();
16
-
int64_trmw_uros_epoch_nanos();
17
-
rmw_ret_trmw_uros_sync_session(const int timeout_ms);
18
-
```
17
+
// Sync timeout
18
+
constint timeout_ms = 1000;
19
+
20
+
// Synchronize time with the agent
21
+
rmw_uros_sync_session(timeout_ms);
19
22
23
+
if (rmw_uros_epoch_synchronized())
24
+
{
25
+
// Get time in milliseconds or nanoseconds
26
+
int64_t time_ms = rmw_uros_epoch_millis();
27
+
int64_t time_ns = rmw_uros_epoch_nanos();
28
+
}
29
+
```
30
+
20
31
## Ping agent
32
+
The Client can test the connection with the Agent with the ping utility. This functionality can be used even when the micro-ROS context has not yet been initialized, which is useful to test the connection before trying to connect to the Agent. An example can be found on [`micro-ROS-demos/rclc/ping_uros_agent`](https://github.com/micro-ROS/micro-ROS-demos/blob/galactic/rclc/ping_uros_agent/main.c).
21
33
22
34
```c
23
-
rmw_ret_t rmw_uros_ping_agent(const int timeout_ms, const uint8_t attempts);
Copy file name to clipboardExpand all lines: _docs/tutorials/programming_rcl_rclc/node/node.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,6 @@ ROS 2 nodes are the main participants on ROS 2 ecosystem. They will communicate
38
38
39
39
- Create a node with custom options:
40
40
41
-
// TODO: explain possible options
42
-
43
41
The configuration of the node will also be applied to its future elements (Publishers, subscribers, services, ...).The API used to customize the node options differs between ROS2 distributions:
44
42
45
43
Foxy: The `rcl_node_options_t` is used to configure the node
0 commit comments