-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feedback to commander
- Loading branch information
Showing
6 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Current status of a Navigator mode | ||
# The possible values of nav_state are defined in the VehicleStatus msg. | ||
uint64 timestamp # time since system start (microseconds) | ||
|
||
uint8 nav_state # Source mode (values in VehicleStatus) | ||
bool failure # True when the current mode cannot continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
* @author Julian Oes <[email protected]> | ||
* @author Anton Babushkin <[email protected]> | ||
* @author Thomas Gubler <[email protected]> | ||
* and many more... | ||
*/ | ||
|
||
#include "navigator.h" | ||
|
@@ -897,6 +898,8 @@ void Navigator::run() | |
publish_mission_result(); | ||
} | ||
|
||
publish_navigator_status(); | ||
|
||
_geofence.run(); | ||
|
||
perf_end(_loop_perf); | ||
|
@@ -1355,6 +1358,40 @@ void Navigator::set_mission_failure_heading_timeout() | |
} | ||
} | ||
|
||
void Navigator::trigger_failsafe(const uint8_t nav_state) | ||
{ | ||
if (!_navigator_status.failure || _navigator_status.nav_state != nav_state) { | ||
_navigator_status.failure = true; | ||
_navigator_status.nav_state = nav_state; | ||
|
||
_navigator_status_updated = true; | ||
} | ||
} | ||
|
||
void Navigator::publish_navigator_status() | ||
{ | ||
uint8_t current_nav_state = _vstatus.nav_state; | ||
|
||
if (_navigation_mode != nullptr) { | ||
current_nav_state = _navigation_mode->getNavigatorStateId(); | ||
} | ||
|
||
if (_navigator_status.nav_state != current_nav_state) { | ||
_navigator_status.nav_state = current_nav_state; | ||
_navigator_status.failure = false; | ||
_navigator_status_updated = true; | ||
} | ||
|
||
if (_navigator_status_updated | ||
|| (hrt_elapsed_time(&_last_navigator_status_publication) > 500_ms)) { | ||
_navigator_status.timestamp = hrt_absolute_time(); | ||
_navigator_status_pub.publish(_navigator_status); | ||
|
||
_navigator_status_updated = false; | ||
_last_navigator_status_publication = hrt_absolute_time(); | ||
} | ||
} | ||
|
||
void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd) | ||
{ | ||
vcmd->timestamp = hrt_absolute_time(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters