ardupilot/libraries/APO/AP_ArmingMechanism.h

70 lines
1.7 KiB
C
Raw Normal View History

2011-10-19 01:21:19 -03:00
/*
* AP_ArmingMechanism.h
*
*/
#ifndef AP_ARMINGMECHANISM_H_
#define AP_ARMINGMECHANISM_H_
#include <inttypes.h>
#include <wiring.h>
namespace apo {
class AP_HardwareAbstractionLayer;
class AP_Controller;
2011-10-19 01:21:19 -03:00
class AP_ArmingMechanism {
public:
2011-10-19 01:25:00 -03:00
/**
* Constructor
*
* @param ch1: typically throttle channel
* @param ch2: typically yaw channel
* @param ch1Min: disarms/arms belows this
* @param ch2Min: disarms below this
* @param ch2Max: arms above this
*/
AP_ArmingMechanism(AP_HardwareAbstractionLayer * hal, AP_Controller * controller,
2011-10-26 13:31:11 -03:00
uint8_t ch1, uint8_t ch2, float ch1Min, float ch2Min,
float ch2Max) : _armingClock(0), _hal(hal), _controller(controller),
_ch1(ch1), _ch2(ch2), _ch1Min(ch1Min), _ch2Min(ch2Min), _ch2Max(ch2Max) {
2011-10-19 01:25:00 -03:00
}
2011-10-19 01:21:19 -03:00
2011-10-19 01:25:00 -03:00
/**
* update
*
* arming:
2011-10-26 13:31:11 -03:00
*
2011-10-19 01:25:00 -03:00
* to arm: put stick to bottom right for 100 controller cycles
* (max yaw, min throttle)
*
* didn't use clock here in case of millis() roll over
* for long runs
*
* disarming:
*
* to disarm: put stick to bottom left for 100 controller cycles
* (min yaw, min throttle)
*/
void update(const float dt);
2011-10-19 01:21:19 -03:00
private:
2011-10-19 01:25:00 -03:00
AP_HardwareAbstractionLayer * _hal;
AP_Controller * _controller;
int8_t _armingClock;
2011-10-19 01:25:00 -03:00
uint8_t _ch1; /// typically throttle channel
uint8_t _ch2; /// typically yaw channel
float _ch1Min; /// arms/disarms below this on ch1
float _ch2Min; /// disarms below this on ch2
float _ch2Max; /// arms above this on ch2
2011-10-19 01:21:19 -03:00
};
} // namespace apo
#endif /* AP_ARMINGMECHANISM */
2011-10-19 01:25:00 -03:00
// vim:ts=4:sw=4:expandtab