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

    ROS2 to MPA

    ROS
    3
    5
    444
    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
      jmltt
      last edited by 17 Jun 2024, 22:28

      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!

      A 1 Reply Last reply 21 Jun 2024, 15:21 Reply Quote 0
      • A
        Alex Kushleyev ModalAI Team @jmltt
        last edited by 21 Jun 2024, 15:21

        @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 26 Jun 2024, 14:57 Reply Quote 0
        • J
          jmltt @Alex Kushleyev
          last edited by 26 Jun 2024, 14:57

          @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

          A 1 Reply Last reply 26 Jun 2024, 17:01 Reply Quote 0
          • A
            Alex Kushleyev ModalAI Team @jmltt
            last edited by 26 Jun 2024, 17:01

            @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 22 Oct 2024, 13:33 Reply Quote 0
            • T
              tahawaru @Alex Kushleyev
              last edited by 22 Oct 2024, 13:33

              @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
              • First post
                Last post
              Powered by NodeBB | Contributors