Skip to content

4. Flight Controller

Low, Jun En edited this page Apr 12, 2024 · 4 revisions

Current Steps

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:

  1. 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.
  2. To upload the custom PX4 firmware, navigate to the PX4 folder and, depending on the board do:
    1. PixRacer: make px4_fmu-v4_default upload
    2. PixRacer Pro: make mro_pixracerpro_default upload
  3. The pinouts from the PX4 are as follows
    1. Pin6: GND (black)
    2. Pin8: UART1_TXD (green)
    3. Pin10: UART1_RXD (yellow)
  4. Drone Parameters for Indoor Mocap:
    1. UXRCE_DDS_CFG = TELEM 2
    2. EKF2_BARO_CTRL = Disabled
    3. EKF2_EV_CTRL = 11
    4. EKF2_EV_DELAY = 30ms
    5. EKF2_EV_NOISE_MD = EV noise parameters
    6. EKF2_GPS_CTRL = 0
    7. EKF2_HGT_REF = Vision
    8. EKF2_RNG_CTRL = Disable range fusion
    9. MIS_TAKEOFF_ALT = 1.0m

Notes

  1. Don't forget to do make clean, make distclean between firmware compiles for different targets.
  2. Don't forget to do make submodulesclean when switch to new branches within the firmware.
Clone this wiki locally