Skip to content

Commit 706fe97

Browse files
committed
Update
1 parent 76f60d1 commit 706fe97

4 files changed

Lines changed: 42 additions & 13 deletions

File tree

_data/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
- tutorials/programming_rcl_rclc/pub_sub
7373
- tutorials/programming_rcl_rclc/service
7474
- tutorials/programming_rcl_rclc/parameters
75+
- tutorials/programming_rcl_rclc/executor
7576
- tutorials/programming_rcl_rclc/qos
7677
- tutorials/programming_rcl_rclc/micro-ROS
7778

_docs/tutorials/programming_rcl_rclc/micro-ROS/micro-ROS.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,60 @@ title: micro-ROS utilities
33
permalink: /docs/tutorials/programming_rcl_rclc/micro-ROS/
44
---
55

6-
// TODO
6+
// TODO: Change section name
77

88
- [Time sync](#time-sync)
99
- [Ping agent](#ping-agent)
10+
- [Continous serialization](#continous-serialization)
1011

1112
## Time sync
13+
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).
1215

1316
```c
14-
bool rmw_uros_epoch_synchronized();
15-
int64_t rmw_uros_epoch_millis();
16-
int64_t rmw_uros_epoch_nanos();
17-
rmw_ret_t rmw_uros_sync_session(const int timeout_ms);
18-
```
17+
// Sync timeout
18+
const int timeout_ms = 1000;
19+
20+
// Synchronize time with the agent
21+
rmw_uros_sync_session(timeout_ms);
1922

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+
2031
## 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).
2133
2234
```c
23-
rmw_ret_t rmw_uros_ping_agent(const int timeout_ms, const uint8_t attempts);
35+
// Timeout for each attempt
36+
const int timeout_ms = 1000;
37+
38+
// Number of attemps
39+
const uint8_t attemps = 5;
40+
41+
// Ping the agent
42+
rmw_ret_t ping_result = rmw_uros_ping_agent(timeout_ms, attempts);
43+
44+
if (RMW_RET_OK == ping_result)
45+
{
46+
// micro-ROS Agent is reachable
47+
...
48+
}
49+
else
50+
{
51+
// micro-ROS Agent is not available
52+
...
53+
}
2454
```
2555

26-
- Init options ??
56+
*Note: `rmw_uros_ping_agent` is thread safe.*
2757

28-
- Discovery ??
58+
## Continous serialization
2959

30-
- Continous serialization ??
3160
-```c
3261
void rmw_uros_set_continous_serialization_callbacks(
3362
rmw_publisher_t * publisher,

_docs/tutorials/programming_rcl_rclc/node/node.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ ROS 2 nodes are the main participants on ROS 2 ecosystem. They will communicate
3838
3939
- Create a node with custom options:
4040
41-
// TODO: explain possible options
42-
4341
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:
4442
4543
Foxy: The `rcl_node_options_t` is used to configure the node

_docs/tutorials/programming_rcl_rclc/qos/QoS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ In best effort mode no acknowledgement is needed, the messages sent are expected
4343
4444
## Custom QoS configuration
4545
46+
The user can customize their own QoS using the available `rmw_qos_profile_t` struct:
47+
4648
```c
4749
/// ROS MiddleWare quality of service profile.
4850
typedef struct RMW_PUBLIC_TYPE rmw_qos_profile_t
@@ -66,5 +68,4 @@ typedef struct RMW_PUBLIC_TYPE rmw_qos_profile_t
6668
/// If true, any ROS specific namespacing conventions will be circumvented.
6769
bool avoid_ros_namespace_conventions;
6870
} rmw_qos_profile_t;
69-
7071
```

0 commit comments

Comments
 (0)