Browse Source

Copter: add floating-point-constant designators

master
Peter Barker 6 years ago committed by Tom Pittenger
parent
commit
3b33f4ca4d
  1. 2
      ArduCopter/mode.cpp
  2. 6
      ArduCopter/mode.h
  3. 2
      ArduCopter/radio.cpp

2
ArduCopter/mode.cpp

@ -591,7 +591,7 @@ float Copter::Mode::get_pilot_desired_throttle() const
throttle_in = 0.5f + ((float)(throttle_control-mid_stick)) * 0.5f / (float)(1000-mid_stick); throttle_in = 0.5f + ((float)(throttle_control-mid_stick)) * 0.5f / (float)(1000-mid_stick);
} }
float expo = constrain_float(-(thr_mid-0.5)/0.375, -0.5f, 1.0f); const float expo = constrain_float(-(thr_mid-0.5f)/0.375f, -0.5f, 1.0f);
// calculate the output throttle using the given expo function // calculate the output throttle using the given expo function
float throttle_out = throttle_in*(1.0f-expo) + expo*throttle_in*throttle_in*throttle_in; float throttle_out = throttle_in*(1.0f-expo) + expo*throttle_in*throttle_in*throttle_in;
return throttle_out; return throttle_out;

6
ArduCopter/mode.h

@ -669,13 +669,13 @@ private:
void update_height_estimate(void); void update_height_estimate(void);
// minimum assumed height // minimum assumed height
const float height_min = 0.1; const float height_min = 0.1f;
// maximum scaling height // maximum scaling height
const float height_max = 3.0; const float height_max = 3.0f;
AP_Float flow_max; AP_Float flow_max;
AC_PI_2D flow_pi_xy{0.2, 0.3, 3000, 5, 0.0025}; AC_PI_2D flow_pi_xy{0.2f, 0.3f, 3000, 5, 0.0025f};
AP_Float flow_filter_hz; AP_Float flow_filter_hz;
AP_Int8 flow_min_quality; AP_Int8 flow_min_quality;
AP_Int8 brake_rate_dps; AP_Int8 brake_rate_dps;

2
ArduCopter/radio.cpp

@ -206,7 +206,7 @@ void Copter::radio_passthrough_to_motors()
{ {
motors->set_radio_passthrough(channel_roll->norm_input(), motors->set_radio_passthrough(channel_roll->norm_input(),
channel_pitch->norm_input(), channel_pitch->norm_input(),
channel_throttle->get_control_in_zero_dz()*0.001, channel_throttle->get_control_in_zero_dz()*0.001f,
channel_yaw->norm_input()); channel_yaw->norm_input());
} }

Loading…
Cancel
Save