aboutsummaryrefslogtreecommitdiff
path: root/apps/systemlib/mixer/mixer.h
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-08-15 00:46:15 -0700
committerpx4dev <px4@purgatory.org>2012-08-15 00:46:15 -0700
commit5198a9daf798089b4f6f2112029260f614cf7702 (patch)
tree97040f964cc58ac4f86c65b02f8eea973c3448d4 /apps/systemlib/mixer/mixer.h
parent3edd6c86f20a768eee049fa2e9410c32bb13c382 (diff)
downloadpx4-firmware-5198a9daf798089b4f6f2112029260f614cf7702.tar.gz
px4-firmware-5198a9daf798089b4f6f2112029260f614cf7702.tar.bz2
px4-firmware-5198a9daf798089b4f6f2112029260f614cf7702.zip
New multirotor mixer; builds, not yet tested.
Diffstat (limited to 'apps/systemlib/mixer/mixer.h')
-rw-r--r--apps/systemlib/mixer/mixer.h67
1 files changed, 61 insertions, 6 deletions
diff --git a/apps/systemlib/mixer/mixer.h b/apps/systemlib/mixer/mixer.h
index 882acb33e..94c179eba 100644
--- a/apps/systemlib/mixer/mixer.h
+++ b/apps/systemlib/mixer/mixer.h
@@ -185,6 +185,15 @@ protected:
uintptr_t _cb_handle;
/**
+ * Invoke the client callback to fetch a control value.
+ *
+ * @param group Control group to fetch from.
+ * @param index Control index to fetch.
+ * @return The control value.
+ */
+ float get_control(uint8_t group, uint8_t index);
+
+ /**
* Perform simpler linear scaling.
*
* @param scaler The scaler configuration.
@@ -328,7 +337,7 @@ private:
};
/**
- * Multi-rotor mixer.
+ * Multi-rotor mixer for pre-defined vehicle geometries.
*
* Collects four inputs (roll, pitch, yaw, thrust) and mixes them to
* a set of outputs based on the configured geometry.
@@ -336,22 +345,68 @@ private:
class __EXPORT MultirotorMixer : public Mixer
{
public:
+ /**
+ * Supported multirotor geometries.
+ *
+ * XXX add more
+ */
enum Geometry {
- MULTIROTOR_QUAD_PLUS,
- MULTIROTOR_QUAD_X
- /* XXX add more here */
+ QUAD_X = 0, /**< quad in X configuration */
+ QUAD_PLUS, /**< quad in + configuration */
+ HEX_X, /**< hex in X configuration */
+ HEX_PLUS, /**< hex in + configuration */
+ OCTA_X,
+ OCTA_PLUS,
+
+ MAX_GEOMETRY
+ };
+
+ /**
+ * Precalculated rotor mix.
+ */
+ struct Rotor {
+ float roll_scale; /**< scales roll for this rotor */
+ float pitch_scale; /**< scales pitch for this rotor */
+ float yaw_scale; /**< scales yaw for this rotor */
};
+ /**
+ * Constructor.
+ *
+ * @param control_cb Callback invoked to read inputs.
+ * @param cb_handle Passed to control_cb.
+ * @param geometry The selected geometry.
+ * @param roll_scale Scaling factor applied to roll inputs
+ * compared to thrust.
+ * @param pitch_scale Scaling factor applied to pitch inputs
+ * compared to thrust.
+ * @param yaw_wcale Scaling factor applied to yaw inputs compared
+ * to thrust.
+ * @param deadband Minumum rotor control output value; usually
+ * tuned to ensure that rotors never stall at the
+ * low end of their control range.
+ */
MultirotorMixer(ControlCallback control_cb,
uintptr_t cb_handle,
- Geometry geom);
+ Geometry geometry,
+ float roll_scale,
+ float pitch_scale,
+ float yaw_scale,
+ float deadband);
~MultirotorMixer();
virtual unsigned mix(float *outputs, unsigned space);
virtual void groups_required(uint32_t &groups);
private:
- Geometry _geometry;
+ float _roll_scale;
+ float _pitch_scale;
+ float _yaw_scale;
+ float _deadband;
+
+ unsigned _rotor_count;
+ const Rotor *_rotors;
+
};
#endif