foxglove / ros-foxglove-bridge

Foxglove WebSocket bridge for ROS 1 and ROS 2
MIT License
168 stars 75 forks source link

[WIP] ROS 2 JSON publishing support #288

Closed jhurliman closed 4 months ago

jhurliman commented 9 months ago

Public-Facing Changes

Description

This PR vendors in the unpublished https://github.com/LOEWE-emergenCITY/ros2_babel_fish library and uses it to support JSON message publishing from WebSocket clients. Incoming JSON messages are parsed, transformed into native ROS 2 messages field-by-field, then published to the ROS 2 graph.

TODO

jhurliman commented 7 months ago

It would be nice if we could avoid having to copy all the babel fish code. The humble release is currently blocked tho (see LOEWE-emergenCITY/ros2_babel_fish#7).

"Currently" is underselling it. Now that this module has been superseded by native ROS 2 API methods in Iron+, it is deprecated and will never be released.

Maybe we could also avoid copying all that code with some git submodule / cmake magic?

My understanding is git submodules and cmake magic are generally frowned upon for ROS / ROS 2 projects that will be built and distributed in the ROS build system and third party developers. If you have a reference example in mind I can take a look.

In general, this approach (with babel fish) should also work for more recent distros (iron, rolling), right?

No, babel fish does not build in Iron+ and has been replaced by API methods. It will require a different (albeit better) approach.

achim-k commented 7 months ago

Maybe we could also avoid copying all that code with some git submodule / cmake magic?

My understanding is git submodules and cmake magic are generally frowned upon for ROS / ROS 2 projects that will be built and distributed in the ROS build system and third party developers. If you have a reference example in mind I can take a look.

The mcap_vendor package uses FetchContent: https://github.com/ros2/rosbag2/blob/bee10b49e6946c9467a421898100f5c93a49b246/mcap_vendor/CMakeLists.txt#L35-L47

StefanFabian commented 6 months ago

In general, this approach (with babel fish) should also work for more recent distros (iron, rolling), right?

No, babel fish does not build in Iron+ and has been replaced by API methods. It will require a different (albeit better) approach.

Just read this by chance and would like to say that it does in fact build in jazzy after some small changes addressing API changes. I'm also interested in the API methods that replace its functionality as I couldn't find anything about that. There's a GenericSubscription and GenericPublisher now but they seem to only work with raw data messages which is the smallest issue ros2_babel_fish had to solve. You still have to load the required message library and use the introspection api (which has been around since foxy or earlier) to interpret these messages which is the main challenge ros2_babel_fish is simplifying. If there's an easier API now, I would be very interested in that.

facontidavide commented 6 months ago

What is blocking this PR from being merged? @StefanFabian correct me if I am wrong, but ros2_bable_fish haven't been released as a package, right? Maybe we should start fixing that?

StefanFabian commented 6 months ago

No, it hasn't been released yet. As jazzy is the first distro (except for foxy which I find kind of funny) where my fixes are merged (or LTS distro, not sure if it's already in Iron), I didn't release it for the older distros. We are starting the switch to ROS2 in our team this week and I will prepare the release in the next weeks. I can also release it for the older distros when I do so, you don't need the part affected by the PRs anyway.

defunctzombie commented 4 months ago

Replaced by https://github.com/foxglove/ros-foxglove-bridge/pull/307