Skip to content

Commit

Permalink
Finish GraphCache implementation for Pub/Sub (#66)
Browse files Browse the repository at this point in the history
* Add storage plugin config to router config

Signed-off-by: Yadunund <[email protected]>

* Fix non empty node namespace

Signed-off-by: Yadunund <[email protected]>

* Rely on unordered_map instead of yaml for graph cache

Signed-off-by: Yadunund <[email protected]>

* Update graph cache with publisher data

Signed-off-by: Yadunund <[email protected]>

* Implement basic publisher introspection

Signed-off-by: Yadunund <[email protected]>

* Switch to liveliness tokens (#67)

* Switch to liveliness tokens

Signed-off-by: Yadunund <[email protected]>

* Use zc APIs instead of macros to resolve liveliness api issues

Signed-off-by: Yadunund <[email protected]>

---------

Signed-off-by: Yadunund <[email protected]>

* Cleanup yaml-cpp

Signed-off-by: Yadunund <[email protected]>

* Cleanup previous graph cache impl

Signed-off-by: Yadunund <[email protected]>

* Refactor topic cache

Signed-off-by: Yadunund <[email protected]>

* Implement liveliness tokens for subscriptions and update graph

Signed-off-by: Yadunund <[email protected]>

* Fix types and type mangling.

When playing around with this I found that the types
weren't being properly filled in, and also weren't being
demangled.  Fix both of those things here, as well
as do a lot of cleanup.

Signed-off-by: Chris Lalancette <[email protected]>

* Update README

Signed-off-by: Yadunund <[email protected]>

---------

Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Chris Lalancette <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
  • Loading branch information
Yadunund and clalancette committed Jan 12, 2024
1 parent 29a6f7f commit 3b62ea4
Show file tree
Hide file tree
Showing 10 changed files with 693 additions and 364 deletions.
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Build `rmw_zenoh_cpp`

```bash
mkdir ~/ws_rmw_zenoh/src -p && cd ~/ws_rmw_zenoh/src
git clone git@github.com:ros2/rmw_zenoh.git
git clone https://github.com/ros2/rmw_zenoh.git
cd ~/ws_rmw_zenoh
source /opt/ros/<DISTRO>/setup.bash # replace <DISTRO> with ROS 2 distro of choice
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Expand All @@ -34,25 +34,42 @@ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

## Test

Source workspace
Make sure to source the built workspace using the commands below prior to running any other commands.
```bash
cd ~/ws_rmw_zenoh
source install/setup.bash
```

In a terminal launch Zenoh router:
### Start the zenoh router
> Note: Manually launching zenoh router won't be necessary in the future.
```bash
# terminal 1
ros2 run rmw_zenoh_cpp init_rmw_zenoh_router
```
> Note: Manually launching zenoh router won't be necessary in the future.

In a different terminal source install folder and execute:
> Note: Without the zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the zenoh router's gossip functionality. See more information on the session configs [below](#config).
### Run the `talker`
```bash
# terminal 2
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
ros2 run demo_nodes_cpp talker
```
> Note: Ignore all the warning printouts.
### Run the `listener`
```bash
# terminal 2
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
ros2 topic pub "/chatter" std_msgs/msg/String '{data: hello}'
ros2 run demo_nodes_cpp listener
```

The listener node should start receiving messages over the `/chatter` topic.
> Note: Ignore all the warning printouts.
### Graph introspection
Presently we only support limited `ros2cli` commands to introspect the ROS graph such as `ros2 node list` and `ros2 topic list`.

## Config
The [default configuration](rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5) sets up the zenoh sessions with the following main characteristics:

Expand All @@ -69,7 +86,7 @@ A custom configuration may be provided by setting the `RMW_ZENOH_CONFIG_FILE` en

## TODO Features
- [x] Publisher
- [ ] Subscription
- [x] Subscription
- [ ] Client
- [ ] Service
- [ ] Graph introspection
2 changes: 0 additions & 2 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ find_package(rcutils REQUIRED)
find_package(rosidl_typesupport_fastrtps_c REQUIRED)
find_package(rosidl_typesupport_fastrtps_cpp REQUIRED)
find_package(rmw REQUIRED)
find_package(yaml_cpp_vendor REQUIRED)
find_package(zenoh_c_vendor REQUIRED)
find_package(zenohc REQUIRED)

Expand Down Expand Up @@ -57,7 +56,6 @@ target_link_libraries(rmw_zenoh_cpp
rosidl_typesupport_fastrtps_c::rosidl_typesupport_fastrtps_c
rosidl_typesupport_fastrtps_cpp::rosidl_typesupport_fastrtps_cpp
rmw::rmw
yaml-cpp
zenohc::lib
)

Expand Down
3 changes: 2 additions & 1 deletion rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
/// This option does not make LowLatency transport mandatory, the actual implementation of transport
/// used will depend on Establish procedure and other party's settings
///
/// NOTE: Currently, the LowLatency transport doesn't preserve QoS prioritization.
/// NOTE: Currently, the LowLatency transport doesn't preserve QoS prioritization.
/// NOTE: Due to the note above, 'lowlatency' is incompatible with 'qos' option, so in order to
/// enable 'lowlatency' you need to explicitly disable 'qos'.
lowlatency: false,
Expand Down Expand Up @@ -258,4 +258,5 @@
write: false,
},
},

}
1 change: 0 additions & 1 deletion rmw_zenoh_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<depend>rosidl_typesupport_fastrtps_c</depend>
<depend>rosidl_typesupport_fastrtps_cpp</depend>
<depend>rmw</depend>
<depend>yaml_cpp_vendor</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
Loading

0 comments on commit 3b62ea4

Please sign in to comment.