-
Notifications
You must be signed in to change notification settings - Fork 6
4. Flight Controller
Low, Jun En edited this page Apr 12, 2024
·
4 revisions
After doing the steps in Simulation, we can proceed with flashing the same firmware we ran onto an actual board. It is important to use the same firmware as some of the topics that TrajBridge needs are not exposed by default.
We also need to configure the PX4 Flight Controller to take in motion capture and high-level control commands. Here are the steps we took:
- To change the namespace of the drone, we have to do a bit of janky magic. In the firmware folder PX4/-Autopilot/src/modules/uxrce_dds_client, the dds_topics.yaml file let's you choose which topics to publish and subscribe to BUT it's namespace is hardcoded (it'll revert back to /fmu/in or /fmu/out). So, to work around that, go to the module.yaml file in the same folder and change line 9 to:
uxrce_dds_client start -n quad<#> ${UXRCE_DDS_ARGS}
where <#> is the number of your choice. - To upload the custom PX4 firmware, navigate to the PX4 folder and, depending on the board do:
- PixRacer: make px4_fmu-v4_default upload
- PixRacer Pro: make mro_pixracerpro_default upload
- The pinouts from the PX4 are as follows
- Pin6: GND (black)
- Pin8: UART1_TXD (green)
- Pin10: UART1_RXD (yellow)
- Drone Parameters for Indoor Mocap:
- UXRCE_DDS_CFG = TELEM 2
- EKF2_BARO_CTRL = Disabled
- EKF2_EV_CTRL = 11
- EKF2_EV_DELAY = 30ms
- EKF2_EV_NOISE_MD = EV noise parameters
- EKF2_GPS_CTRL = 0
- EKF2_HGT_REF = Vision
- EKF2_RNG_CTRL = Disable range fusion
- MIS_TAKEOFF_ALT = 1.0m
- Don't forget to do
make clean
,make distclean
between firmware compiles for different targets. - Don't forget to do
make submodulesclean
when switch to new branches within the firmware.