PX4-ROS2 VIO navigation in GPS denied condition

HI guys,

I’m trying to replicate what has been already done for ROS with MAVROS, but this time with ROS2, having a pose external source (T265, ecc…) replacing the GPS.
I’ve already configured the system, installing on a RPi, ROS2 and Fast DDS, checking that everithing worked as described in https://docs.px4.io/master/en/ros/ros2_comm.html.

The sw setup is made up by 2 nodes:

  • the offboard node (the same in px4_ros_com package) to set the offboard node, arming and sending position commands
  • the second node simply takes the data coming from the external source and publish on the topic /fmu/vehicle_visual_odometry/in

I’ve also set two parameters:

  • EKF2_AID_MASK: 24 (external position + external yaw)
  • EKF2_HGT_MODE: 3 (vision)
  • CBRK_GPSFAIL: 240024 (ignoring GPS)

Since the controllor does not pass to offboard mode, but remain in stabilize mode, I’m wondering what I am missing.
I remember that the ROS implementation there is also a node (set_origin.py) which sends (through mavros) messages to mavlink, containing the cooridnates of the starting point (MAVLink_set_gps_global_origin_message and MAVLink_set_home_position_message). If this is the problem, there is a way to solve it on ROS2, since apparently there is no topic related to it?

Issue solved, after learning how PX4 works with ROS2

Hey, have you managed to fly using only the topic /fmu/vehicle_visual_odometry/in?

I just ordered a Pixhawk 5x and will try to build on it and try to fly the drone.

Could you describe approximately how you did it with the ROS2-PX4 bridge?

Hi, yes sure, I’ll try to be as clear as possible.
Before starting, you need to follow the official procedure ROS 2 User Guide to correctly set your environment.

Essentially you need these nodes:

  • a node that takes the pose data coming from the external source (like the RealSense T265) and passes to the PX4 topic /fmu/vehicle_visual_odometry/in, with the specific message type px4_msgs::msg::VehicleVisualOdometry which is located in px4_msgs (you have to take a look over it if you want to know how to fill the message fields)
  • a node similar to the example provided by pxf (px4_offboard inside px4_ros_com) which publishes positions (or velocities) commands to the controller; also in this case, I suggest to take a look over the messages definitions if you want to better understand).

Finally you have to set up PX4 parameters in addition of the ones I posted above:

  • NAV_RCL_ACT: 0
  • NAV_DLL_ACT: 0
  • COM_OBL_ACT: 1 (optional)

I’m not sure these parameters are all required, but it worked for me