flight tasks: refactor BlockParam -> Param and handle param updates

This commit is contained in:
Beat Küng
2018-04-11 07:47:06 +02:00
parent 2e620cf1d4
commit 0eaa6222a2
19 changed files with 89 additions and 86 deletions
+11 -6
View File
@@ -46,7 +46,7 @@
class FlightTaskManual : public FlightTask
{
public:
FlightTaskManual(control::SuperBlock *parent, const char *name);
FlightTaskManual() = default;
virtual ~FlightTaskManual() = default;
@@ -61,14 +61,19 @@ protected:
bool _sticks_data_required = true; /**< let inherited task-class define if it depends on stick data */
matrix::Vector<float, 4> _sticks; /**< unmodified manual stick inputs */
matrix::Vector3f _sticks_expo; /**< modified manual sticks using expo function*/
control::BlockParamFloat _stick_dz; /**< 0-deadzone around the center for the sticks */
float stickDeadzone() const { return _stick_dz.get(); }
private:
bool _evaluateSticks(); /**< checks and sets stick inputs */
uORB::Subscription<manual_control_setpoint_s> *_sub_manual_control_setpoint{nullptr};
control::BlockParamFloat _xy_vel_man_expo; /**< ratio of exponential curve for stick input in xy direction */
control::BlockParamFloat _z_vel_man_expo; /**< ratio of exponential curve for stick input in z direction */
bool _evaluateSticks(); /**< checks and sets stick inputs */
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask,
(ParamFloat<px4::params::MPC_HOLD_DZ>) _stick_dz, /**< 0-deadzone around the center for the sticks */
(ParamFloat<px4::params::MPC_XY_MAN_EXPO>)
_xy_vel_man_expo, /**< ratio of exponential curve for stick input in xy direction */
(ParamFloat<px4::params::MPC_Z_MAN_EXPO>)
_z_vel_man_expo /**< ratio of exponential curve for stick input in z direction */
)
};