Attitude fw: Remove builtin perf counters

This commit is contained in:
Lorenz Meier 2016-05-05 20:06:01 +02:00
parent 22d18d638c
commit 199c423f1f
8 changed files with 6 additions and 22 deletions

View File

@ -63,17 +63,12 @@ ECL_Controller::ECL_Controller(const char *name) :
_integrator(0.0f), _integrator(0.0f),
_rate_error(0.0f), _rate_error(0.0f),
_rate_setpoint(0.0f), _rate_setpoint(0.0f),
_bodyrate_setpoint(0.0f), _bodyrate_setpoint(0.0f)
_perf_name()
{ {
/* Init performance counter */
snprintf(_perf_name, sizeof(_perf_name), "fw att control %s nonfinite input", name);
_nonfinite_input_perf = perf_alloc(PC_COUNT, _perf_name);
} }
ECL_Controller::~ECL_Controller() ECL_Controller::~ECL_Controller()
{ {
perf_free(_nonfinite_input_perf);
} }
void ECL_Controller::reset_integrator() void ECL_Controller::reset_integrator()

View File

@ -118,8 +118,5 @@ protected:
float _rate_error; float _rate_error;
float _rate_setpoint; float _rate_setpoint;
float _bodyrate_setpoint; float _bodyrate_setpoint;
perf_counter_t _nonfinite_input_perf;
static const uint8_t _perf_name_max = 40;
char _perf_name[_perf_name_max];
float constrain_airspeed(float airspeed, float minspeed, float maxspeed); float constrain_airspeed(float airspeed, float minspeed, float maxspeed);
}; };

View File

@ -66,7 +66,6 @@ float ECL_PitchController::control_attitude(const struct ECL_ControlData &ctl_da
PX4_ISFINITE(ctl_data.roll) && PX4_ISFINITE(ctl_data.roll) &&
PX4_ISFINITE(ctl_data.pitch) && PX4_ISFINITE(ctl_data.pitch) &&
PX4_ISFINITE(ctl_data.airspeed))) { PX4_ISFINITE(ctl_data.airspeed))) {
perf_count(_nonfinite_input_perf);
warnx("not controlling pitch"); warnx("not controlling pitch");
return _rate_setpoint; return _rate_setpoint;
} }
@ -102,7 +101,6 @@ float ECL_PitchController::control_bodyrate(const struct ECL_ControlData &ctl_da
PX4_ISFINITE(ctl_data.airspeed_min) && PX4_ISFINITE(ctl_data.airspeed_min) &&
PX4_ISFINITE(ctl_data.airspeed_max) && PX4_ISFINITE(ctl_data.airspeed_max) &&
PX4_ISFINITE(ctl_data.scaler))) { PX4_ISFINITE(ctl_data.scaler))) {
perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f); return math::constrain(_last_output, -1.0f, 1.0f);
} }

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved. * Copyright (c) 2013-2016 Estimation and Control Library (ECL). All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -60,7 +60,6 @@ float ECL_RollController::control_attitude(const struct ECL_ControlData &ctl_dat
{ {
/* Do not calculate control signal with bad inputs */ /* Do not calculate control signal with bad inputs */
if (!(PX4_ISFINITE(ctl_data.roll_setpoint) && PX4_ISFINITE(ctl_data.roll))) { if (!(PX4_ISFINITE(ctl_data.roll_setpoint) && PX4_ISFINITE(ctl_data.roll))) {
perf_count(_nonfinite_input_perf);
return _rate_setpoint; return _rate_setpoint;
} }
@ -90,7 +89,6 @@ float ECL_RollController::control_bodyrate(const struct ECL_ControlData &ctl_dat
PX4_ISFINITE(ctl_data.airspeed_min) && PX4_ISFINITE(ctl_data.airspeed_min) &&
PX4_ISFINITE(ctl_data.airspeed_max) && PX4_ISFINITE(ctl_data.airspeed_max) &&
PX4_ISFINITE(ctl_data.scaler))) { PX4_ISFINITE(ctl_data.scaler))) {
perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f); return math::constrain(_last_output, -1.0f, 1.0f);
} }

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved. * Copyright (c) 2013-2016 Estimation and Control Library (ECL). All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -62,7 +62,6 @@ float ECL_WheelController::control_bodyrate(const struct ECL_ControlData &ctl_da
if (!(PX4_ISFINITE(ctl_data.yaw_rate) && if (!(PX4_ISFINITE(ctl_data.yaw_rate) &&
PX4_ISFINITE(ctl_data.groundspeed) && PX4_ISFINITE(ctl_data.groundspeed) &&
PX4_ISFINITE(ctl_data.groundspeed_scaler))) { PX4_ISFINITE(ctl_data.groundspeed_scaler))) {
perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f); return math::constrain(_last_output, -1.0f, 1.0f);
} }
@ -124,7 +123,6 @@ float ECL_WheelController::control_attitude(const struct ECL_ControlData &ctl_da
/* Do not calculate control signal with bad inputs */ /* Do not calculate control signal with bad inputs */
if (!(PX4_ISFINITE(ctl_data.yaw_setpoint) && if (!(PX4_ISFINITE(ctl_data.yaw_setpoint) &&
PX4_ISFINITE(ctl_data.yaw))) { PX4_ISFINITE(ctl_data.yaw))) {
perf_count(_nonfinite_input_perf);
return _rate_setpoint; return _rate_setpoint;
} }

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved. * Copyright (c) 2013-2016 Estimation and Control Library (ECL). All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved. * Copyright (c) 2013-2016 Estimation and Control Library (ECL). All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -108,7 +108,6 @@ float ECL_YawController::control_attitude_impl_openloop(const struct ECL_Control
PX4_ISFINITE(ctl_data.speed_body_w) && PX4_ISFINITE(ctl_data.speed_body_w) &&
PX4_ISFINITE(ctl_data.roll_rate_setpoint) && PX4_ISFINITE(ctl_data.roll_rate_setpoint) &&
PX4_ISFINITE(ctl_data.pitch_rate_setpoint))) { PX4_ISFINITE(ctl_data.pitch_rate_setpoint))) {
perf_count(_nonfinite_input_perf);
return _rate_setpoint; return _rate_setpoint;
} }
@ -160,7 +159,6 @@ float ECL_YawController::control_bodyrate_impl(const struct ECL_ControlData &ctl
PX4_ISFINITE(ctl_data.yaw_rate) && PX4_ISFINITE(ctl_data.pitch_rate_setpoint) && PX4_ISFINITE(ctl_data.yaw_rate) && PX4_ISFINITE(ctl_data.pitch_rate_setpoint) &&
PX4_ISFINITE(ctl_data.airspeed_min) && PX4_ISFINITE(ctl_data.airspeed_max) && PX4_ISFINITE(ctl_data.airspeed_min) && PX4_ISFINITE(ctl_data.airspeed_max) &&
PX4_ISFINITE(ctl_data.scaler))) { PX4_ISFINITE(ctl_data.scaler))) {
perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f); return math::constrain(_last_output, -1.0f, 1.0f);
} }

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved. * Copyright (c) 2013-2016 Estimation and Control Library (ECL). All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions