Skip to content

Commit

Permalink
Standardize class member variable naming convention in the LandDetect…
Browse files Browse the repository at this point in the history
…or class.
  • Loading branch information
mcsauder authored and dagar committed Jun 26, 2019
1 parent 6b6d824 commit df66224
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions src/modules/land_detector/LandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ LandDetector::LandDetector() :
ModuleParams(nullptr),
ScheduledWorkItem(px4::wq_configurations::hp_default)
{
_landDetected.timestamp = hrt_absolute_time();
_landDetected.freefall = false;
_landDetected.landed = true;
_landDetected.ground_contact = false;
_landDetected.maybe_landed = false;
_land_detected.timestamp = hrt_absolute_time();
_land_detected.freefall = false;
_land_detected.landed = true;
_land_detected.ground_contact = false;
_land_detected.maybe_landed = false;
}

LandDetector::~LandDetector()
Expand Down Expand Up @@ -95,30 +95,30 @@ void LandDetector::Run()
const hrt_abstime now = hrt_absolute_time();

// publish at 1 Hz, very first time, or when the result has changed
if ((hrt_elapsed_time(&_landDetected.timestamp) >= 1_s) ||
if ((hrt_elapsed_time(&_land_detected.timestamp) >= 1_s) ||
(_land_detected_pub == nullptr) ||
(_landDetected.landed != landDetected) ||
(_landDetected.freefall != freefallDetected) ||
(_landDetected.maybe_landed != maybe_landedDetected) ||
(_landDetected.ground_contact != ground_contactDetected) ||
(_landDetected.in_ground_effect != in_ground_effect) ||
(fabsf(_landDetected.alt_max - alt_max) > FLT_EPSILON)) {

if (!landDetected && _landDetected.landed) {
(_land_detected.landed != landDetected) ||
(_land_detected.freefall != freefallDetected) ||
(_land_detected.maybe_landed != maybe_landedDetected) ||
(_land_detected.ground_contact != ground_contactDetected) ||
(_land_detected.in_ground_effect != in_ground_effect) ||
(fabsf(_land_detected.alt_max - alt_max) > FLT_EPSILON)) {

if (!landDetected && _land_detected.landed) {
// We did take off
_takeoff_time = now;
}

_landDetected.timestamp = hrt_absolute_time();
_landDetected.landed = landDetected;
_landDetected.freefall = freefallDetected;
_landDetected.maybe_landed = maybe_landedDetected;
_landDetected.ground_contact = ground_contactDetected;
_landDetected.alt_max = alt_max;
_landDetected.in_ground_effect = in_ground_effect;
_land_detected.timestamp = hrt_absolute_time();
_land_detected.landed = landDetected;
_land_detected.freefall = freefallDetected;
_land_detected.maybe_landed = maybe_landedDetected;
_land_detected.ground_contact = ground_contactDetected;
_land_detected.alt_max = alt_max;
_land_detected.in_ground_effect = in_ground_effect;

int instance;
orb_publish_auto(ORB_ID(vehicle_land_detected), &_land_detected_pub, &_landDetected,
orb_publish_auto(ORB_ID(vehicle_land_detected), &_land_detected_pub, &_land_detected,
&instance, ORB_PRIO_DEFAULT);
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/land_detector/LandDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class LandDetector : public ModuleBase<LandDetector>, ModuleParams, px4::Schedul
static constexpr uint32_t LAND_DETECTOR_UPDATE_INTERVAL = 20_ms;

orb_advert_t _land_detected_pub{nullptr};
vehicle_land_detected_s _landDetected{};
vehicle_land_detected_s _land_detected{};

LandDetectionState _state{LandDetectionState::LANDED};

Expand Down

0 comments on commit df66224

Please sign in to comment.