Skip to content

Commit

Permalink
Rover land detection (#13769)
Browse files Browse the repository at this point in the history
* Land Enabled

* Declared Subscriptor in header as originally intended.

In the header it caused SIGSEGV in my machine so that's why it was moved
to .cpp

* Code Style fixed

* Removed confusing comments

* Comment update

Co-authored-by: Julian Oes <[email protected]>
  • Loading branch information
ealdaz-seesai and julianoes authored Apr 28, 2020
1 parent f78847b commit efa0e1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/land_detector/RoverLandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,23 @@
namespace land_detector
{


bool RoverLandDetector::_get_ground_contact_state()
{
return true;
}

bool RoverLandDetector::_get_landed_state()
{
return !_actuator_armed.armed;

_vehicle_status_sub.update(&_vehicle_status);

if (_vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LAND) {
return true; // If Landing has been requested then say we have landed.

} else {
return !_actuator_armed.armed; // If we are armed we are not landed.
}
}

} // namespace land_detector
5 changes: 5 additions & 0 deletions src/modules/land_detector/RoverLandDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#pragma once

#include "LandDetector.h"
#include <uORB/topics/vehicle_status.h>

namespace land_detector
{
Expand All @@ -56,7 +57,11 @@ class RoverLandDetector : public LandDetector
bool _get_ground_contact_state() override;
bool _get_landed_state() override;


private:
// Program crashes when Subscriptor declared here
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
vehicle_status_s _vehicle_status{}; /**< vehicle status */

};

Expand Down

0 comments on commit efa0e1b

Please sign in to comment.