aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2013-12-26 23:03:19 +0400
committerAnton Babushkin <anton.babushkin@me.com>2013-12-26 23:03:19 +0400
commit20c9ce9d6dc119547bc81b9034cebc69a364b565 (patch)
treeda03b71b5db9168b00d26ec3c4a020c4a7b15b12 /src/lib
parente103729de308c113d561942335a4bcf20c68a255 (diff)
downloadpx4-firmware-20c9ce9d6dc119547bc81b9034cebc69a364b565.tar.gz
px4-firmware-20c9ce9d6dc119547bc81b9034cebc69a364b565.tar.bz2
px4-firmware-20c9ce9d6dc119547bc81b9034cebc69a364b565.zip
mc_pos_control: replacement for multirotor_pos_control, rewritten to C++ and new mathlib
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/mathlib/math/Vector.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/mathlib/math/Vector.hpp b/src/lib/mathlib/math/Vector.hpp
index b7840170c..c7323c215 100644
--- a/src/lib/mathlib/math/Vector.hpp
+++ b/src/lib/mathlib/math/Vector.hpp
@@ -262,6 +262,30 @@ public:
}
/**
+ * element by element multiplication
+ */
+ const Vector<N> emult(const Vector<N> &v) const {
+ Vector<N> res;
+
+ for (unsigned int i = 0; i < N; i++)
+ res.data[i] = data[i] * v.data[i];
+
+ return res;
+ }
+
+ /**
+ * element by element division
+ */
+ const Vector<N> edivide(const Vector<N> &v) const {
+ Vector<N> res;
+
+ for (unsigned int i = 0; i < N; i++)
+ res.data[i] = data[i] / v.data[i];
+
+ return res;
+ }
+
+ /**
* gets the length of this vector squared
*/
float length_squared() const {