kostakis52 / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

integer division problem in stabilize() #380

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I fixed a problem in stabilize():

speed_scaler = 0.5 + (THROTTLE_CRUISE / g.channel_throttle.servo_out / 2.0);    // 
First order taylor expansion of square root

does integer division on throttle_cruise/g.channel_throttle.servo_out and the 
value gets truncated to 0 or 1. So, something needs to be cast as a float.

Fixed:
speed_scaler = 0.5 + ((float)THROTTLE_CRUISE / g.channel_throttle.servo_out / 
2.0);   // First order taylor expansion of square root

Don't know where to put this.

Original issue reported on code.google.com by Mr.Challinger@gmail.com on 17 Jul 2011 at 6:48

GoogleCodeExporter commented 9 years ago
This change makes sense.

Original comment by hazy...@gmail.com on 18 Jul 2011 at 4:53

GoogleCodeExporter commented 9 years ago
Made the change

Original comment by analogue...@gmail.com on 19 Jul 2011 at 5:55

GoogleCodeExporter commented 9 years ago
Throttle is a really bad estimation of speed. Ideally this would be improved 
upon with an equation to estimate speed based on AOA, as well.

Original comment by Mr.Challinger@gmail.com on 19 Jul 2011 at 3:31