ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    ROS2 to MPA

    Scheduled Pinned Locked Moved ROS
    5 Posts 3 Posters 1.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jmltt
      last edited by

      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!

      Alex KushleyevA 1 Reply Last reply Reply Quote 1
      • Alex KushleyevA Offline
        Alex Kushleyev ModalAI Team @jmltt
        last edited by

        @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

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          jmltt @Alex Kushleyev
          last edited by

          @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

          Alex KushleyevA 1 Reply Last reply Reply Quote 0
          • Alex KushleyevA Offline
            Alex Kushleyev ModalAI Team @jmltt
            last edited by

            @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.
              • https://gitlab.com/voxl-public/voxl-sdk/core-libs/libmodal-pipe/-/blob/master/library/include/modal_pipe_server.h?ref_type=heads#L110
            • 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

            T 1 Reply Last reply Reply Quote 0
            • T Offline
              tahawaru @Alex Kushleyev
              last edited by

              @Alex-Kushleyev

              Please could you provide a simple example like arm() and disarm() or something similar to the offboard_control.cpp?

              Best wishes,

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              Powered by NodeBB | Contributors