ardupilot/libraries/AP_IRLock/IRLock.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
533 B
C++
Raw Permalink Normal View History

/*
* IRLock.cpp
*
* Created on: Nov 12, 2014
* Author: MLandes
*/
#include "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 IRLock::get_unit_vector_body(Vector3f& ret) const
{
// 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;
}