nabeel1993raza / arducopter

Automatically exported from code.google.com/p/arducopter
0 stars 0 forks source link

radio tuning can zero a tuning parameter causing a (physical) crash. #416

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Arducoper NG or ACM?
What steps will reproduce the problem?
1.Set TUNE to 4, TUNE_HIGH to 0.2, TUNE_LOW to 0.1
2.Turn CH_6 knob to lowest setting.
3.Wait for vehicle to plummet to the ground.

What is the expected output? What do you see instead?
Level flight.  Crash.

What version of the product are you using? On what operating system?
DIYDrones Hexacopter kit.  ArduCopter V2.5.4, V2.5.5b compiled from source with 
cmake on Ubuntu Linux 11.04

Please provide any additional information below.

This bug cost me six propellers, three motors, two arms, and a sonic 
rangefinder.

This is an issue with the way the RC_Channel.cpp library works.  It will return 
zero if the pwm ever drops below the calibrated minimum (quite likely):

int16_t
RC_Channel::pwm_to_range()
{
    int radio_trim_low  = radio_min + _dead_zone;

    if(radio_in > radio_trim_low)
        return (_low + ((long)(_high - _low) * (long)(radio_in - radio_trim_low)) / (long)(radio_max - radio_trim_low));
    else
        return 0;
}

Adding a dead zone would make it worse.

Then there is this line in RC_Channel::set_pwm() that could cause some problems:

    control_in = (control_in < _dead_zone) ? 0 : control_in;

I think this line is completely bogus, because control_in is a range value, and 
_dead_zone is a pwm value.  It makes no sense to compare them.  

This line above it, which has been commented out, makes a lot more sense:

    //control_in = constrain(control_in, _low, _high);

Original issue reported on code.google.com by bob.ardu...@hotmail.com on 13 May 2012 at 9:48

GoogleCodeExporter commented 8 years ago
Function RC_Channel.cpp (line 249) should return _low when radio_in <= 
radio_trim_low :

if(radio_in > radio_trim_low)
        return (_low + ((long)(_high - _low) * (long)(radio_in - radio_trim_low)) / (long)(radio_max - radio_trim_low));
    else
        return _low;

Original comment by airma...@gmail.com on 14 May 2012 at 1:51

GoogleCodeExporter commented 8 years ago

Original comment by rmackay...@gmail.com on 1 Jun 2012 at 2:11

GoogleCodeExporter commented 8 years ago
It's in the trunk now.
Jason

Original comment by jasonshort on 1 Jun 2012 at 3:28