modules: lpe: refactor fusion bitmask

This commit is contained in:
TSC21
2018-01-14 15:11:49 -05:00
committed by Lorenz Meier
parent 1c74887a68
commit b512759336
3 changed files with 12 additions and 28 deletions
@@ -180,20 +180,16 @@ BlockLocalPositionEstimator::BlockLocalPositionEstimator() :
// print fusion settings to console
printf("[lpe] fuse gps: %d, flow: %d, vis_pos: %d, "
"vis_yaw: %d, land: %d, pub_agl_z: %d, flow_gyro: %d, "
"baro: %d, landing_target: %d, mocap: %d, lidar: %d, sonar: %d\n",
"landing_target: %d, land: %d, pub_agl_z: %d, flow_gyro: %d, "
"baro: %d\n",
(_fusion.get() & FUSE_GPS) != 0,
(_fusion.get() & FUSE_FLOW) != 0,
(_fusion.get() & FUSE_VIS_POS) != 0,
(_fusion.get() & FUSE_VIS_YAW) != 0,
(_fusion.get() & FUSE_LAND_TARGET) != 0,
(_fusion.get() & FUSE_LAND) != 0,
(_fusion.get() & FUSE_PUB_AGL_Z) != 0,
(_fusion.get() & FUSE_FLOW_GYRO_COMP) != 0,
(_fusion.get() & FUSE_BARO) != 0,
(_fusion.get() & FUSE_LAND_TARGET) != 0,
(_fusion.get() & FUSE_MOCAP) != 0,
(_fusion.get() & FUSE_LIDAR) != 0,
(_fusion.get() & FUSE_SONAR) != 0);
(_fusion.get() & FUSE_BARO) != 0);
}
BlockLocalPositionEstimator::~BlockLocalPositionEstimator()
@@ -303,9 +299,9 @@ void BlockLocalPositionEstimator::update()
bool flowUpdated = (_fusion.get() & FUSE_FLOW) && _sub_flow.updated();
bool gpsUpdated = (_fusion.get() & FUSE_GPS) && _sub_gps.updated();
bool visionUpdated = (_fusion.get() & FUSE_VIS_POS) && _sub_vision_pos.updated();
bool mocapUpdated = (_fusion.get() & FUSE_MOCAP) && _sub_mocap.updated();
bool lidarUpdated = (_fusion.get() & FUSE_LIDAR) && (_sub_lidar != nullptr) && _sub_lidar->updated();
bool sonarUpdated = (_fusion.get() & FUSE_SONAR) && (_sub_sonar != nullptr) && _sub_sonar->updated();
bool mocapUpdated = _sub_mocap.updated();
bool lidarUpdated = (_sub_lidar != nullptr) && _sub_lidar->updated();
bool sonarUpdated = (_sub_sonar != nullptr) && _sub_sonar->updated();
bool landUpdated = landed()
&& ((_timeStamp - _time_last_land) > 1.0e6f / LAND_RATE); // throttle rate