aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorRoman Bapst <romanbapst@yahoo.de>2014-09-24 10:29:28 +0200
committerRoman Bapst <romanbapst@yahoo.de>2014-09-24 10:29:28 +0200
commit2b8a9b632555708731d93f4aa7945d19e83d3134 (patch)
treea595e0861ad1288eb1bfa7c26d5f3c684c5ef103 /src/lib
parent77c823d3cd0f49014a33632ec9ef3efdd7d3dfa5 (diff)
downloadpx4-firmware-2b8a9b632555708731d93f4aa7945d19e83d3134.tar.gz
px4-firmware-2b8a9b632555708731d93f4aa7945d19e83d3134.tar.bz2
px4-firmware-2b8a9b632555708731d93f4aa7945d19e83d3134.zip
Restored performance counter functionality, ROS package used own source file for function definitions but per_counter.h stays the same
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp6
-rw-r--r--src/lib/ecl/attitude_fw/ecl_pitch_controller.h5
-rw-r--r--src/lib/ecl/attitude_fw/ecl_roll_controller.cpp8
-rw-r--r--src/lib/ecl/attitude_fw/ecl_roll_controller.h6
-rw-r--r--src/lib/ecl/attitude_fw/ecl_yaw_controller.cpp8
-rw-r--r--src/lib/ecl/attitude_fw/ecl_yaw_controller.h6
6 files changed, 17 insertions, 22 deletions
diff --git a/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp b/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp
index b840206d5..8ee8b9c68 100644
--- a/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp
+++ b/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp
@@ -69,13 +69,13 @@ ECL_PitchController::ECL_PitchController() :
_rate_error(0.0f),
_rate_setpoint(0.0f),
_bodyrate_setpoint(0.0f)
- //_nonfinite_input_perf(perf_alloc(PC_COUNT, "fw att control pitch nonfinite input"))
+ _nonfinite_input_perf(perf_alloc(PC_COUNT, "fw att control pitch nonfinite input"))
{
}
ECL_PitchController::~ECL_PitchController()
{
- //perf_free(_nonfinite_input_perf);
+ perf_free(_nonfinite_input_perf);
}
float ECL_PitchController::control_attitude(float pitch_setpoint, float roll, float pitch, float airspeed)
@@ -145,7 +145,7 @@ float ECL_PitchController::control_bodyrate(float roll, float pitch,
if (!(isfinite(roll) && isfinite(pitch) && isfinite(pitch_rate) && isfinite(yaw_rate) &&
isfinite(yaw_rate_setpoint) && isfinite(airspeed_min) &&
isfinite(airspeed_max) && isfinite(scaler))) {
- //perf_count(_nonfinite_input_perf);
+ perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f);
}
diff --git a/src/lib/ecl/attitude_fw/ecl_pitch_controller.h b/src/lib/ecl/attitude_fw/ecl_pitch_controller.h
index 973e15d98..39b9f9d03 100644
--- a/src/lib/ecl/attitude_fw/ecl_pitch_controller.h
+++ b/src/lib/ecl/attitude_fw/ecl_pitch_controller.h
@@ -51,9 +51,8 @@
#include <stdbool.h>
#include <stdint.h>
-#ifdef CONFIG_ARM_ARCH
#include <systemlib/perf_counter.h>
-#endif
+
class __EXPORT ECL_PitchController //XXX: create controller superclass
{
public:
@@ -130,7 +129,7 @@ private:
float _rate_error;
float _rate_setpoint;
float _bodyrate_setpoint;
- //perf_counter_t _nonfinite_input_perf;
+ perf_counter_t _nonfinite_input_perf;
};
#endif // ECL_PITCH_CONTROLLER_H
diff --git a/src/lib/ecl/attitude_fw/ecl_roll_controller.cpp b/src/lib/ecl/attitude_fw/ecl_roll_controller.cpp
index 1b9925f63..6707a11ba 100644
--- a/src/lib/ecl/attitude_fw/ecl_roll_controller.cpp
+++ b/src/lib/ecl/attitude_fw/ecl_roll_controller.cpp
@@ -67,20 +67,20 @@ ECL_RollController::ECL_RollController() :
_rate_error(0.0f),
_rate_setpoint(0.0f),
_bodyrate_setpoint(0.0f),
- //_nonfinite_input_perf(perf_alloc(PC_COUNT, "fw att control roll nonfinite input"))
+ _nonfinite_input_perf(perf_alloc(PC_COUNT, "fw att control roll nonfinite input")),
{
}
ECL_RollController::~ECL_RollController()
{
- //perf_free(_nonfinite_input_perf);
+ perf_free(_nonfinite_input_perf);
}
float ECL_RollController::control_attitude(float roll_setpoint, float roll)
{
/* Do not calculate control signal with bad inputs */
if (!(isfinite(roll_setpoint) && isfinite(roll))) {
- //perf_count(_nonfinite_input_perf);
+ perf_count(_nonfinite_input_perf);
return _rate_setpoint;
}
@@ -108,7 +108,7 @@ float ECL_RollController::control_bodyrate(float pitch,
if (!(isfinite(pitch) && isfinite(roll_rate) && isfinite(yaw_rate) && isfinite(yaw_rate_setpoint) &&
isfinite(airspeed_min) && isfinite(airspeed_max) &&
isfinite(scaler))) {
- //perf_count(_nonfinite_input_perf);
+ perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f);
}
diff --git a/src/lib/ecl/attitude_fw/ecl_roll_controller.h b/src/lib/ecl/attitude_fw/ecl_roll_controller.h
index 84e6e9fe4..dbcabd847 100644
--- a/src/lib/ecl/attitude_fw/ecl_roll_controller.h
+++ b/src/lib/ecl/attitude_fw/ecl_roll_controller.h
@@ -51,10 +51,8 @@
#include <stdbool.h>
#include <stdint.h>
-
-#ifdef CONIG_ARCH_ARM
#include <systemlib/perf_counter.h>
-#endif
+
class __EXPORT ECL_RollController //XXX: create controller superclass
{
@@ -123,7 +121,7 @@ private:
float _rate_error;
float _rate_setpoint;
float _bodyrate_setpoint;
- //perf_counter_t _nonfinite_input_perf;
+ perf_counter_t _nonfinite_input_perf;
};
#endif // ECL_ROLL_CONTROLLER_H
diff --git a/src/lib/ecl/attitude_fw/ecl_yaw_controller.cpp b/src/lib/ecl/attitude_fw/ecl_yaw_controller.cpp
index 5b023fa8f..7ff864175 100644
--- a/src/lib/ecl/attitude_fw/ecl_yaw_controller.cpp
+++ b/src/lib/ecl/attitude_fw/ecl_yaw_controller.cpp
@@ -66,13 +66,13 @@ ECL_YawController::ECL_YawController() :
_rate_setpoint(0.0f),
_bodyrate_setpoint(0.0f),
_coordinated_min_speed(1.0f),
- //_nonfinite_input_perf(perf_alloc(PC_COUNT, "fw att control yaw nonfinite input"))
+ _nonfinite_input_perf(perf_alloc(PC_COUNT, "fw att control yaw nonfinite input"))
{
}
ECL_YawController::~ECL_YawController()
{
- //perf_free(_nonfinite_input_perf);
+ perf_free(_nonfinite_input_perf);
}
float ECL_YawController::control_attitude(float roll, float pitch,
@@ -83,7 +83,7 @@ float ECL_YawController::control_attitude(float roll, float pitch,
if (!(isfinite(roll) && isfinite(pitch) && isfinite(speed_body_u) && isfinite(speed_body_v) &&
isfinite(speed_body_w) && isfinite(roll_rate_setpoint) &&
isfinite(pitch_rate_setpoint))) {
- //perf_count(_nonfinite_input_perf);
+ perf_count(_nonfinite_input_perf);
return _rate_setpoint;
}
// static int counter = 0;
@@ -127,7 +127,7 @@ float ECL_YawController::control_bodyrate(float roll, float pitch,
if (!(isfinite(roll) && isfinite(pitch) && isfinite(pitch_rate) && isfinite(yaw_rate) &&
isfinite(pitch_rate_setpoint) && isfinite(airspeed_min) &&
isfinite(airspeed_max) && isfinite(scaler))) {
- //perf_count(_nonfinite_input_perf);
+ perf_count(_nonfinite_input_perf);
return math::constrain(_last_output, -1.0f, 1.0f);
}
/* get the usual dt estimate */
diff --git a/src/lib/ecl/attitude_fw/ecl_yaw_controller.h b/src/lib/ecl/attitude_fw/ecl_yaw_controller.h
index 61657e95b..c9e80930f 100644
--- a/src/lib/ecl/attitude_fw/ecl_yaw_controller.h
+++ b/src/lib/ecl/attitude_fw/ecl_yaw_controller.h
@@ -50,10 +50,8 @@
#include <stdbool.h>
#include <stdint.h>
-
-#ifdef CONFIG_ARCH_ARM
#include <systemlib/perf_counter.h>
-#endif
+
class __EXPORT ECL_YawController //XXX: create controller superclass
{
@@ -124,7 +122,7 @@ private:
float _rate_setpoint;
float _bodyrate_setpoint;
float _coordinated_min_speed;
- //perf_counter_t _nonfinite_input_perf;
+ perf_counter_t _nonfinite_input_perf;
};