AP_OpticalFlow: move simulated height_agl into fdm structure

allows value to be shipped via multicast to simulated peripherals
This commit is contained in:
Peter Barker 2024-01-08 13:07:46 +11:00 committed by Andrew Tridgell
parent 7201eae4ed
commit b1311d6d25
1 changed files with 2 additions and 2 deletions

View File

@ -64,9 +64,9 @@ void AP_OpticalFlow_SITL::update(void)
// estimate range to centre of image // estimate range to centre of image
float range; float range;
if (rotmat.c.z > 0.05f && _sitl->height_agl > 0) { if (rotmat.c.z > 0.05f && _sitl->state.height_agl > 0) {
Vector3f relPosSensorEF = rotmat * posRelSensorBF; Vector3f relPosSensorEF = rotmat * posRelSensorBF;
range = (_sitl->height_agl - relPosSensorEF.z) / rotmat.c.z; range = (_sitl->state.height_agl - relPosSensorEF.z) / rotmat.c.z;
} else { } else {
range = 1e38f; range = 1e38f;
} }