Skip to content

Configuration:Estimation

Martin Scheiber edited this page Oct 16, 2022 · 3 revisions

Estimator Configuration

The estimation module is required to provide position, orientation, and velocity estimates to the controller.s

Configuring PX4 Bridge

The PX4 Bridge is our additional module to circumvent the internal EKF2 estimator from PX4. There exists a corresponding pending PR to integrate this into the PX4 default functionality. For now, if you want to disable the internal estimator perform the following steps:

  1. Clone and build our modified PX4 Autopilot firmware

    git clone -b ext_state_est https://github.com/aau-cns/PX4-Autopilot.git px4_cns
    cd px4_cns
    
    # build traditionally
    make px4_fmu-v5_default # if python3 packages are missing you need to install them
    
    # OR build with docker image (already includes all install dependencies)
    docker run -it --rm --network=host -v "$(pwd)":/source px4io/px4-dev-nuttx-bionic:latest
    cd /source
    make px4_fmu-v5_default
  2. Flash the compiled firmware to the pixhawk using QGroundControl as detailed here or here.

  3. Setup the CNS Flight Stack Workspace including our mavros, mavlink, and mavlink-gbp-release packages. Optionally you could create a new workspace using our version with

    mkdir -p catkin_ws/src
    cd catkin_ws
    catkin init
    catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
    
    # Clone and build packages
    cd src
    git clone -b ext_state_est https://github.com/aau-cns/mavlink-gbp-release.git
    git clone -b ext_state_est https://github.com/aau-cns/mavlink.git
    git clone -b ext_state_est https://github.com/aau-cns/mavros.git
    cd ..
    catkin build

    After compilation the corresponding ROS-node should be available to directly interact with the bridge.

  4. Finally, select the bridge as "estimator" within the PX4 parameters (either in QGroundControl or through API): set the SYS_MC_EST_GROUP parameter to 25.

If all steps were followed correctly, all messages published to the /mavros/external_state_estimate or /mavros/external_state_estimate_lite topics are now forwarded directly to the controller.

Configuring MaRS

For a detailed MaRS configuration tutorial please refer to the MaRS ROS Tutorial.

Within the CNS flight stack, MaRS' configuration is stored in flight_stack/flight_stack_bringup/configs/mars/ and includes sensor and measurement settings.

Further the configuration file is automatically loaded in flight_stack/flight_stack_bringup/launch/fs_estimation.launch through the argument mars_config_in. In this file, also ROS-topic related settings are to be adjusted, such that MaRS is publishing to the PX4 Bridge or EKF2 correctly.

Configuring external estimator

If you desire to use an external estimator, replace the contents of flight_stack/flight_stack_bringup/launch/fs_estimation.launch with loading your estimator.

Please note, that you have to adjust your estimator publishing topics and message types for the PX4 Bridge or EKF2 accordingly.