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

    Using Mocap with ROS 2 for Starling 2

    Starling & Starling 2
    2
    4
    445
    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.
    • L
      labkit
      last edited by labkit

      The flight cage I am using has an Optitrack motion capture camera system installed that communicates my Starling 2 drone's position data on the LAN using NatNet protocol. I have a ROS 2 package on my computer that can receive this data. I plan to transmit this data to the drone after it has been converted to the appropriate format. By referencing this guide, I see that mocap data should be published to the vehicle_visual_odometry topic. When PX4 is running on the drone, I can access the ROS 2 topic /fmu/in/vehicle_visual_odometry. However,when I publish test data to this topic it does not have any obvious effect. By using the ros2 topic echo command I can see that the data is indeed getting published. However, echoing the /fmu/out commands return nothing, including the commands that are supposed to return the drone's position.

      Publishing to /fmu/in/vehicle_visual_odometry
      02df36e2-67e4-4f42-816d-8c10fe9f589d-image.png

      Listening to /fmu/in/vehicle_visual_odometry while publishing topic
      da3eb454-a2d3-47c0-b8c7-9b04b7fb1d0e-image.png

      Attempting to listen to /fmu/out topics
      e85822f3-0373-459e-bc12-df7999476f03-image.png

      When I disable PX4 with systemctl disable voxl-px4 I am able to view the data from these /fmu/out topics. But still, publishing to vehicle_visual_odometry does not change the /fmu/out readings that display vehicle position.

      Images of /fmu/out commands when not publishing to /fmu/in/vehicle_visual_odometry
      86d3c2e7-4285-414b-b1c0-3a750fc59d0e-image.png

      b5bd5c26-ffee-4646-acf9-f37be9ecb945-image.png

      when publishing to /fmu/in/vehicle_visual_odometry
      72af74a1-9b31-4fa1-9001-1bdb4e017309-image.png

      42fa3eb3-7974-47d5-be38-e7a0afe6dbdc-image.png

      1 Reply Last reply Reply Quote 0
      • Zachary Lowell 0Z
        Zachary Lowell 0 ModalAI Team
        last edited by

        @labkit can you confirm if you have VIO actively going as well? There could be competing information for incoming odometry messages - can you send a screenshot of voxl-inspect-services and then also show what you have for the value of ekf2_ev_ctrl.

        Thanks!
        Zach

        L 1 Reply Last reply Reply Quote 0
        • L
          labkit @Zachary Lowell 0
          last edited by

          @Zachary-Lowell-0 I said yesterday that echoing the /fmu/out topics only worked if voxl-px4 was disabled on startup and run in a terminal with voxl-px4. This no longer appears to be the case, although I don't know what changed from yesterday to cause this. Now ros2 topic echo can print those topics when px4 is launched at startup. However, the topics still don't print the data I would expect if the drone were correctly reading the data I publish to /fmu/in/visual_odometry, unchanged from yesterday.

          The qvio server was on. I disabled it, but that didn't fix the issue of the drone not using the data from /fmu/in/vehicle_visual_odometry. I believe that shutting down this server should disable VIO, correct? This is the output after disabling qvio server and having px4 enabled to launch at startup.
          a73ed027-db6e-4892-ae6d-13dca2712780-image.png

          Here is the output of /fmu/out/vehicle odometry when I am not publishing to /fmu/in/vehicle_visual_odometry
          6de15cf0-ea0d-4103-b0b1-3f4790418efc-image.png

          And here is the output when I am publishing to it using the command topic pub /fmu/in/vehicle_visual_odometry px4_msgs/msg/VehicleOdometry '{timestamp: 1234567890, timestamp_sample: 1, pose_frame: 1, position: [1.23, 4.56, 7.89], q: [0.707, 0.707, 0.0, 0.0], velocity_frame: 1, velocity: [0.5, 1.0, -2.3], angular_velocity: [0.1, 0.2, -0.3], position_variance: [0.01, 0.02, 0.03], orientation_variance: [0.001, 0.002, 0.003], velocity_variance: [0.005, 0.01, 0.02], reset_counter: 0, quality: 1}' which is supposed to provide it with test mocap data.

          90d37817-3739-4f43-ac8b-cd45656ec2cb-image.png

          This is the value of ekf2_ev_ctrl from QGroundControl.
          d29e0b89-eb6c-4a6d-988c-523f3b63b663-image.png

          1 Reply Last reply Reply Quote 0
          • Zachary Lowell 0Z
            Zachary Lowell 0 ModalAI Team
            last edited by

            Understood - ofcourse disabling wont do much as it is the same thing as running it from command line/bash vs in systemd - I am surprised it created different results when running in systemd vs bash.

            Reason I want to disable/stop qvio is so that when you echo the /out topic you arent receiving anything from the ekf2 inside PX4 that is ingesting and creating the output.

            Lastly, the fmu/in/visual_odometry, and fmu/out/visual_odometry are not supposed to be the same - the fmu/out is post processing - they should differ as it fuses all sensor data and such - what is the movement you are expecting?

            Also have you checked the yaml file for PX4 - looks like there is a ros2 message specific just for mocap odometry.

            https://github.com/modalai/px4-firmware/blob/636ffefcb1a96ad2b53e988d23bf6419955b69ea/src/modules/microdds_client/dds_topics.yaml#L73

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB | Contributors