bekem / multiwii

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

Manual control of camera servo gimbal #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For controlling the tilt/roll (or tilt/pan) of a servo gimbal via RC channel(s)

ot sure if this is already handled in the beta versions/forks, but I have found 
this works well, with or with out cam stabiisation:

In config.h
    #define SERVO_TILT   // Existing code
    #define CAM_TILT_CHAN AUX4  // Select RC channel to control gimbal tilt
    #define CAM_ROLL_CHAN YAW  // Select RC channel to control gimbal roll

In Output.cpp
  #if defined(SERVO_TILT)  // Existing code
    servo[0] = get_middle(0);  
    servo[1] = get_middle(1);
    if (rcOptions[BOXCAMSTAB]) {
      servo[0] += ((int32_t)conf.servoConf[0].rate * att.angle[PITCH]) /50L;
      servo[1] += ((int32_t)conf.servoConf[1].rate * att.angle[ROLL])  /50L;
    }
    // Direct camera tilt/pan, additive - new code
#ifdef CAM_PITCH_CHAN
    servo[0] += constrain(rcData[CAM_PITCH_CHAN],900,2100)-MIDRC;
#endif
#ifdef CAM_ROLL_CHAN
    servo[1] += constrain(rcData[CAM_ROLL_CHAN],900,2100)-MIDRC;
#endif

Original issue reported on code.google.com by pwbec...@hotmail.com on 8 Feb 2015 at 8:03

GoogleCodeExporter commented 9 years ago
Not getting any movement of servos on s1 (aux3) or s2 (aux4). Dump attached.

Original comment by ElderChe...@gmail.com on 17 Apr 2015 at 11:35

Attachments: