aboutsummaryrefslogtreecommitdiff
path: root/src/modules/navigator/offboard.cpp
diff options
context:
space:
mode:
authorJulian Oes <julian@oes.ch>2014-07-07 18:18:13 +0200
committerJulian Oes <julian@oes.ch>2014-07-07 18:18:13 +0200
commit3b06a74074f71c0700c6e7e9b56954213142aaeb (patch)
treee9e6a5507105c9dbe093ffad974f6762b0f8095a /src/modules/navigator/offboard.cpp
parent530e70bc4697a7e436a4cc9557ce38e139ee2795 (diff)
downloadpx4-firmware-3b06a74074f71c0700c6e7e9b56954213142aaeb.tar.gz
px4-firmware-3b06a74074f71c0700c6e7e9b56954213142aaeb.tar.bz2
px4-firmware-3b06a74074f71c0700c6e7e9b56954213142aaeb.zip
navigator: adapt offboard class to new NavigatorMode API
Diffstat (limited to 'src/modules/navigator/offboard.cpp')
-rw-r--r--src/modules/navigator/offboard.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/modules/navigator/offboard.cpp b/src/modules/navigator/offboard.cpp
index ef7d11a03..dcb5c6000 100644
--- a/src/modules/navigator/offboard.cpp
+++ b/src/modules/navigator/offboard.cpp
@@ -67,17 +67,27 @@ Offboard::~Offboard()
{
}
-bool
-Offboard::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
+void
+Offboard::on_inactive()
+{
+}
+
+void
+Offboard::on_activation()
+{
+}
+
+void
+Offboard::on_active()
{
+ struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet();
+
bool updated;
orb_check(_navigator->get_offboard_control_sp_sub(), &updated);
if (updated) {
update_offboard_control_setpoint();
}
- bool changed = false;
-
/* copy offboard setpoints to the corresponding topics */
if (_navigator->get_control_mode()->flag_control_position_enabled
&& _offboard_control_sp.mode == OFFBOARD_CONTROL_MODE_DIRECT_POSITION) {
@@ -91,7 +101,7 @@ Offboard::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
pos_sp_triplet->current.valid = true;
pos_sp_triplet->current.position_valid = true;
- changed = true;
+ _navigator->set_position_setpoint_triplet_updated();
} else if (_navigator->get_control_mode()->flag_control_velocity_enabled
&& _offboard_control_sp.mode == OFFBOARD_CONTROL_MODE_DIRECT_VELOCITY) {
@@ -105,16 +115,11 @@ Offboard::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
pos_sp_triplet->current.valid = true;
pos_sp_triplet->current.velocity_valid = true;
- changed = true;
+ _navigator->set_position_setpoint_triplet_updated();
}
- return changed;
}
-void
-Offboard::on_inactive()
-{
-}
void
Offboard::update_offboard_control_setpoint()