使用osdk的RONIN-MX云台旋转不起作用

时间:2018-11-28 09:46:08

标签: dji-sdk

我正在开发Matrice600pro osdk软件。 我想将云台(RONIN-MX)偏航角设置为顺时针旋转90度。

我尝试使用此代码,但云台根本没有动弹。

我是通过参考DJI OSDK相机和相机样本编写此代码的。

我的代码怎么了?

任何帮助都会感激。

struct GimbalContainer
{
  int           roll             = 0;
  int           pitch            = 0;
  int           yaw              = 0;
  int           duration         = 0;
  int           isAbsolute       = 0;
  bool          yaw_cmd_ignore   = false;
  bool          pitch_cmd_ignore = false;
  bool          roll_cmd_ignore  = false;
};

int main(){

/*  omit vehicle initialization code */

    GimbalContainer    gimbal;
    gimbal.duration    = 0;
    gimbal.isAbsolute        = true;
    gimbal.yaw_cmd_ignore    = false;
    gimbal.roll_cmd_ignore    = false;
    gimbal.pitch_cmd_ignore    = false;

    gimbal.roll = 0;
    gimbal.pitch = 0;
    gimbal.yaw = 900;
    doSetGimbalAngle(gVehicle, &gimbal);

}

void doSetGimbalAngle(Vehicle* vehicle, GimbalContainer* gimbal)
{
    DJI::OSDK::Gimbal::AngleData gimbalAngle;

    gimbalAngle.roll     = gimbal->roll;
    gimbalAngle.pitch    = gimbal->pitch;
    gimbalAngle.yaw      = gimbal->yaw;
    gimbalAngle.duration = gimbal->duration;
    gimbalAngle.mode |= 0;
    gimbalAngle.mode |= gimbal->isAbsolute;
    gimbalAngle.mode |= gimbal->yaw_cmd_ignore << 1;
    gimbalAngle.mode |= gimbal->roll_cmd_ignore << 2;
    gimbalAngle.mode |= gimbal->pitch_cmd_ignore << 3;

    if(vehicle != NULL){
        vehicle->gimbal->setAngle(&gimbalAngle);
        sleep(4);
    }
} 

0 个答案:

没有答案