FlightTaskManual: remove stick_deadzone because base class already has it.

Remove deadzone check for vel in xy/z because expo already contains deadzone
This commit is contained in:
Dennis Mannhart 2017-12-22 21:01:06 +01:00 committed by Beat Küng
parent 8da2ff4d77
commit 55b6f19367
5 changed files with 7 additions and 21 deletions

View File

@ -48,11 +48,9 @@ using namespace matrix;
FlightTaskManual::FlightTaskManual(control::SuperBlock *parent, const char *name) :
FlightTask(parent, name),
_z_vel_max_up(parent, "MPC_Z_VEL_MAX_UP", false),
_z_vel_max_down(parent, "MPC_Z_VEL_MAX_DN", false),
_hold_dz(parent, "MPC_HOLD_DZ", false),
_xy_vel_man_expo(parent, "MPC_XY_MAN_EXPO", false),
_z_vel_man_expo(parent, "MPC_Z_MAN_EXPO", false),
_hold_dz(parent, "MPC_HOLD_DZ", false)
_z_vel_man_expo(parent, "MPC_Z_MAN_EXPO", false)
{
}
@ -126,15 +124,6 @@ void FlightTaskManual::_updateYaw()
_setYawSetpoint(_hold_yaw);
}
void FlightTaskManual::_scaleVelocity(Vector3f &velocity)
{
const Vector3f velocity_scale(_velocity_hor_manual.get(),
_velocity_hor_manual.get(),
(velocity(2) > 0.0f) ? _z_vel_max_down.get() : _z_vel_max_up.get());
velocity = velocity.emult(velocity_scale);
}
bool FlightTaskManual::_evaluateSticks()
{
if ((_time_stamp_current - _sub_manual_control_setpoint->get().timestamp) < _timeout) {

View File

@ -68,6 +68,7 @@ protected:
bool _sticks_data_required = true; /**< let sibling task 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 _hold_dz; /**< deadzone around the center for the sticks when flying in position mode */
private:
@ -75,7 +76,6 @@ private:
control::BlockParamFloat _xy_vel_man_expo; /**< ratio of exponential curve for stick input in xy direction pos mode */
control::BlockParamFloat _z_vel_man_expo; /**< ratio of exponential curve for stick input in xy direction pos mode */
control::BlockParamFloat _hold_dz; /**< deadzone around the center for the sticks when flying in position mode */
bool _evaluateSticks(); /**< checks and sets stick inputs */

View File

@ -51,9 +51,7 @@ FlightTaskManualAltitude::FlightTaskManualAltitude(control::SuperBlock *parent,
_vel_max_up(parent, "MPC_Z_VEL_MAX_UP", false),
_yaw_rate_scaling(parent, "MPC_MAN_Y_MAX", false),
_acc_max_up(parent, "MPC_ACC_UP_MAX", false),
_acc_max_down(parent, "MPC_ACC_DOWN_MAX", false),
_stick_deadzone(parent, "MPC_HOLD_DZ", false)
_acc_max_down(parent, "MPC_ACC_DOWN_MAX", false)
{}
bool FlightTaskManualAltitude::activate()
@ -79,7 +77,7 @@ void FlightTaskManualAltitude::scaleSticks()
void FlightTaskManualAltitude::updateHeadingSetpoints()
{
if (fabsf(_sticks(3)) < _stick_deadzone.get()) {
if (fabsf(_sticks(3)) < _hold_dz.get()) {
/* Want to hold yaw */
_yaw_rate_sp = NAN;
_yaw_sp = _yaw_sp_predicted;
@ -93,7 +91,7 @@ void FlightTaskManualAltitude::updateHeadingSetpoints()
void FlightTaskManualAltitude::updateZsetpoints()
{
if (fabsf(_sticks(2)) < _stick_deadzone.get()) {
if (fabsf(_sticks_expo(2)) < FLT_EPSILON) {
/* Want to hold altitude */

View File

@ -66,7 +66,6 @@ protected:
control::BlockParamFloat _yaw_rate_scaling; /**< scaling factor from stick to yaw rate */
control::BlockParamFloat _acc_max_up; /**< maximum acceleration upward */
control::BlockParamFloat _acc_max_down; /**< maximum acceleration downward */
control::BlockParamFloat _stick_deadzone; /**< stick is considered zero if below deadzone */
virtual void updateSetpoints(); /**< updates all setpoints */
virtual void scaleSticks(); /**< scales sticks to velocity */

View File

@ -85,7 +85,7 @@ void FlightTaskManualPosition::updateXYsetpoints()
{
matrix::Vector2f stick_xy(_sticks_expo(0), _sticks_expo(1));
if (stick_xy.length() < _stick_deadzone.get()) {
if (stick_xy.length() < FLT_EPSILON) {
/* Want to hold position */
if (_lock_time <= _lock_time_max) {