Browse Source

Navigator: Only update params as they change

sbg
Lorenz Meier 8 years ago
parent
commit
ad3d0391ab
  1. 2
      src/modules/navigator/datalinkloss.cpp
  2. 3
      src/modules/navigator/enginefailure.cpp
  3. 2
      src/modules/navigator/follow_target.cpp
  4. 3
      src/modules/navigator/gpsfailure.cpp
  5. 3
      src/modules/navigator/mission.cpp
  6. 6
      src/modules/navigator/navigator_main.cpp
  7. 2
      src/modules/navigator/rcloss.cpp
  8. 3
      src/modules/navigator/rtl.cpp

2
src/modules/navigator/datalinkloss.cpp

@ -93,7 +93,6 @@ void
DataLinkLoss::on_activation() DataLinkLoss::on_activation()
{ {
_dll_state = DLL_STATE_NONE; _dll_state = DLL_STATE_NONE;
updateParams();
advance_dll(); advance_dll();
set_dll_item(); set_dll_item();
} }
@ -102,7 +101,6 @@ void
DataLinkLoss::on_active() DataLinkLoss::on_active()
{ {
if (is_mission_item_reached()) { if (is_mission_item_reached()) {
updateParams();
advance_dll(); advance_dll();
set_dll_item(); set_dll_item();
} }

3
src/modules/navigator/enginefailure.cpp

@ -96,9 +96,6 @@ EngineFailure::set_ef_item()
{ {
struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet(); struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet();
/* make sure we have the latest params */
updateParams();
set_previous_pos_setpoint(); set_previous_pos_setpoint();
_navigator->set_can_loiter_at_sp(false); _navigator->set_can_loiter_at_sp(false);

2
src/modules/navigator/follow_target.cpp

@ -100,8 +100,6 @@ void FollowTarget::on_inactive()
void FollowTarget::on_activation() void FollowTarget::on_activation()
{ {
updateParams();
_follow_offset = _param_tracking_dist.get() < 1.0F ? 1.0F : _param_tracking_dist.get(); _follow_offset = _param_tracking_dist.get() < 1.0F ? 1.0F : _param_tracking_dist.get();
_responsiveness = math::constrain((float) _param_tracking_resp.get(), .1F, 1.0F); _responsiveness = math::constrain((float) _param_tracking_resp.get(), .1F, 1.0F);

3
src/modules/navigator/gpsfailure.cpp

@ -89,7 +89,6 @@ GpsFailure::on_activation()
{ {
_gpsf_state = GPSF_STATE_NONE; _gpsf_state = GPSF_STATE_NONE;
_timestamp_activation = hrt_absolute_time(); _timestamp_activation = hrt_absolute_time();
updateParams();
advance_gpsf(); advance_gpsf();
set_gpsf_item(); set_gpsf_item();
} }
@ -160,8 +159,6 @@ GpsFailure::set_gpsf_item()
void void
GpsFailure::advance_gpsf() GpsFailure::advance_gpsf()
{ {
updateParams();
switch (_gpsf_state) { switch (_gpsf_state) {
case GPSF_STATE_NONE: case GPSF_STATE_NONE:
_gpsf_state = GPSF_STATE_LOITER; _gpsf_state = GPSF_STATE_LOITER;

3
src/modules/navigator/mission.cpp

@ -444,9 +444,6 @@ Mission::get_absolute_altitude_for_item(struct mission_item_s &mission_item)
void void
Mission::set_mission_items() Mission::set_mission_items()
{ {
/* make sure param is up to date */
updateParams();
/* reset the altitude foh (first order hold) logic, if altitude foh is enabled (param) a new foh element starts now */ /* reset the altitude foh (first order hold) logic, if altitude foh is enabled (param) a new foh element starts now */
altitude_sp_foh_reset(); altitude_sp_foh_reset();

6
src/modules/navigator/navigator_main.cpp

@ -278,6 +278,11 @@ Navigator::params_update()
{ {
parameter_update_s param_update; parameter_update_s param_update;
orb_copy(ORB_ID(parameter_update), _param_update_sub, &param_update); orb_copy(ORB_ID(parameter_update), _param_update_sub, &param_update);
updateParams();
if (_navigation_mode) {
_navigation_mode->updateParams();
}
} }
void void
@ -413,7 +418,6 @@ Navigator::task_main()
if (updated) { if (updated) {
params_update(); params_update();
updateParams();
} }
/* vehicle control mode updated */ /* vehicle control mode updated */

2
src/modules/navigator/rcloss.cpp

@ -83,7 +83,6 @@ void
RCLoss::on_activation() RCLoss::on_activation()
{ {
_rcl_state = RCL_STATE_NONE; _rcl_state = RCL_STATE_NONE;
updateParams();
advance_rcl(); advance_rcl();
set_rcl_item(); set_rcl_item();
} }
@ -92,7 +91,6 @@ void
RCLoss::on_active() RCLoss::on_active()
{ {
if (is_mission_item_reached()) { if (is_mission_item_reached()) {
updateParams();
advance_rcl(); advance_rcl();
set_rcl_item(); set_rcl_item();
} }

3
src/modules/navigator/rtl.cpp

@ -136,9 +136,6 @@ RTL::set_rtl_item()
{ {
struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet(); struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet();
/* make sure we have the latest params */
updateParams();
if (!_rtl_start_lock) { if (!_rtl_start_lock) {
set_previous_pos_setpoint(); set_previous_pos_setpoint();
} }

Loading…
Cancel
Save