Thrust calculation for attitude control

Hello everyone,

I am trying to implement an attitude controller (attitude + thrust commands) for a quadrotor to track a commanded trajectory. I"m following the controller outlined here:

At its core is a PD-based attitude controller that uses the current state of the quadrotor (as estimated by an onboard EKF with measurements from motion capture) and a given pose + velocity setpoint to generate desired attitude + thrust commands.

As a first step, I started by testing hover. The controller (after some tuning) works as expected in simulation (with the iris model) and the quadrotor hovers just fine.

However, on the real platform, the hover is not as crisp. I see slow oscillations and an eventual decrease in altitude during the course of a single flight. I have attached a log file from a recent flight.

The flight starts in offboard mode using the position controller on the flight controller to reach 1m, then I switch to the custom attitude controller running on an onboard embedded computer.

I’ve read on the forum and in the documentation that the battery voltage has a big effect on the hover thrust. I was planning on calculating a scaling factor that compensates for a drop in battery voltage. I enabled MC_BAT_SCALE_EN for this, but it doesn’t seem to help.

Some other parameters:

  1. I’m running a 250mm quadrotor with 4S Lipo and 5x4x3 props.
  2. The flight controller is a Pixracer with the latest (1.14.0 stable) firmware.
  3. Communication between the flight controller and the onboard Jetson TX1 computer is done using MAVSDK.
  4. The attitude controller is running on the onboard computer at 100Hz.
  5. The EKF uses pose measurements from the motion capture system to generate odometry (pose + twist) at 100Hz.

I can provide more log files or videos if that would be helpful. Would appreciate any suggestions or insights.

1 Like