ardupilot/libraries/AP_IRLock/AP_IRLock.cpp

32 lines
626 B
C++
Raw Normal View History

/*
* AP_IRLock.cpp
*
* Created on: Nov 12, 2014
* Author: MLandes
*/
#include "AP_IRLock_config.h"
#if AP_IRLOCK_ENABLED
2025-02-06 05:57:36 -04:00
#include "AP_IRLock.h"
2016-07-05 16:20:35 -03:00
// retrieve body frame unit vector in direction of target
// returns true if data is available
bool AP_IRLock::get_unit_vector_body(Vector3f& ret) const
2016-07-05 16:20:35 -03:00
{
// return false if we have no target
if (!_flags.healthy) {
2016-07-05 16:20:35 -03:00
return false;
}
// use data from first (largest) object
ret.x = -_target_info.pos_y;
ret.y = _target_info.pos_x;
ret.z = _target_info.pos_z;
2016-07-05 16:20:35 -03:00
ret /= ret.length();
return true;
}
#endif // AP_IRLOCK_ENABLED