Line data Source code
1 : /* 2 : This program is free software: you can redistribute it and/or modify 3 : it under the terms of the GNU General Public License as published by 4 : the Free Software Foundation, either version 3 of the License, or 5 : (at your option) any later version. 6 : 7 : This program is distributed in the hope that it will be useful, 8 : but WITHOUT ANY WARRANTY; without even the implied warranty of 9 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 : GNU General Public License for more details. 11 : 12 : You should have received a copy of the GNU General Public License 13 : along with this program. If not, see <http://www.gnu.org/licenses/>. 14 : */ 15 : 16 : #pragma once 17 : 18 : #include <AP_Winch/AP_Winch_Backend.h> 19 : 20 : #if AP_WINCH_PWM_ENABLED 21 : 22 : class AP_Winch_PWM : public AP_Winch_Backend { 23 : public: 24 : 25 : using AP_Winch_Backend::AP_Winch_Backend; 26 : 27 : // true if winch is healthy 28 : bool healthy() const override; 29 : 30 : // control the winch 31 : void update() override; 32 : 33 : // returns current length of line deployed 34 1026 : float get_current_length() const override { return line_length; } 35 : 36 : // send status to ground station 37 : void send_status(const GCS_MAVLINK &channel) override; 38 : 39 : #if HAL_LOGGING_ENABLED 40 : // write log 41 : void write_log() override; 42 : #endif 43 : 44 : private: 45 : 46 : // update pwm outputs to control winch 47 : void control_winch(); 48 : 49 : uint32_t control_update_ms; // last time control_winch was called 50 : float line_length; // estimated length of line in meters 51 : }; 52 : 53 : #endif // AP_WINCH_PWM_ENABLED