Example #1
0
        public Task SetPositionTargetGlobalInt(uint timeBootMs, MavFrame coordinateFrame, int latInt, int lonInt, float alt,
                                               float vx, float vy, float vz, float afx, float afy, float afz, float yaw,
                                               float yawRate, PositionTargetTypemask typeMask, CancellationToken cancel)
        {
            var packet = new SetPositionTargetGlobalIntPacket
            {
                ComponenId = _config.ComponentId,
                SystemId   = _config.SystemId,
                Payload    =
                {
                    TimeBootMs      = timeBootMs,
                    TargetSystem    = _config.TargetSystemId,
                    TargetComponent = _config.TargetComponentId,
                    CoordinateFrame = coordinateFrame,
                    LatInt          = latInt,
                    LonInt          = lonInt,
                    Alt             = alt,
                    Vx       = vx,
                    Vy       = vy,
                    Vz       = vz,
                    Afx      = afx,
                    Afy      = afy,
                    Afz      = afz,
                    Yaw      = yaw,
                    YawRate  = yawRate,
                    TypeMask = typeMask,
                }
            };

            return(_connection.Send(packet, cancel));
        }
Example #2
0
 public Task SetPositionTargetGlobalInt(uint timeBootMs, MavFrame coordinateFrame, int latInt, int lonInt, float alt,
                                        float vx, float vy, float vz, float afx, float afy, float afz, float yaw,
                                        float yawRate, PositionTargetTypemask typeMask, CancellationToken cancel)
 {
     Logger.Debug($"{LogSend} {nameof(SetPositionTargetGlobalInt)} ");
     return(InternalSend <SetPositionTargetGlobalIntPacket>(_ =>
     {
         _.Payload.TimeBootMs = timeBootMs;
         _.Payload.TargetSystem = Identity.TargetSystemId;
         _.Payload.TargetComponent = Identity.TargetComponentId;
         _.Payload.CoordinateFrame = coordinateFrame;
         _.Payload.LatInt = latInt;
         _.Payload.LonInt = lonInt;
         _.Payload.Alt = alt;
         _.Payload.Vx = vx;
         _.Payload.Vy = vy;
         _.Payload.Vz = vz;
         _.Payload.Afx = afx;
         _.Payload.Afy = afy;
         _.Payload.Afz = afz;
         _.Payload.Yaw = yaw;
         _.Payload.YawRate = yawRate;
         _.Payload.TypeMask = typeMask;
     }, cancel));
 }
        public static Task SetPositionTargetLocalNed(this IMavlinkOffboardMode src, uint timeBootMs, MavFrame coordinateFrame, float?x,
                                                     float?y, float?z, float?vx, float?vy, float?vz, float?afx, float?afy, float?afz, float?yaw, float?yawRate,
                                                     CancellationToken cancel)
        {
            PositionTargetTypemask mask = 0;

            if (!x.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskXIgnore;
            }
            if (!y.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskYIgnore;
            }
            if (!z.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskZIgnore;
            }

            if (!vx.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskVxIgnore;
            }
            if (!vy.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskVyIgnore;
            }
            if (!vz.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskVzIgnore;
            }

            if (!afx.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskAxIgnore;
            }
            if (!afy.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskVyIgnore;
            }
            if (!afz.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskVzIgnore;
            }

            if (!yaw.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskYawIgnore;
            }
            if (!yawRate.HasValue)
            {
                mask |= PositionTargetTypemask.PositionTargetTypemaskYawRateIgnore;
            }

            return(src.SetPositionTargetLocalNed(timeBootMs, coordinateFrame, mask, x ?? 0, y ?? 0, z ?? 0, vx ?? 0, vy ?? 0, vz ?? 0, afx ?? 0, afy ?? 0, afz ?? 0, yaw ?? 0, yawRate ?? 0, cancel));
        }
 public async Task SetPositionTargetLocalNed(uint timeBootMs, MavFrame coordinateFrame, PositionTargetTypemask typeMask, float x,
                                             float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yawRate,
                                             CancellationToken cancel)
 {
     var packet = new SetPositionTargetLocalNedPacket
     {
         ComponenId = _config.ComponentId,
         SystemId   = _config.SystemId,
         Payload    =
         {
             TimeBootMs      = timeBootMs,
             TargetComponent = _config.TargetComponentId,
             TargetSystem    = _config.TargetSystemId,
             CoordinateFrame = coordinateFrame,
             TypeMask        = typeMask,
             X       = x,
             Y       = y,
             Z       = z,
             Vx      = vx,
             Vy      = vy,
             Vz      = vz,
             Afx     = afx,
             Afy     = afy,
             Afz     = afz,
             Yaw     = yaw,
             YawRate = yawRate,
         }
     };
     await _connection.Send(packet, cancel).ConfigureAwait(false);
 }
Example #5
0
 public Task SetPositionTargetLocalNed(uint timeBootMs, MavFrame coordinateFrame, PositionTargetTypemask typeMask, float x,
                                       float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yawRate,
                                       CancellationToken cancel)
 {
     return(InternalSend <SetPositionTargetLocalNedPacket>(_ =>
     {
         _.Payload.TimeBootMs = timeBootMs;
         _.Payload.TargetComponent = Identity.TargetComponentId;
         _.Payload.TargetSystem = Identity.TargetSystemId;
         _.Payload.CoordinateFrame = coordinateFrame;
         _.Payload.TypeMask = typeMask;
         _.Payload.X = x;
         _.Payload.Y = y;
         _.Payload.Z = z;
         _.Payload.Vx = vx;
         _.Payload.Vy = vy;
         _.Payload.Vz = vz;
         _.Payload.Afx = afx;
         _.Payload.Afy = afy;
         _.Payload.Afz = afz;
         _.Payload.Yaw = yaw;
         _.Payload.YawRate = yawRate;
     }, cancel));
 }