INDI Controller Outer + Inner loop problems
Posted: Tue Apr 13, 2021 2:49 pm
Dear all,
For my thesis I need to use the implemented INDI controller, both outer and inner loop. On the crazyflie 2.1 I have the flowdeck 2.1 and the multiranger attched. The only problem I experience is an unstable controller.
For commanding the drone I use the python library with the following commands.
def move_up(scf):
with MotionCommander(scf, default_height = DEFAULT_HEIGHT) as mc:
time.sleep(2)
mc.up(0.3,0.05)
time.sleep(2)
mc.forward(0.3,0.20)
time.sleep(2)
mc.right(0.3,0.20)
time.sleep(2)
mc.land()
When having the inner and outer INDI Loop activated the outerloop reference values do not seem to be used in the inner INDI loop, when looking at logged parameters. Up on further investigation it seem to be that the if statement withholds this. (see code below from controller.INDI.c)
if (RATE_DO_EXECUTE(ATTITUDE_RATE, tick)) {
// Call outer loop INDI (position controller)
if (outerLoopActive) {
positionControllerINDI(sensors, setpoint, state, &refOuterINDI);
}
// Switch between manual and automatic position control
if (setpoint->mode.z == modeDisable) {
// INDI position controller not active, INDI attitude controller is main loop
actuatorThrust = setpoint->thrust;
// actuatorThrust = refOuterINDI.z;
} else{
if (outerLoopActive) {
// INDI position controller active, INDI attitude controller becomes inner loop
actuatorThrust = refOuterINDI.z;
}
}
if (setpoint->mode.x == modeDisable) {
// INDI position controller not active, INDI attitude controller is main loop
attitudeDesired.roll = setpoint->attitude.roll;
// attitudeDesired.roll = refOuterINDI.x;
}else{
if (outerLoopActive) {
// INDI position controller active, INDI attitude controller becomes inner loop
attitudeDesired.roll = refOuterINDI.x;
}
}
if (setpoint->mode.y == modeDisable) {
// INDI position controller not active, INDI attitude controller is main loop
attitudeDesired.pitch = setpoint->attitude.pitch;
// attitudeDesired.pitch = refOuterINDI.y;
}else{
if (outerLoopActive) {
// INDI position controller active, INDI attitude controller becomes inner loop
attitudeDesired.pitch = refOuterINDI.y;
}
}
As the mode.x etc are set to ModeDisable the setpoint value is used as reference instead of the refOuterINDI.x. I cannot seem to fix this, and cannot find where the setpoint.roll values are defined and thus do not understand what reference values it is using. Even though the outer loop is activated and calculated it is not used in the inner loop due to this mode problem.
Does someone have experience with this?
Greetings
Max Kemmeren
For my thesis I need to use the implemented INDI controller, both outer and inner loop. On the crazyflie 2.1 I have the flowdeck 2.1 and the multiranger attched. The only problem I experience is an unstable controller.
For commanding the drone I use the python library with the following commands.
def move_up(scf):
with MotionCommander(scf, default_height = DEFAULT_HEIGHT) as mc:
time.sleep(2)
mc.up(0.3,0.05)
time.sleep(2)
mc.forward(0.3,0.20)
time.sleep(2)
mc.right(0.3,0.20)
time.sleep(2)
mc.land()
When having the inner and outer INDI Loop activated the outerloop reference values do not seem to be used in the inner INDI loop, when looking at logged parameters. Up on further investigation it seem to be that the if statement withholds this. (see code below from controller.INDI.c)
if (RATE_DO_EXECUTE(ATTITUDE_RATE, tick)) {
// Call outer loop INDI (position controller)
if (outerLoopActive) {
positionControllerINDI(sensors, setpoint, state, &refOuterINDI);
}
// Switch between manual and automatic position control
if (setpoint->mode.z == modeDisable) {
// INDI position controller not active, INDI attitude controller is main loop
actuatorThrust = setpoint->thrust;
// actuatorThrust = refOuterINDI.z;
} else{
if (outerLoopActive) {
// INDI position controller active, INDI attitude controller becomes inner loop
actuatorThrust = refOuterINDI.z;
}
}
if (setpoint->mode.x == modeDisable) {
// INDI position controller not active, INDI attitude controller is main loop
attitudeDesired.roll = setpoint->attitude.roll;
// attitudeDesired.roll = refOuterINDI.x;
}else{
if (outerLoopActive) {
// INDI position controller active, INDI attitude controller becomes inner loop
attitudeDesired.roll = refOuterINDI.x;
}
}
if (setpoint->mode.y == modeDisable) {
// INDI position controller not active, INDI attitude controller is main loop
attitudeDesired.pitch = setpoint->attitude.pitch;
// attitudeDesired.pitch = refOuterINDI.y;
}else{
if (outerLoopActive) {
// INDI position controller active, INDI attitude controller becomes inner loop
attitudeDesired.pitch = refOuterINDI.y;
}
}
As the mode.x etc are set to ModeDisable the setpoint value is used as reference instead of the refOuterINDI.x. I cannot seem to fix this, and cannot find where the setpoint.roll values are defined and thus do not understand what reference values it is using. Even though the outer loop is activated and calculated it is not used in the inner loop due to this mode problem.
Does someone have experience with this?
Greetings
Max Kemmeren