ROS2 to MPA
-
Has anybody implemented something similar to voxl_mpa_to_ros2 that provides data flow in the opposite direction, like subscribing to the uorb topics published by px4 and exposed via ros2 topics and re-publishing them for onboard use over of the MPA? If so would you be able to point me to example code?
I'm brand new to ROS/ROS2 so I'm still trying to run through tutorials and figure out how it all works
Thanks!
-
@jmltt , we have not done this yet. Can you please provide an example of a use case for this functionality? What kind of data would you want to send to VOXL2 via ROS and publish locally on VOXL2 via MPA?
Alex
-
@Alex-Kushleyev the only immediate need I have for this is to subscribe to the vehicle_local_position topic and republish it for use in an offboard controller i'm testing that requires a state estimate for feedback that includes filtered acceleration (PX4 only streams the truncated local position ned data over mavlink). I want to transition from mavlink to ROS-based offboard communications in general though in case there are some random uorb topics I end up needing data from that aren't supported over mavlink.
I don't think there's a wide general need for this, but I need to learn how to do it and since I've never used ROS before I was hoping there was some example code I could look at. I'm sure I can figure it out though looking at the existing voxl-mpa-to-ros2 code
-
@jmltt ,
The mpa publisher functionality is pretty easy:
- create a new pipe using
pipe_server_create
- you need to provide the information about the data you are sending. - publish the data using
pipe_server_write
: https://gitlab.com/voxl-public/voxl-sdk/core-libs/libmodal-pipe/-/blob/master/library/include/modal_pipe_server.h?ref_type=heads#L188 - note that for some data types like images, there are functions like
pipe_server_write_camera_frame
which allow you to publish the image and the metadata in a single call. - also note that you can only publish the supported data types, listed here : https://gitlab.com/voxl-public/voxl-sdk/core-libs/libmodal-pipe/-/blob/master/library/include/modal_pipe_interfaces.h
A simple example of the publisher is embedded into this tool, which creates an ascii version of the image and publishes some stats via mpa: https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/master/tools/voxl-inspect-cam-ascii.cpp?ref_type=heads#L258 . Please note, in this example the code uses pipe channel 0 when creating the pipe - it is better to use
pipe_server_get_next_available_channel()
to get the ID of the channel and then use it when publishing.Alex
- create a new pipe using
-
Please could you provide a simple example like arm() and disarm() or something similar to the offboard_control.cpp?
Best wishes,