Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ROS2 bridge support for C++ nodes #425

Merged
merged 33 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f0075d8
Add config option to msg gen macro to output `cxx_bridge` attribute
phil-opp Dec 20, 2023
b9e5e53
Redesign ROS2 message struct generator to support `cxx_bridge`
phil-opp Jan 4, 2024
bd84bab
Fix impl blocks for generated messages
phil-opp Jan 5, 2024
f9cfedc
Move code generation to `msg-gen` crate
phil-opp Jan 5, 2024
4c64cad
Replace proc macro by build script to generate C++ bindings
phil-opp Jan 5, 2024
b5cbea1
Include ros2-bridge header files in `dora-node-api-cxx`
phil-opp Jan 5, 2024
26b463b
Start creating a C++-ROS2 example
phil-opp Jan 5, 2024
d3d6660
Fix building of ros2-bridge dependencies
phil-opp Jan 11, 2024
e818983
Generate topic definitions for all messages types
phil-opp Jan 11, 2024
523d354
Re-export `dora_ros2_bridge` from c++ API to ensure that all symbols …
phil-opp Jan 11, 2024
6153f66
Export function to create ROS2 context
phil-opp Jan 11, 2024
26e78b5
Fix: include generates `messages.cc` file during build
phil-opp Jan 11, 2024
7baecea
Provide functions to create topics and publishers
phil-opp Jan 11, 2024
874ec96
Provide ROS2 publish function to c++
phil-opp Jan 12, 2024
c01880f
Add support for setting QoS from C++
phil-opp Jan 12, 2024
3a62f54
Update c++ ros2 example to trigger random movements
phil-opp Jan 12, 2024
cf7e2b6
Hide method name warnings in generated publish code
phil-opp Jan 12, 2024
2bb5193
Fix ros2-bridge build without `generate-messages` feature again
phil-opp Jan 18, 2024
20434e6
Move c++ ros2 bridge generation to node API crate to allow stream mer…
phil-opp Jan 24, 2024
0d75f53
First implementation of subscription stream merging and downcasting
phil-opp Feb 7, 2024
0074ffd
Refactor C++ ROS2 subscription API to make downcasts work
phil-opp Feb 13, 2024
3e7b73a
Update c++-dataflow example for new event iteration syntax
phil-opp Feb 14, 2024
dc8a794
Fix some dead code warnings
phil-opp Feb 14, 2024
2eeb40b
Fix operator API: Box optional error string since `Option<String>` is…
phil-opp Feb 14, 2024
e8b87f0
Merge branch 'main' into c++-ros2-bridge
phil-opp Feb 14, 2024
de6917a
C++ API: Add back `next_event` function for backwards compatibility
phil-opp Feb 14, 2024
3b1777c
Fix: Respect `CARGO_TARGET_DIR` if set
phil-opp Feb 14, 2024
2d6b5b9
Start documenting C++ node API
phil-opp Feb 14, 2024
da44f75
Run c++ ros2 example on CI
phil-opp Feb 27, 2024
58d13c0
Add missing import
phil-opp Feb 27, 2024
57de697
Update `run.rs` to work with latest master changes
phil-opp Feb 27, 2024
70fb49b
Write usage instructions for C++ ROS2 bridge
phil-opp Feb 27, 2024
f258fbe
Fix Typo
haixuanTao Feb 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ jobs:
# Reset only the turtlesim instance as it is not destroyed at the end of the previous job
source /opt/ros/humble/setup.bash && ros2 service call /reset std_srvs/srv/Empty &
cargo run --example python-ros2-dataflow --features="ros2-examples"
- name: "c++-ros2-dataflow"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
# Reset only the turtlesim instance as it is not destroyed at the end of the previous job
source /opt/ros/humble/setup.bash && ros2 service call /reset std_srvs/srv/Empty &
cargo run --example cxx-ros2-dataflow --features="ros2-examples"

bench:
name: "Bench"
Expand Down
73 changes: 45 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ members = [
"libraries/extensions/dora-record",
"libraries/extensions/ros2-bridge",
"libraries/extensions/ros2-bridge/msg-gen",
"libraries/extensions/ros2-bridge/msg-gen-macro",
"libraries/extensions/ros2-bridge/python",
]

Expand Down Expand Up @@ -59,6 +58,7 @@ dora-runtime = { version = "0.3.2", path = "binaries/runtime" }
dora-daemon = { version = "0.3.2", path = "binaries/daemon" }
dora-coordinator = { version = "0.3.2", path = "binaries/coordinator" }
dora-ros2-bridge = { path = "libraries/extensions/ros2-bridge" }
dora-ros2-bridge-msg-gen = { path = "libraries/extensions/ros2-bridge/msg-gen" }
dora-ros2-bridge-python = { path = "libraries/extensions/ros2-bridge/python" }
arrow = "48.0.0"
arrow-schema = "48.0.0"
Expand Down Expand Up @@ -138,3 +138,8 @@ path = "examples/multiple-daemons/run.rs"
[[example]]
name = "cmake-dataflow"
path = "examples/cmake-dataflow/run.rs"

[[example]]
name = "cxx-ros2-dataflow"
path = "examples/c++-ros2-dataflow/run.rs"
required-features = ["ros2-examples"]
17 changes: 17 additions & 0 deletions apis/c++/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,28 @@ crate-type = ["staticlib"]
[features]
default = ["tracing"]
tracing = ["dora-node-api/tracing"]
ros2-bridge = [
"dep:dora-ros2-bridge",
"dep:dora-ros2-bridge-msg-gen",
"dep:rust-format",
"dep:prettyplease",
"dep:serde",
"dep:serde-big-array",
]

[dependencies]
cxx = "1.0.73"
dora-node-api = { workspace = true }
eyre = "0.6.8"
dora-ros2-bridge = { workspace = true, optional = true }
futures-lite = { version = "2.2" }
serde = { version = "1.0.164", features = ["derive"], optional = true }
serde-big-array = { version = "0.5.1", optional = true }

[build-dependencies]
cxx-build = "1.0.73"
dora-ros2-bridge-msg-gen = { workspace = true, optional = true }
rust-format = { version = "0.3.4", features = [
"pretty_please",
], optional = true }
prettyplease = { version = "0.1", features = ["verbatim"], optional = true }
Loading
Loading