mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_OpticalFlow: SITL driver applies _FX/YSCALER params
This commit is contained in:
parent
2aa17916b1
commit
9313535a35
@ -86,12 +86,17 @@ void AP_OpticalFlow_SITL::update(void)
|
|||||||
// correct relative velocity for rotation rates and sensor offset
|
// correct relative velocity for rotation rates and sensor offset
|
||||||
relVelSensor += gyro % posRelSensorBF;
|
relVelSensor += gyro % posRelSensorBF;
|
||||||
|
|
||||||
|
// scaling based on parameters
|
||||||
|
const Vector2f flowScaler = _flowScaler();
|
||||||
|
const float flowScaleFactorX = 1.0f + 0.001f * flowScaler.x;
|
||||||
|
const float flowScaleFactorY = 1.0f + 0.001f * flowScaler.y;
|
||||||
|
|
||||||
// Divide velocity by range and add body rates to get predicted sensed angular
|
// Divide velocity by range and add body rates to get predicted sensed angular
|
||||||
// optical rates relative to X and Y sensor axes assuming no misalignment or scale
|
// optical rates relative to X and Y sensor axes assuming no misalignment or scale
|
||||||
// factor error. Note - these are instantaneous values. The sensor sums these values across the interval from the last
|
// factor error. Note - these are instantaneous values. The sensor sums these values across the interval from the last
|
||||||
// poll to provide a delta angle across the interface
|
// poll to provide a delta angle across the interface
|
||||||
state.flowRate.x = -relVelSensor.y/range + gyro.x + _sitl->flow_noise * rand_float();
|
state.flowRate.x = (-relVelSensor.y/range + gyro.x + _sitl->flow_noise * rand_float()) * flowScaleFactorX;
|
||||||
state.flowRate.y = relVelSensor.x/range + gyro.y + _sitl->flow_noise * rand_float();
|
state.flowRate.y = (relVelSensor.x/range + gyro.y + _sitl->flow_noise * rand_float()) * flowScaleFactorY;
|
||||||
|
|
||||||
// The flow sensors body rates are assumed to be the same as the vehicle body rates (ie no misalignment)
|
// The flow sensors body rates are assumed to be the same as the vehicle body rates (ie no misalignment)
|
||||||
// Note - these are instantaneous values. The sensor sums these values across the interval from the last
|
// Note - these are instantaneous values. The sensor sums these values across the interval from the last
|
||||||
|
Loading…
Reference in New Issue
Block a user