Skip to content

Commit

Permalink
[TO REVERT] Do not autostart control_allocator, disable geninv, disab…
Browse files Browse the repository at this point in the history
…le allocation method update
  • Loading branch information
jlecoeur committed Nov 8, 2019
1 parent 50f46b1 commit 4646f2a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ROMFS/px4fmu_common/init.d/rc.mc_apps
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mc_pos_control start
#
# Start Control Allocator
#
control_allocator start
#control_allocator start

#
# Start Multicopter Land Detector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,26 @@ ControlAllocationMultirotor::setEffectivenessMatrix(const matrix::Matrix<float,
_B = B;

// Pseudo-inverse
matrix::Matrix<float, NUM_ACTUATORS, NUM_AXES> A = matrix::geninv(_B);
// matrix::Matrix<float, NUM_ACTUATORS, NUM_AXES> A = matrix::geninv(_B);
const float A_quad_w[16][6] = {
{ -0.495383f, 0.707107f, 0.765306f, 0.0f, 0.0f, -1.000000f },
{ 0.495383f, -0.707107f, 1.000000f, 0.0f, 0.0f, -1.000000f },
{ 0.495383f, 0.707107f, -0.765306f, 0.0f, 0.0f, -1.000000f },
{ -0.495383f, -0.707107f, -1.000000f, 0.0f, 0.0f, -1.000000f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}
};
matrix::Matrix<float, 16, 6> A = matrix::Matrix<float, 16, 6>(A_quad_w);

// Convert A to MultirotorMixer::Rotor
MultirotorMixer::Rotor rotors[NUM_ACTUATORS];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ void
ControlAllocationSimple::setEffectivenessMatrix(const matrix::Matrix<float, NUM_AXES, NUM_ACTUATORS> &B)
{
_B = B;
_A = matrix::geninv(_B);

// _A = matrix::geninv(_B);

// TODO: measure exec time for pseudo-inverse of full 6x16 matrix, and compare with
// faster alternative below (possible only if number of actuators is known)
Expand All @@ -56,6 +57,26 @@ ControlAllocationSimple::setEffectivenessMatrix(const matrix::Matrix<float, NUM_
// - create a smaller matrix with the non-0 columns
// - pseudo inverse
// - fill A by rows with pseudo inverse of non-zero columns

const float A_quad_w[16][6] = {
{ -0.495383f, 0.707107f, 0.765306f, 0.0f, 0.0f, -1.000000f },
{ 0.495383f, -0.707107f, 1.000000f, 0.0f, 0.0f, -1.000000f },
{ 0.495383f, 0.707107f, -0.765306f, 0.0f, 0.0f, -1.000000f },
{ -0.495383f, -0.707107f, -1.000000f, 0.0f, 0.0f, -1.000000f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}
};
_A = matrix::Matrix<float, 16, 6>(A_quad_w);
}


Expand Down
2 changes: 1 addition & 1 deletion src/modules/control_allocator/ControlAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ControlAllocator::parameters_updated()
{
// Allocation method
// Do this first: in case a new method is loaded, it will be configured below
update_allocation_method();
// update_allocation_method();

// Minimum actuator values
matrix::Vector<float, NUM_ACTUATORS> actuator_min;
Expand Down

0 comments on commit 4646f2a

Please sign in to comment.