Skip to content

Commit

Permalink
landing_target_estimator: Sensor offset from pr-nxp-uwb-driver
Browse files Browse the repository at this point in the history
  • Loading branch information
dvornikov-aa committed Dec 3, 2019
1 parent 8b9e52b commit ca61007
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/modules/landing_target_estimator/LandingTargetEstimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ LandingTargetEstimator::LandingTargetEstimator() :
_paramHandle.mode = param_find("LTEST_MODE");
_paramHandle.scale_x = param_find("LTEST_SCALE_X");
_paramHandle.scale_y = param_find("LTEST_SCALE_Y");
_paramHandle.offset_x = param_find("LTEST_OFFSET_X");
_paramHandle.offset_y = param_find("LTEST_OFFSET_Y");
_paramHandle.offset_x = param_find("LTEST_OFF_X");
_paramHandle.offset_y = param_find("LTEST_OFF_Y");
_paramHandle.sensor_offset_x = param_find("LTEST_S_OFF_X");
_paramHandle.sensor_offset_y = param_find("LTEST_S_OFF_Y");

// Initialize uORB topics.
_initialize_topics();
Expand Down Expand Up @@ -198,6 +200,19 @@ void LandingTargetEstimator::update()

_target_pose.is_static = (_params.mode == TargetMode::Stationary);

// offset the landing target in earth frame
x += _params.offset_x;
y += _params.offset_y;

// offset the landing target in body frame
matrix::Vector3f off;
off(0) = _params.sensor_offset_x;
off(1) = _params.sensor_offset_y;
off(2) = 0.0f;
off = _R_att * off;
x += off(0);
y += off(1);

_target_pose.rel_pos_valid = true;
_target_pose.rel_vel_valid = true;
_target_pose.x_rel = x;
Expand Down Expand Up @@ -322,6 +337,8 @@ void LandingTargetEstimator::_update_params()
param_get(_paramHandle.scale_y, &_params.scale_y);
param_get(_paramHandle.offset_x, &_params.offset_x);
param_get(_paramHandle.offset_y, &_params.offset_y);
param_get(_paramHandle.sensor_offset_x, &_params.sensor_offset_x);
param_get(_paramHandle.sensor_offset_y, &_params.sensor_offset_y);
}


Expand Down
4 changes: 4 additions & 0 deletions src/modules/landing_target_estimator/LandingTargetEstimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class LandingTargetEstimator
param_t scale_y;
param_t offset_x;
param_t offset_y;
param_t sensor_offset_x;
param_t sensor_offset_y;
} _paramHandle;

struct {
Expand All @@ -140,6 +142,8 @@ class LandingTargetEstimator
float scale_y;
float offset_x;
float offset_y;
float sensor_offset_x;
float sensor_offset_y;
} _params;

int _vehicleLocalPositionSub;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,51 @@ PARAM_DEFINE_FLOAT(LTEST_OFFSET_Y, 0.0f);
* @value 2 IR-Lock
*/
PARAM_DEFINE_INT32(LTEST_EN, 0);

/**
* Landing target X offset from estimated position in NED
*
* @unit m
* @min 0.0
* @max 100.0
* @decimal 2
*
* @group Landing target Estimator
*/
PARAM_DEFINE_FLOAT(LTEST_OFF_X, 0.0f);

/**
* Landing target Y offset from estimated position in NED
*
* @unit m
* @min 0.0
* @max 100.0
* @decimal 2
*
* @group Landing target Estimator
*/
PARAM_DEFINE_FLOAT(LTEST_OFF_Y, 0.0f);

/**
* Sensor X position offset in body frame
*
* @unit m
* @min 0.0
* @max 100.0
* @decimal 2
*
* @group Landing target Estimator
*/
PARAM_DEFINE_FLOAT(LTEST_S_OFF_X, 0.0f);

/**
* Sensor Y position offset in body frame
*
* @unit m
* @min 0.0
* @max 100.0
* @decimal 2
*
* @group Landing target Estimator
*/
PARAM_DEFINE_FLOAT(LTEST_S_OFF_Y, 0.0f);

0 comments on commit ca61007

Please sign in to comment.