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 : antenna-tracker simulator class 17 : */ 18 : 19 : #pragma once 20 : 21 : #include "SIM_Aircraft.h" 22 : 23 : namespace SITL { 24 : 25 : /* 26 : a antenna tracker simulator 27 : */ 28 : class Tracker : public Aircraft { 29 : public: 30 : using Aircraft::Aircraft; 31 : 32 : void update(const struct sitl_input &input) override; 33 : 34 : /* static object creator */ 35 33 : static Aircraft *create(const char *frame_str) { 36 33 : return NEW_NOTHROW Tracker(frame_str); 37 : } 38 : 39 : private: 40 : 41 : const bool onoff = false; 42 : const float yawrate = 9.0f; 43 : const float pitchrate = 1.0f; 44 : const float pitch_range = 45; 45 : const float yaw_range = 170; 46 : const float zero_yaw = 270; // yaw direction at startup 47 : const float zero_pitch = 10; // pitch at startup 48 : uint64_t last_debug_us; 49 : 50 : float pitch_input; 51 : float yaw_input; 52 : float yaw_current_relative; 53 : float pitch_current_relative; 54 : 55 : void update_position_servos(float delta_time, float &yaw_rate, float &pitch_rate) const; 56 : void update_onoff_servos(float &yaw_rate, float &pitch_rate) const; 57 : }; 58 : 59 : } // namespace SITL