mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
mc_pos_control: migrate MPC_*_VEL_* parameter to acceleration scaling
Before #14212 the velocity control gains used in the multicopter position controller were defined as a scale between velocity error in one axis (or it's integral and derivative respectively) and the unit thrust vector. The problem with this is that the normalization of the unit thrust vector changes per vehicle or even vehicle configuration as 0 and 100% thrust get a different physical response. That's why the gains are now defined as scale between velocity error (integral/derivative) and the output acceleration in m/s².
This commit is contained in:
@@ -41,6 +41,15 @@
|
||||
|
||||
bool param_modify_on_import(bson_node_t node)
|
||||
{
|
||||
// migrate MPC_*_VEL_* -> MPC_*_VEL_*_ACC (2020-04-27). This can be removed after the next release (current release=1.10)
|
||||
if (node->type == BSON_DOUBLE) {
|
||||
param_migrate_velocity_gain(node, "MPC_XY_VEL_P");
|
||||
param_migrate_velocity_gain(node, "MPC_XY_VEL_I");
|
||||
param_migrate_velocity_gain(node, "MPC_XY_VEL_D");
|
||||
param_migrate_velocity_gain(node, "MPC_Z_VEL_P");
|
||||
param_migrate_velocity_gain(node, "MPC_Z_VEL_I");
|
||||
param_migrate_velocity_gain(node, "MPC_Z_VEL_D");
|
||||
}
|
||||
|
||||
// migrate MC_DTERM_CUTOFF -> IMU_DGYRO_CUTOFF (2020-03-12). This can be removed after the next release (current release=1.10)
|
||||
if (node->type == BSON_DOUBLE) {
|
||||
@@ -148,3 +157,12 @@ bool param_modify_on_import(bson_node_t node)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void param_migrate_velocity_gain(bson_node_t node, const char *parameter_name)
|
||||
{
|
||||
if (strcmp(parameter_name, node->name) == 0) {
|
||||
strcat(node->name, "_ACC");
|
||||
node->d *= 20.0;
|
||||
PX4_INFO("migrating %s (removed) -> %s: new value=%.3f", parameter_name, node->name, node->d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,3 +36,4 @@
|
||||
#include "tinybson/tinybson.h"
|
||||
|
||||
__EXPORT bool param_modify_on_import(bson_node_t node);
|
||||
__EXPORT void param_migrate_velocity_gain(bson_node_t node, const char *parameter_name);
|
||||
|
||||
Reference in New Issue
Block a user