Browse Source

vtol_att_control: switch from division to multiplication for variable

calculation

Signed-off-by: Roman <bapstroman@gmail.com>
sbg
Roman 7 years ago committed by Roman Bapst
parent
commit
1d8f588d37
  1. 4
      src/modules/vtol_att_control/standard.cpp
  2. 2
      src/modules/vtol_att_control/tailsitter.cpp
  3. 4
      src/modules/vtol_att_control/tiltrotor.cpp

4
src/modules/vtol_att_control/standard.cpp

@ -119,7 +119,7 @@ void Standard::update_vtol_state() @@ -119,7 +119,7 @@ void Standard::update_vtol_state()
*/
float mc_weight = _mc_roll_weight;
float time_since_trans_start = ((float)(hrt_absolute_time() - _vtol_schedule.transition_start)) / 1e6f;
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
if (!_attc->is_fixed_wing_requested()) {
@ -232,7 +232,7 @@ void Standard::update_vtol_state() @@ -232,7 +232,7 @@ void Standard::update_vtol_state()
void Standard::update_transition_state()
{
float mc_weight = 1.0f;
float time_since_trans_start = ((float)(hrt_absolute_time() - _vtol_schedule.transition_start)) / 1e6f;
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
VtolType::update_transition_state();

2
src/modules/vtol_att_control/tailsitter.cpp

@ -175,7 +175,7 @@ void Tailsitter::update_vtol_state() @@ -175,7 +175,7 @@ void Tailsitter::update_vtol_state()
void Tailsitter::update_transition_state()
{
float time_since_trans_start = ((float)(hrt_absolute_time() - _vtol_schedule.transition_start)) / 1e6f;
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
if (!_flag_was_in_trans_mode) {
// save desired heading for transition and last thrust value

4
src/modules/vtol_att_control/tiltrotor.cpp

@ -179,7 +179,7 @@ void Tiltrotor::update_vtol_state() @@ -179,7 +179,7 @@ void Tiltrotor::update_vtol_state()
// allow switch if we are not armed for the sake of bench testing
bool transition_to_p2 = can_transition_on_ground();
float time_since_trans_start = ((float)(hrt_absolute_time() - _vtol_schedule.transition_start)) / 1e6f;
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
// check if we have reached airspeed to switch to fw mode
transition_to_p2 |= !_params->airspeed_disabled &&
@ -279,7 +279,7 @@ void Tiltrotor::update_transition_state() @@ -279,7 +279,7 @@ void Tiltrotor::update_transition_state()
{
VtolType::update_transition_state();
float time_since_trans_start = ((float)(hrt_absolute_time() - _vtol_schedule.transition_start)) / 1e6f;
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
if (!_flag_was_in_trans_mode) {
// save desired heading for transition and last thrust value

Loading…
Cancel
Save