2016-02-17 21:25:09 -04:00
|
|
|
#pragma once
|
2015-02-16 00:37:13 -04:00
|
|
|
|
2015-08-28 05:11:52 -03:00
|
|
|
#include <AP_Common/AP_Common.h>
|
|
|
|
#include <AP_Math/AP_Math.h>
|
|
|
|
#include <AC_PrecLand/AC_PrecLand_Backend.h>
|
|
|
|
#include <AP_IRLock/AP_IRLock.h>
|
2015-02-16 00:37:13 -04:00
|
|
|
|
2016-09-14 20:31:16 -03:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
|
|
#include <AP_IRLock/AP_IRLock_SITL.h>
|
|
|
|
#endif
|
|
|
|
|
2015-09-01 21:10:04 -03:00
|
|
|
// this only builds for PX4 so far
|
2016-09-14 20:31:16 -03:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN || CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
2015-09-01 21:10:04 -03:00
|
|
|
|
2015-02-16 00:37:13 -04:00
|
|
|
/*
|
|
|
|
* AC_PrecLand_IRLock - implements precision landing using target vectors provided
|
|
|
|
* by a companion computer (i.e. Odroid) communicating via MAVLink
|
|
|
|
*/
|
|
|
|
|
|
|
|
class AC_PrecLand_IRLock : public AC_PrecLand_Backend
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
AC_PrecLand_IRLock(const AC_PrecLand& frontend, AC_PrecLand::precland_state& state);
|
2017-02-03 03:01:03 -04:00
|
|
|
|
2016-07-05 16:37:17 -03:00
|
|
|
// perform any required initialisation of backend
|
2017-02-03 03:01:03 -04:00
|
|
|
void init() override;
|
2015-02-16 00:37:13 -04:00
|
|
|
|
2016-07-05 16:37:17 -03:00
|
|
|
// retrieve updates from sensor
|
2017-02-03 03:01:03 -04:00
|
|
|
void update() override;
|
2016-07-05 16:37:17 -03:00
|
|
|
|
|
|
|
// provides a unit vector towards the target in body frame
|
|
|
|
// returns same as have_los_meas()
|
2017-02-03 03:01:03 -04:00
|
|
|
bool get_los_body(Vector3f& ret) override;
|
|
|
|
|
2016-07-05 16:37:17 -03:00
|
|
|
// returns system time in milliseconds of last los measurement
|
2017-02-03 03:01:03 -04:00
|
|
|
uint32_t los_meas_time_ms() override;
|
|
|
|
|
2016-07-05 16:37:17 -03:00
|
|
|
// return true if there is a valid los measurement available
|
2017-02-03 03:01:03 -04:00
|
|
|
bool have_los_meas() override;
|
2015-09-11 08:00:18 -03:00
|
|
|
|
2015-02-16 00:37:13 -04:00
|
|
|
private:
|
2016-11-26 01:22:32 -04:00
|
|
|
AP_IRLock_I2C irlock;
|
2016-09-14 20:31:16 -03:00
|
|
|
|
2016-07-05 16:37:17 -03:00
|
|
|
Vector3f _los_meas_body; // unit vector in body frame pointing towards target
|
|
|
|
bool _have_los_meas; // true if there is a valid measurement from the camera
|
|
|
|
uint32_t _los_meas_time_ms; // system time in milliseconds when los was measured
|
2015-02-16 00:37:13 -04:00
|
|
|
};
|
2015-09-01 21:10:04 -03:00
|
|
|
#endif
|