First read prearm,arm and disarm specified by PX4. How can I comment on this: it is not better than shit.
Arming and disarming decides what cases will stop drones. One of the cases is that should a drone be stopped, or disarmed, if it cannot receive RC signals for a certain amount of time.
- Allow arming drones without RC signal
We allow drones armed in offboard modes by setting
COM_RCL_EXCEPT=4like
Explanation of COM_RCL_EXCEPT
Only setting this if we want to keep our drone armed when there is no RC input.
-
Change timeout parameters to allow more time to take actions
COM_OF_LOSS_T = 10 COM_DISARM_LAND =10 COM_DISARM_LAND = -1 #means disable this
Indoor flights need Motion Capture System to provide pose information for drones in order to switch to the mode OFFBOARD. Check Using Vision or Motion Capture Systems for Position Estimation.
EKF2_AID_MASK and EKF2_HGT_MODE are the parameters to be tuned first.
We need to configure PX4 such that it takes navigation information from Vicon instead of GPS or IMU. Tutorials are given by PX4, i.e. EKF2 Tuning/Configuration, Using Vision or Motion Capture Systems for Position Estimation
-
Set
EKF2_AID_MASK = 24which means3: vision position fusion + 4: vision yaw fusion, we set position information is from Vicon.- more details can be found at
EKF2_AID_MASKat advanced_config/parameter_reference.
-
Set
EKF2_HGT_MODE = 3: Vision, we set height information is also from Vicon
Reference:
-
Indoor flying, RISC Lab Documentation, https://risc.readthedocs.io/1-indoor-flight.html.
-
https://docs.px4.io/main/en/advanced/switching_state_estimators.html
-
https://docs.px4.io/main/en/ros/external_position_estimation.html
-
https://docs.px4.io/main/en/ros/external_position_estimation.html#reference-frames-and-ros
-
https://docs.px4.io/v1.12/en/computer_vision/motion_capture.html
-
https://docs.px4.io/v1.12/en/tutorials/motion-capture-vicon-optitrack.html
-
https://docs.px4.io/v1.12/en/ros/external_position_estimation.html#reference-frames-and-ros
Choosing instances of EKF depends on the number of IMUs and the number of magnetometers. For pixhawks 5x, there are
- 3 IMUS,
- 1 magnetometer,
therefore, we should set
- EKF2_MULTI_IMU = 3,
- EKF2_MULTI_MAG = 1,
which leads to
N_instances = MAX(EKF2_MULTI_IMU , 1) x MAX(EKF2_MULTI_MAG , 1) = 3
Following the guide https://docs.px4.io/v1.12/en/advanced_config/tuning_the_ecl_ekf.html, we should set - SENS_IMU_MODE = 1 as 1: Publish primary IMU selection, - SENS_MAG_MODE = 1 as 1: Publish primary magnetometer
https://docs.px4.io/v1.12/en/advanced_config/tuning_the_ecl_ekf.html.
Source: 1. External Vision System, PX4, 2. EKF2_AID_MASK, https://docs.px4.io/v1.12/en/advanced_config/parameter_reference.html#EKF2_AID_MASK.
SYS_MC_EST_GROUP
https://404warehouse.net/2015/12/20/autopilot-offboard-control-using-mavros-package-on-ros/
https://docs.px4.io/v1.12/en/advanced_config/tuning_the_ecl_ekf.html
EKF in PX4 ECL