2015-05-31 23:53:30 -03:00
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
antenna-tracker simulator class
|
|
|
|
*/
|
|
|
|
|
2015-10-22 11:04:23 -03:00
|
|
|
#pragma once
|
2015-05-31 23:53:30 -03:00
|
|
|
|
|
|
|
#include "SIM_Aircraft.h"
|
|
|
|
|
2015-10-22 10:04:42 -03:00
|
|
|
namespace SITL {
|
|
|
|
|
2015-05-31 23:53:30 -03:00
|
|
|
/*
|
|
|
|
a antenna tracker simulator
|
|
|
|
*/
|
2015-10-22 10:15:34 -03:00
|
|
|
class Tracker : public Aircraft {
|
2015-05-31 23:53:30 -03:00
|
|
|
public:
|
2020-09-22 19:44:18 -03:00
|
|
|
using Aircraft::Aircraft;
|
|
|
|
|
2019-02-21 19:12:05 -04:00
|
|
|
void update(const struct sitl_input &input) override;
|
2015-05-31 23:53:30 -03:00
|
|
|
|
|
|
|
/* static object creator */
|
2019-08-15 01:01:24 -03:00
|
|
|
static Aircraft *create(const char *frame_str) {
|
2024-05-26 22:24:16 -03:00
|
|
|
return NEW_NOTHROW Tracker(frame_str);
|
2015-05-31 23:53:30 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
const bool onoff = false;
|
|
|
|
const float yawrate = 9.0f;
|
|
|
|
const float pitchrate = 1.0f;
|
|
|
|
const float pitch_range = 45;
|
|
|
|
const float yaw_range = 170;
|
2015-06-01 01:08:45 -03:00
|
|
|
const float zero_yaw = 270; // yaw direction at startup
|
|
|
|
const float zero_pitch = 10; // pitch at startup
|
2020-09-22 19:44:18 -03:00
|
|
|
uint64_t last_debug_us;
|
2015-05-31 23:53:30 -03:00
|
|
|
|
|
|
|
float pitch_input;
|
|
|
|
float yaw_input;
|
2015-06-01 01:08:45 -03:00
|
|
|
float yaw_current_relative;
|
|
|
|
float pitch_current_relative;
|
2015-05-31 23:53:30 -03:00
|
|
|
|
2021-02-01 12:37:57 -04:00
|
|
|
void update_position_servos(float delta_time, float &yaw_rate, float &pitch_rate) const;
|
|
|
|
void update_onoff_servos(float &yaw_rate, float &pitch_rate) const;
|
2015-05-31 23:53:30 -03:00
|
|
|
};
|
|
|
|
|
2015-10-22 10:04:42 -03:00
|
|
|
} // namespace SITL
|