Hello and welcome to our community! Is this your first visit?
Register
Results 1 to 3 of 3
  1. #1
    Senior Pilot KirAsh4's Avatar
    Join Date
    Mar 2011
    Location
    Boulder, CO
    Posts
    504
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    0

    Camera Stabilization Servos

    I'm making the assumption that the code for manipulating the stabilization servos is based on the assumption that the servos are driving the various planes directly. What if one is using gears to do that? For example, if the servo gear is smaller than the one that's actually attached to the plane being moved. How does one go about adjusting the code for that? (Not to mention that with 2 gears, the servo needs to run in reverse.)

  2. #2
    Senior Pilot
    Join Date
    Mar 2010
    Posts
    161
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    0
    From Camera.h

    Code:
    mCameraPitch = 11.11;   // scale angle to servo....  caculated as +/- 90 (ie 180) degrees maped to 1000-2000 
    mCameraRoll = 11.11;        
    mCameraYaw = 11.11;
    Those are the default values, and I just wanted to show you what the comment said

    To set them live, use the functions

    Code:
      void setmCameraPitch(float gear) {
        mCameraPitch = gear;
      }  
      
      void setmCameraRoll(float gear) {
        mCameraRoll = gear;        
      }
      
      void setmCameraYaw(float gear) {
        mCameraYaw = gear;
      }
    Also it looks like the configurator can set them

    Code:
          camera.setmCameraPitch(readFloatSerial());
          camera.setmCameraRoll(readFloatSerial());
          camera.setmCameraYaw(readFloatSerial());
    and if you read this bit of code from Camera.h

    Code:
      void setPitch (float angle) {
        if (mode == 1) servoPitch = constrain((mCameraPitch * angle) + centerPitch , servoMinPitch , servoMaxPitch);
        else servoPitch = constrain(centerPitch , servoMinPitch , servoMaxPitch);
      }
      
      void setRoll (float angle) {
        if (mode == 1) servoRoll = constrain((mCameraRoll * angle) + centerRoll , servoMinRoll , servoMaxRoll);
        else servoRoll = constrain(centerRoll , servoMinRoll , servoMaxRoll);
      }
      
      void setYaw (float angle) {
        if (mode == 1) servoYaw = constrain((mCameraYaw * angle) + centerYaw , servoMinYaw , servoMaxYaw);
        else servoYaw = constrain(centerYaw , servoMinYaw , servoMaxYaw);
      }
    you should realize that to reverse the servo, simply set a negative value

  3. #3
    Senior Pilot KirAsh4's Avatar
    Join Date
    Mar 2011
    Location
    Boulder, CO
    Posts
    504
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    0
    Awesome. It looks like for multiple gears, I may just have to play with the 11.11 defaults.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •