Basic PX4 usage with RTPS/ROS2

Hi, we are a small research team from University of Rome Tor Vergata, Italy.
We’d like to ask you some information about some problems we’re facing with PX4-Autopilot.

We’re using PX4-Autopilot on a Pixhawk 4 flight controller.
The Pix is connected with an onboard companion computer via UART.
On the companion there’s ROS 2 Foxy Fitzroy running, and communication with the Pix is established via your microRTPS bridge, so we’re using a _rtps firmware with the embedded microRTPS client and the microRTPS agent runs on the companion PC. The communication works: the “sensor_combined_listener” example runs correctly.
We are facing problems regarding basic flight operations with this architecture, because we are having difficulties finding the right commands to send to the controller, the messages that carry them and the topics on which to publish them.

Our main problems are:

  1. Decativate GPS and use VSLAM pose for EKF fusion. We will not be allowed to use the onboard GPS, nor to have it connected. We can supply position information from a VSLAM software (ORBSLAM2), but we don’t know which messages/agent topics we should use, nor how to disable all failsafes regarding GPS so that we can fly without it. Also, should we supply orientation information for a better EKF fusion? How?

  2. ACKs and status monitoring. We need some confirmations about commands we send to the Pix and their processing result, e.g. if we send the “arm” command, can we get an ACK from the Pix, or do we have to check some parameter? What about other basic flight commands we will send afterwards, e.g. a TrajectorySetpoint message?

  3. Correct arming/disarming sequence. We checked the “offboard-control” example from your documentation: it sends the “arm” command only after 1 second, why is this necessary? Also, testing this in Jmavsim, for some reason we need to start the test program two times because the first time the simulated PX4 does not seem to get the “takeoff” command and returns the warning “Failsafe enabled: No manual control stick input” (we suspect this being only a simulation problem). Considering that we will fly with the onboard companion PC sending position/velocity setpoints, do we have to perform additional initial configuration steps, like setting a flight mode with some other message?

  4. How Path Planning works with microRTPS. We read your documentation (Path Planning Interface | PX4 User Guide) and tried sending a “VehicleTrajectoryWaypoint” message with 5 TrajectoryWaypoints on the “VehicleTrajectoryWaypoint_PubSubTopic” topic with the sitl_rtps firmware running in Jmavsim. The simulated drone does not seem to react in any way. Which additional steps/configuration should we perform to make this feature work? We also tried setting the “COM_OBS_AVOID” parameter to 1 from QGroundControl but the drone doesn’t takeoff with error “Arming denied! Avoidance system not ready”.

Thanks in advance to anyone that will help us.

@AsgardFlightTV hey welcome to the community, looks like you are almost ready to go with your environment and are just having problems getting your drone in the air.

Hi @rroche, thanks for your reply!
Yes we can takeoff, but with GPS enabled and connected which is against the rules of our project, so we must make PX4’s EKF work with vision position estimation only.
Thanks for the documentation link about EKF, we read it and will test it as soon as our VSLAM node is ready (for now we’re trying to get used to the various controls in Jmavsim). About this, we have a couple of questions:

  • Can you confirm that the topic on which we’ll have to publish our position estimation messages is the one named “VehicleVisualOdometry” created by the micrortps_agent?
  • What is the minimum frequency that our messages need to be sent at for EKF to work with computer vision only? This is clearly stated in the link you provided for all other position estimation methods but vision, and is a strict requirement for us since it will tell us if our current companion PC can really do its job.

About the arming sequence yes that point you highlighted in your code is not so clear, and in Jmavsim it does seem to be important since for some reason we need to start your example two times for the arm->takeoff commands to really be received and understood by PX4. Any other input will be extremely helpful.
About status messages, we have another question: we played around a bit with the NuttX console and found the way to get an echo from all uORB topics running on the PX4. How many of those uORB topics are really exposed as ROS 2 topics via the microRTPS bridge?
Lastly we noticed, in Jmavsim, that the drone oscillates a lot and often overshoots a target position, oscillating around it for some time before hovering. Is this due to internal PID controllers parameters that we need to calibrate?
Thanks again for your support.