Omni MC: Changed the parameter name MC_OMNI_MODE to OMNI_ATT_MODE

- To be more descriptive and similar to other (future) OMNI_ parameters
This commit is contained in:
Azarakhsh Keipour
2019-12-28 19:35:16 -05:00
parent 3ae19f254c
commit 3c2087a69d
8 changed files with 21 additions and 12 deletions
@@ -38,7 +38,7 @@ then
param set SDLOG_PROFILE 179
param set MC_OMNI_MODE 2
param set OMNI_ATT_MODE 2
fi
set MAV_TYPE 13
@@ -46,7 +46,7 @@ then
param set BAT_N_CELLS 4
param set MC_OMNI_MODE 2
param set OMNI_ATT_MODE 2
fi
# Set mixer
+1 -1
View File
@@ -19,7 +19,7 @@ then
param set PWM_MIN 1075
param set PWM_RATE 400
param set MC_OMNI_MODE 0
param set OMNI_ATT_MODE 0
fi
#
@@ -159,7 +159,7 @@ private:
(ParamInt<px4::params::MC_AIRMODE>) _param_mc_airmode,
(ParamInt<px4::params::MC_OMNI_MODE>) _param_mc_omni_mode
(ParamInt<px4::params::OMNI_ATT_MODE>) _param_omni_att_mode
)
bool _is_tailsitter{false};
@@ -219,7 +219,7 @@ MulticopterAttitudeControl::generate_attitude_setpoint(float dt, bool reset_yaw_
attitude_setpoint.thrust_body[2] = -throttle_curve(_manual_control_sp.z);
/* modify roll/pitch if we're in omni-directional mode */
if (_param_mc_omni_mode.get() == 2) {
if (_param_omni_att_mode.get() == 2) {
// set the euler angles, for logging only, must not be used for control
attitude_setpoint.roll_body = 0;
attitude_setpoint.pitch_body = 0;
@@ -47,8 +47,9 @@ namespace ControlMath
void thrustToAttitude(const Vector3f &thr_sp, const float yaw_sp, const int omni_att_mode,
vehicle_attitude_setpoint_s &att_sp)
{
// Print an error if the omni_att_mode parameter is out of range
if (omni_att_mode > 2 || omni_att_mode < 0) {
PX4_ERR("omni_att_mode set to unknown value!");
PX4_ERR("OMNI_ATT_MODE parameter set to unknown value!");
}
switch (omni_att_mode) {
@@ -56,7 +57,7 @@ void thrustToAttitude(const Vector3f &thr_sp, const float yaw_sp, const int omni
thrustToZeroTiltAttitude(thr_sp, yaw_sp, att_sp);
break;
default:
default: // Attitude is calculated from the desired thrust direction
bodyzToAttitude(-thr_sp, yaw_sp, att_sp);
att_sp.thrust_body[2] = -thr_sp.length();
}
@@ -173,7 +173,7 @@ private:
(ParamFloat<px4::params::MPC_TILTMAX_LND>) _param_mpc_tiltmax_lnd, /**< maximum tilt for landing and smooth takeoff */
(ParamFloat<px4::params::MPC_THR_MIN>) _param_mpc_thr_min,
(ParamFloat<px4::params::MPC_THR_MAX>) _param_mpc_thr_max,
(ParamInt<px4::params::MC_OMNI_MODE>) _param_mc_omni_mode
(ParamInt<px4::params::OMNI_ATT_MODE>) _param_omni_att_mode
);
control::BlockDerivative _vel_x_deriv; /**< velocity derivative in x */
@@ -656,7 +656,7 @@ MulticopterPositionControl::Run()
vehicle_attitude_setpoint_s attitude_setpoint{};
attitude_setpoint.timestamp = time_stamp_now;
_control.getAttitudeSetpoint(_param_mc_omni_mode.get(), attitude_setpoint);
_control.getAttitudeSetpoint(_param_omni_att_mode.get(), attitude_setpoint);
// Part of landing logic: if ground-contact/maybe landed was detected, turn off
// controller. This message does not have to be logged as part of the vehicle_local_position_setpoint topic.
@@ -747,9 +747,17 @@ PARAM_DEFINE_FLOAT(MPC_SPOOLUP_TIME, 1.0f);
PARAM_DEFINE_INT32(MPC_YAW_MODE, 0);
/**
* Omni-directional Controller mode.
* Omni-directional attitude setpoint mode
*
* Specifies the heading in Auto.
* Specifies the type of attitude setpoint sent to the attitude controller.
* The parameter can be set to a normal attitude setpoint, where the tilt
* of the vehicle (roll and pitch) are calculated from the desired thrust
* vector. This should be the behavior for the non-omnidirectional vehicles,
* such as quadrotors and other multirotors with coplanar rotors.
* The "constant zero tilt" mode enforces zero roll and pitch and can only be
* used for omnidirectional vehicles. The daisy-chain mode enforces zero tilt
* up to a maximum set acceleration (thrust) and tilts the vehicle as small
* as possible if the thrust vector is larger than the maximum.
*
* @min 0
* @max 2
@@ -758,4 +766,4 @@ PARAM_DEFINE_INT32(MPC_YAW_MODE, 0);
* @value 2 constant zero tilt
* @group Multicopter Attitude Control
*/
PARAM_DEFINE_INT32(MC_OMNI_MODE, 0);
PARAM_DEFINE_INT32(OMNI_ATT_MODE, 0);