Camstab disable aux 3 and 4 and ideea SOLVED

Post Reply
Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Camstab disable aux 3 and 4 and ideea SOLVED

Post by Tazzy »

Hello
I'm test a camera gimbal on my hexa but don't want to use aux3 and 4 right now ( I need to use those to other functions) how can i disable this function in latest code v 2.1 ?

I think it is here in OUTPUT.pde i need to change but unfortunately im no coder lol

is it possible to get this settings in config file as an option to enable one or two aux and also an option to select what aux chans it use ...

/**************** Cam stabilize Sevos ******************/
#if defined(SERVO_TILT)
#if defined(A0_A1_PIN_HEX) && (NUMBER_MOTOR == 6) && defined(PROMINI)
#define S_PITCH servo[2]
#define S_ROLL servo[3]
#else
#define S_PITCH servo[0]
#define S_ROLL servo[1]
#endif
S_PITCH = TILT_PITCH_MIDDLE + rcData[AUX3]-1500;
S_ROLL = TILT_ROLL_MIDDLE + rcData[AUX4]-1500;
if (rcOptions[BOXCAMSTAB]) {
S_PITCH += TILT_PITCH_PROP * angle[PITCH] /16 ;
S_ROLL += TILT_ROLL_PROP * angle[ROLL] /16 ;
}
S_PITCH = constrain(S_PITCH, TILT_PITCH_MIN, TILT_PITCH_MAX);
S_ROLL = constrain(S_ROLL , TILT_ROLL_MIN, TILT_ROLL_MAX );
#endif

----------------------

//Tazzy
Last edited by Tazzy on Sat Sep 22, 2012 10:10 am, edited 1 time in total.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Camstab disable aux 3 and 4 and ideea

Post by shikra »

Ha - I had the same issue. I made some changes. Was going to post next week as suggestion. Select which ones can use. Will dig out over weekend.

arne
Posts: 23
Joined: Sun Feb 19, 2012 8:30 pm

Re: Camstab disable aux 3 and 4 and ideea

Post by arne »

I had the same issue: viewtopic.php?f=7&t=1507

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: Camstab disable aux 3 and 4 and ideea

Post by Tazzy »

arne wrote:I had the same issue: viewtopic.php?f=7&t=1507

Thanks allot Arne :D
It was exactly what i was looking for hope this can be moved in to rel version.

// Tazzy

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

r1227 will result in compile error

Post by doughboy »

r1227 should be changed so it is similar to the code for SERVO_TILT.
as it is now, it will result in compile error if TILT_PITCH_AUX_CH and/or TILT_ROLL_AUX_CH are not defined and SERVO_MIX_TILT is defined

the code for setting up S_PITCH and S_ROLL could be factored out as it is common to both SERVO_TILT and SERVO_MIX_TILT
like this

Code: Select all


  #if defined(SERVO_TILT) || defined(SERVO_MIX_TILT)
    #if defined(A0_A1_PIN_HEX) && (NUMBER_MOTOR == 6) && defined(PROMINI)
      #define S_PITCH servo[2]
      #define S_ROLL  servo[3]
    #else
      #define S_PITCH servo[0]
      #define S_ROLL  servo[1]
    #endif
    #ifdef TILT_PITCH_AUX_CH
       S_PITCH = TILT_PITCH_MIDDLE + rcData[TILT_PITCH_AUX_CH]-1500;
     #else
       S_PITCH = TILT_PITCH_MIDDLE;
     #endif
     #ifdef TILT_ROLL_AUX_CH
       S_ROLL  = TILT_ROLL_MIDDLE  + rcData[TILT_ROLL_AUX_CH]-1500;
     #else
       S_ROLL  = TILT_ROLL_MIDDLE;
     #endif
   #endif
   #ifdef SERVO_TILT
    if (rcOptions[BOXCAMSTAB]) {
      S_PITCH += TILT_PITCH_PROP * angle[PITCH] /16 ;
      S_ROLL  += TILT_ROLL_PROP  * angle[ROLL]  /16 ;
    }
    S_PITCH = constrain(S_PITCH, TILT_PITCH_MIN, TILT_PITCH_MAX);
    S_ROLL  = constrain(S_ROLL , TILT_ROLL_MIN, TILT_ROLL_MAX  );   
  #endif

  #if defined(MEGA) && defined(MEGA_HW_PWM_SERVOS) && !defined(FIXEDWING) && !defined(HELICOPTER) && (RC_CHANS>8)
    servo[3] = rcData[8];
    servo[4] = rcData[9];
  #endif
 
 /************************************************************************************************************/
 // Bledi Experimentals
 /************************************************************************************************************/
  #ifdef SERVO_MIX_TILT
   // Simple CameraGimbal By Bledy http://youtu.be/zKGr6iR54vM
    if (rcOptions[BOXCAMSTAB]) {
      servo[0] = constrain(TILT_PITCH_MIDDLE - (-TILT_ROLL_PROP) * angle[PITCH] /16 - TILT_ROLL_PROP * angle[ROLL] /16 , TILT_PITCH_MIN, TILT_PITCH_MAX);
      servo[1] = constrain(TILT_ROLL_MIDDLE + (-TILT_ROLL_PROP) * angle[PITCH] /16 - TILT_ROLL_PROP * angle[ROLL] /16 , TILT_ROLL_MIN, TILT_ROLL_MAX);
    } else {     
      S_PITCH = constrain(S_PITCH, TILT_PITCH_MIN, TILT_PITCH_MAX);
      S_ROLL  = constrain(S_ROLL , TILT_ROLL_MIN, TILT_ROLL_MAX  );   
    }
  #endif 

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by shikra »

Ok will take a look later when on pc. I thought I uploaded config.h with it defined as default.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by Sebbi »

I recently installed a gimbal on my copter and was a little confused about the difference between SERVO_MIX_TILT and SERVO_TILT. I was able to get what each of those defines does from the code, but maybe there should be some documentation in form of comments ;-)

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by shikra »

Yes .. Agree.
The tiltmix is is for when you have servos connected in the more unusual vtail type format. If that makes any sense!

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: r1227 will result in compile error

Post by shikra »

mmm. Can't find the issues...
I just tried enabling both tilt mix and tilt. Both compile fine with no errors for me.
config.h from r1219 had the tilt aux ch defined by default.

Possibly code could be reduced further. I'll take a look at your proposal.


doughboy wrote:r1227 should be changed so it is similar to the code for SERVO_TILT.
as it is now, it will result in compile error if TILT_PITCH_AUX_CH and/or TILT_ROLL_AUX_CH are not defined and SERVO_MIX_TILT is defined

the code for setting up S_PITCH and S_ROLL could be factored out as it is common to both SERVO_TILT and SERVO_MIX_TILT

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: r1227 will result in compile error

Post by doughboy »

if TILT_PITCH_AUX_CH and/or TILT_ROLL_AUX_CH are not defined and SERVO_MIX_TILT is defined, then this line is invalid.
you need to code it the way it is coded for SERVO_TILT. and since the code is essentially the same, you can factor it out. I already provided the correct code.

Code: Select all

 
         servo[2] = constrain(TILT_PITCH_MIDDLE  + rcData[TILT_PITCH_AUX_CH]-1500 , TILT_PITCH_MIN, TILT_PITCH_MAX);
         servo[3] = constrain(TILT_ROLL_MIDDLE   + rcData[TILT_ROLL_AUX_CH]-1500,  TILT_ROLL_MIN, TILT_ROLL_MAX);


shikra wrote:mmm. Can't find the issues...
I just tried enabling both tilt mix and tilt. Both compile fine with no errors for me.
config.h from r1219 had the tilt aux ch defined by default.

Possibly code could be reduced further. I'll take a look at your proposal.


doughboy wrote:r1227 should be changed so it is similar to the code for SERVO_TILT.
as it is now, it will result in compile error if TILT_PITCH_AUX_CH and/or TILT_ROLL_AUX_CH are not defined and SERVO_MIX_TILT is defined

the code for setting up S_PITCH and S_ROLL could be factored out as it is common to both SERVO_TILT and SERVO_MIX_TILT

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by shikra »

Hey Doughboy

I think I see what you refer too now....
If someone actually // the aux ch define out. Provide a default as per the text introduced previously.

I hadn't considered anyone would do that with the TILT MIX - since it will no longer work as a gimbal!! Both need to be working. Unlike the standard TILT.

This video explains the function well....
http://www.youtube.com/watch?v=zKGr6iR5 ... e=youtu.be

Does that make sense - or am I still missing something?

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by doughboy »

thanks for the clarification. I see how it works now.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by dramida »

An example of how Multiwii CAMSTAB works on roll-pitch axes i show here
http://www.youtube.com/watch?v=XbEjQSneakk

Thanks everyone for supporting me.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by shikra »

@doughboy - no problem - its an unusual config for sure. I think its worth a re-look at the code at some point. Most common comments I hear are around some anti-glitch / deadband for small errorangles.

@dramida - thats quite an impressive demo. I think best one I've seen on multiwii.

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by doughboy »

dramida wrote:An example of how Multiwii CAMSTAB works on roll-pitch axes i show here
http://www.youtube.com/watch?v=XbEjQSneakk

Thanks everyone for supporting me.


can you do a demo using aux3 and aux4 on potentiometer and using aux3 and aux4 to control gimbal pitch and roll?

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Camstab disable aux 3 and 4 and ideea SOLVED

Post by Federico »

I was trying to have the mix tilt on the dev 1129 but it's completely broken, I had on my pc the dev1240 and it's broken when disabling the aux channels but your code fix it (I have to try if it's working really but at least, it compiles) .

Now I have just downloaded the latest 1317, defined mix tilt and undefined the aux channels and... it's broken too!


Can someone fix this definitely in the next dev release ?
Thanks, Federico

Post Reply