Pitch Gimbal: Limited range of motion?

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
spagoziak
Posts: 171
Joined: Thu Jan 20, 2011 1:18 am

Pitch Gimbal: Limited range of motion?

Post by spagoziak »

Hi folks,

I just enabled the pitch/roll function (below) and it works great! However, at about 45 or so degrees of pitch (no roll used on my rig), the gimbal returns to its neutral position. If I were flying pretty aggressively forward and happened to tilt past that point, my camera would snap up and I'd be watching the sky while my quad flew forward blindly...certainly not a good thing! Why does the gimbal function do this, and can I prevent it from happening? I love the feature, but I'm a bit nervous about this particular bit. ;)

Here's what I have enabled in the code:

Code: Select all

/* The following lines apply only for a pitch/roll tilt stabilization system */
/* It is not compatible with Y6 or HEX6 */
/* Uncomment the first line to activate it */
#define SERVO_TILT
#define TILT_PITCH_MIN    1020    //servo travel min, don't set it below 1020
#define TILT_PITCH_MAX    2000    //servo travel max, max value=2000
#define TILT_PITCH_MIDDLE 1500    //servo neutral value
#define TILT_PITCH_PROP   20      //servo proportional (tied to angle) ; can be negative to invert movement
#define TILT_ROLL_MIN     1020
#define TILT_ROLL_MAX     2000
#define TILT_ROLL_MIDDLE  1500
#define TILT_ROLL_PROP    10

bradleyk
Posts: 48
Joined: Wed Jan 19, 2011 10:58 pm

Re: Pitch Gimbal: Limited range of motion?

Post by bradleyk »

try
changing theese

#define TILT_PITCH_MIN 1020 //servo travel min, don't set it below 1020
#define TILT_PITCH_MAX 2000 //servo travel max, max value=2000


to

#define TILT_PITCH_MIN 1050 //servo travel min, don't set it below 1020
#define TILT_PITCH_MAX 1950 //servo travel max, max value=2000

spagoziak
Posts: 171
Joined: Thu Jan 20, 2011 1:18 am

Re: Pitch Gimbal: Limited range of motion?

Post by spagoziak »

I haven't had a chance to try that yet, but I'll report back on it when I do.

Meanwhile, I've noticed something else that's interesting but not bad--when I calibrate the gyros, the gimbal goes pretty crazy and settles down gradually over a few seconds. Is this normal?

bradleyk
Posts: 48
Joined: Wed Jan 19, 2011 10:58 pm

Re: Pitch Gimbal: Limited range of motion?

Post by bradleyk »

yes, have a look at the pic in the config, when you calibrate, it goes crazy as well, to i this it is trying to keep on working

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Pitch Gimbal: Limited range of motion?

Post by Alexinparis »

yes, it's because all the ACC are zeroed during the calibration process and the angle calculation is little bit lost.

spagoziak
Posts: 171
Joined: Thu Jan 20, 2011 1:18 am

Re: Pitch Gimbal: Limited range of motion?

Post by spagoziak »

Alexinparis wrote:yes, it's because all the ACC are zeroed during the calibration process and the angle calculation is little bit lost.


Cool, I figured it was something along those lines. Alex, I hope this project brings you a sense of pride... you have something here that's really special. Many of my non-multicopter friends are actively interested in what you're working on and how your latest developments have impacted my quadcopter. You've managed to make multicopters fascinating for folks who would otherwise have no interest in such things.

Well, and wow this controller is amazing. There's that, too.

spagoziak
Posts: 171
Joined: Thu Jan 20, 2011 1:18 am

Re: Pitch Gimbal: Limited range of motion?

Post by spagoziak »

bradleyk wrote:try
changing theese

#define TILT_PITCH_MIN 1020 //servo travel min, don't set it below 1020
#define TILT_PITCH_MAX 2000 //servo travel max, max value=2000


to

#define TILT_PITCH_MIN 1050 //servo travel min, don't set it below 1020
#define TILT_PITCH_MAX 1950 //servo travel max, max value=2000


Ok, tried it but it doesn't change that angle resetting around 45 degrees. In fact, I think it may have made it happen sooner. I tried changing proportional too, just in case... as expected, it just moves within its bounds faster or slower, but still snaps at the same limit.

My guess is that once the servo exceeds PITCH_MAX, it resets to PITCH_MIDDLE instead of just holding at MAX. Alex, does this sound about right? I wouldn't know what to look for in the code to answer it myself :?

spag

bradleyk
Posts: 48
Joined: Wed Jan 19, 2011 10:58 pm

Re: Pitch Gimbal: Limited range of motion?

Post by bradleyk »

what i said was as a test, not to solve it, i will have a quick look

bradleyk
Posts: 48
Joined: Wed Jan 19, 2011 10:58 pm

Re: Pitch Gimbal: Limited range of motion?

Post by bradleyk »

try this, then open the serial monitor and tell me what happens to temp? Then i might be able to help, because it shouldn't go back to middle

#ifdef SERVO_TILT
int temp = TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] *6 /100 ;
serial.println(" ");
serial.println(" ");
serial.print("TEMP:");
serial.println(temp);
servo[1] = constrain(temp, TILT_PITCH_MIN, TILT_PITCH_MAX);
servo[2] = constrain(TILT_ROLL_MIDDLE + TILT_ROLL_PROP * angle[ROLL] *6 /100 , TILT_ROLL_MIN, TILT_ROLL_MAX);
#endif


was this
#ifdef SERVO_TILT
servo[1] = constrain(TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] *6 /100 , TILT_PITCH_MIN, TILT_PITCH_MAX);
servo[2] = constrain(TILT_ROLL_MIDDLE + TILT_ROLL_PROP * angle[ROLL] *6 /100 , TILT_ROLL_MIN, TILT_ROLL_MAX);
#endif


use the serial monitor

bradleyk
Posts: 48
Joined: Wed Jan 19, 2011 10:58 pm

Re: Pitch Gimbal: Limited range of motion?

Post by bradleyk »

does your auto lvl work? look at the pic in the gui. does it go back to lvl when you go past 45? it shouldn't go past 45 in auto mode

Post Reply