diff --git a/src/modules/vtol_att_control/vtol_type.cpp b/src/modules/vtol_att_control/vtol_type.cpp index 4c2fe698b6..86078f771a 100644 --- a/src/modules/vtol_att_control/vtol_type.cpp +++ b/src/modules/vtol_att_control/vtol_type.cpp @@ -254,9 +254,6 @@ void VtolType::check_quadchute_condition() } } -/** -* Adjust idle speed for mc mode. -*/ bool VtolType::set_idle_mc() { const char *dev = PWM_OUTPUT0_DEVICE_PATH; @@ -289,9 +286,6 @@ bool VtolType::set_idle_mc() return ret == PX4_OK; } -/** -* Adjust idle speed for fw mode. -*/ bool VtolType::set_idle_fw() { const char *dev = PWM_OUTPUT0_DEVICE_PATH; @@ -323,11 +317,6 @@ bool VtolType::set_idle_fw() return ret == PX4_OK; } -/** -* Set state of selected motors. -* See _params->fw_motors_off for selection of motors. -*/ - motor_state VtolType::set_motor_state(const motor_state current_state, const motor_state next_state, const int value) { struct pwm_output_values pwm_values = {}; diff --git a/src/modules/vtol_att_control/vtol_type.h b/src/modules/vtol_att_control/vtol_type.h index c5e192e56d..b44f854db3 100644 --- a/src/modules/vtol_att_control/vtol_type.h +++ b/src/modules/vtol_att_control/vtol_type.h @@ -156,6 +156,8 @@ public: */ bool can_transition_on_ground(); + + mode get_mode() {return _vtol_mode;} virtual void parameters_update() = 0; @@ -205,16 +207,55 @@ protected: motor_state _motor_state = motor_state::DISABLED; + + + /** + * @brief Sets mc motor minimum pwm to VT_IDLE_PWM_MC which ensures + * that they are spinning in mc mode. + * + * @return true on success + */ bool set_idle_mc(); + + /** + * @brief Sets mc motor minimum pwm to PWM_MIN which ensures that the + * motors stop spinning on zero throttle in fw mode. + * + * @return true on success + */ bool set_idle_fw(); + + /** + * @brief Sets state of a selection of motors, see struct motor_state + * + * @param[in] current_state The current motor state + * @param[in] next_state The next state + * @param[in] value Desired pwm value if next_state = + * motor_state::VALUE + * + * @return next_state if succesfull, otherwise current_state + */ motor_state set_motor_state(const motor_state current_state, const motor_state next_state, const int value = 0); private: + + /** + * @brief Stores the max pwm values given by the system. + */ struct pwm_output_values _max_mc_pwm_values {}; struct pwm_output_values _disarmed_pwm_values {}; + + + /** + * @brief Determines if this channel is one selected by VT_FW_MOT_OFFID + * + * @param[in] channel The channel + * + * @return True if motor off channel, False otherwise. + */ bool is_motor_off_channel(const int channel); };