ardupilot/libraries/SITL/SIM_Sprayer.h
Peter Barker 1915244960 SITL: correct compiler warning
In file included from ../../libraries/SITL/SIM_last_letter.cpp:19:
../../libraries/SITL/SIM_last_letter.h:74:17: warning: private field
'frame_str' is not used [-Wunused-private-field]
    const char *frame_str;

SITL: correct compiler warning

In file included from ../../libraries/SITL/SIM_Sprayer.cpp:19:
../../libraries/SITL/SIM_Sprayer.h:55:14: warning: private field
'start_time_us' is not used [-Wunused-private-field]
    uint64_t start_time_us;

SITL: correct compiler warnings

In file included from ../../libraries/SITL/SIM_Gripper_Servo.cpp:19:
../../libraries/SITL/SIM_Gripper_Servo.h:56:10: warning: private field
'zero_report_done' is not used [-Wunused-private-field]
    bool zero_report_done = false;

SITL: correct compiler warnings

In file included from ../../libraries/SITL/SIM_ADSB.cpp:19:
../../libraries/SITL/SIM_ADSB.h:49:28: warning: private field 'fdm' is
not used [-Wunused-private-field]
    const struct sitl_fdm &fdm;
2018-03-02 09:26:37 +09:00

62 lines
1.7 KiB
C++

/*
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/>.
*/
/*
simple sprayer simulation class
*/
#pragma once
#include "SIM_Aircraft.h"
namespace SITL {
class Sprayer {
public:
const uint8_t pump_servo;
const int8_t spinner_servo;
Sprayer(const uint8_t _pump_servo, int8_t _spinner_servo) :
pump_servo(_pump_servo),
spinner_servo(_spinner_servo)
{}
// update sprayer state
void update(const struct Aircraft::sitl_input &input);
float payload_mass() const { return capacity; }; // kg; water, so kg=l
private:
const uint32_t report_interval = 1000000; // microseconds
uint64_t last_report_us;
const float pump_max_rate = 0.01; // litres/second
const float pump_slew_rate = 20; // percent/scond
float last_pump_output; // percentage
const float spinner_max_rate = 3600; // degrees/second
const float spinner_slew_rate = 20; // percent/second
float last_spinner_output; // percentage
double capacity = 0.25; // litres
uint64_t last_update_us;
bool should_report();
bool zero_report_done = false;
};
}