The following parameters must be set to use external position information with EKF2 (these can be set in QGroundControl > Vehicle Setup > Parameters > EKF2).
Parameters | Setting for External Position Estimation |
---|---|
UXRCE_DDS_CFG |
a desired port on your flight controller |
ser_tel1_baud |
921600 |
EKF2_EV_CTRL |
Select horizontal position fusion, vertical vision fusion |
EKF2_HGT_REF |
Set to Vision to use the vision as the reference source for altitude estimation. |
EKF2_EV_POS_X,Y,Z |
Set the position of the vision sensor (or UWB tag) with respect to the robot's body frame. |
EKF2_GPS_CTRL |
Disable GPS sensor fusion |
EKF2_BARO_CTRL |
Disable Barometer sensor fusion |
EKF2_RNG_CTRL |
Disable range finder sensor fusion |
To perform the simulation with UWB (external positioning system) you need first to setup the PX4 parameters in QGroundControl. You can load the parameters for the UWB simulation by opening QGroundControl and loading the parameters present in the folder QGround_parameters. In particular, you can load:
- SITL_indoor_simu.params - to perform Software in the loop simulations
- HITL_indoor_simu.params - to perform Hardware in the loop simulations
- indoor_test.params - to perform experimental simulations
Depending of the type of simulation that you want to perform, you need to setup the enviromnet following in different ways:
- Software in the loop, skip the step where specified (Only for experimental simulations)
- Hardware in the loop, skip the step where specified (Only for experimental simulations)
- Experimental tests: make sure that your drone is in Ready to fly state before lauch the simulation (see next steps)
To perfrom SITL and HITL simulations install first the UWB plugin, see section plugin
On the command prompt enter
cd ~/PX4-mini-drone
ros2 run bridge_uwb_px4 uwb_bridge_sitl
This will start the bridge in order to fill the message fmu/in/vehicle_visual_odometry which is necessary for the external pose estimation
Before lauch the bridge make sure that your external postion reference frame system match the drone reference frame, open uwb_bridge mb1202_bridge and modify if necessary
On the command prompt enter
cd ~/PX4-mini-drone
ros2 launch launch/uwb_offboard.launch.py
This will start the uwb and mb1202 bridges in order to fill the message fmu/in/vehicle_visual_odometry which is necessary for the external pose estimation
You can run the same program used for the motion capture simulations
Point target
cd ~/PX4-mini-drone
ros2 run mcoap mocap
Velocity target
cd ~/PX4-mini-drone
ros2 run mcoap mocap_vel
Square trajectory
cd ~/PX4-mini-drone
ros2 run mcoap mocap_square