-
Notifications
You must be signed in to change notification settings - Fork 94
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
Conversation
The `cxx_build` crate does not support proc macro output (see dtolnay/cxx#808), so we have to generate a standard Rust source file instead.
…ging Stream merging based on the cxx crate requires the bridge and the api to share an `ExternalEvents` type, which is only possible if the two bridge modules are defined in the same crate.
Use the subscriber type for downcasting to ensure that the correct type is used. Also, store an unique ID per subscriber to differentiate subscriptions of same type after merging.
02b6141
to
18044f6
Compare
I'm still working on fixing the build on the Windows CI runner, which uses a non-standard target dir. Otherwise, this should be ready for an initial round of testing. I tried a simple example with the turtlesim and both publish and subscribe seem to work. |
18044f6
to
3b1777c
Compare
This should be fixed with 3b1777c. |
For example, the generated struct for the Twist message looks like this: struct Twist final {
::geometry_msgs::Vector3 linear;
::geometry_msgs::Vector3 angular;
bool operator==(Twist const &) const noexcept;
bool operator!=(Twist const &) const noexcept;
using IsRelocatable = ::std::true_type;
}; |
I added some usage instructions in 70fb49b. I think this PR is ready for another round of review. There are still multiple things that we want to improve, but I think it's better to do this in follow-up PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks!
Build and Usage Instructions
Usage Example:
Also part of this PR:
Option<String>
is not FFI-safe.