• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Utilities.PointLatLngAlt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MissionPlanner.Utilities.PointLatLngAlt的典型用法代码示例。如果您正苦于以下问题:C# PointLatLngAlt类的具体用法?C# PointLatLngAlt怎么用?C# PointLatLngAlt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PointLatLngAlt类属于MissionPlanner.Utilities命名空间,在下文中一共展示了PointLatLngAlt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SendGrid

        void SendGrid(double lat, double lon, ushort grid_spacing, byte bit)
        {
            log.Info("SendGrid "+ lat + " " + lon + " space " + grid_spacing + " bit "+ bit);

            MAVLink.mavlink_terrain_data_t resp = new MAVLink.mavlink_terrain_data_t();
            resp.grid_spacing = grid_spacing;
            resp.lat = lastrequest.lat;
            resp.lon = lastrequest.lon;
            resp.gridbit = bit;
            resp.data = new short[16];

            for (int i = 0; i < (4 * 4); i++)
            {
                int y = i % 4;
                int x = i / 4;

                PointLatLngAlt plla = new PointLatLngAlt(lat, lon).location_offset(x * grid_spacing, y * grid_spacing);

                double alt = srtm.getAltitude(plla.Lat, plla.Lng);

                resp.data[i] = (short)alt;
            }

            MainV2.comPort.sendPacket(resp);
        }
开发者ID:newzealandpaul,项目名称:MissionPlanner,代码行数:25,代码来源:TerrainFollow.cs


示例2: calcspline

        public List<PointLatLngAlt> calcspline(PointLatLngAlt currentpos, PointLatLngAlt p1, PointLatLngAlt p2)
        {
            List<PointLatLngAlt> answer = new List<PointLatLngAlt>();

            spline_t = spline_t_sq = 0.0f;

            spline_p0 = currentpos;
            spline_p1 = p1;
            spline_p2 = p2;
            spline_p0_prime = new Vector3();
            double yaw = (currentpos.GetBearing(p1) + 360) % 360;
            spline_p0_prime.x = .000001 * Math.Sin(yaw * deg2rad);
            spline_p0_prime.y = .000001 * Math.Cos(yaw * deg2rad);
            spline_p0_prime.z = spline_p1.z - spline_p0.z;

            initialize_spline_segment();

            int steps = 30;

            foreach (var step in range(steps +1))
            {
                spline_t = (1f / steps) * step;
                spline_t_sq = spline_t * spline_t;
                evaluate_spline();
                answer.Add(new PointLatLngAlt(spline_target.x, spline_target.y, spline_target.z, ""));
            }

            return answer;
        }
开发者ID:Blackflappybird,项目名称:MissionPlanner,代码行数:29,代码来源:Spline.cs


示例3: getAirports

        public static List<PointLatLngAlt> getAirports(PointLatLngAlt centerpoint)
        {
            log.Info("getAirports " + centerpoint);

            // check if we have moved 66% from our last cache center point
            if (currentcenter.GetDistance(centerpoint) < ((proximity/3)*2))
            {
                 return cache;
            }

            log.Info("getAirports - regen list");

            // generate a new list
            currentcenter = centerpoint;

            cache.Clear();

            foreach (PointLatLngAlt item in airports)
            {
                if (item.GetDistance(centerpoint) < proximity)
                {
                    cache.Add(item);
                }
            }

            return cache;
        }
开发者ID:jimcunderwood,项目名称:MissionPlanner-1,代码行数:27,代码来源:Airports.cs


示例4: utmpos

 public utmpos(PointLatLngAlt pos)
 {
     double[] dd = pos.ToUTM(pos.GetUTMZone());
     this.x = dd[0];
     this.y = dd[1];
     this.zone = pos.GetUTMZone();
     this.Tag = null;
 }
开发者ID:palacita,项目名称:MissionPlanner,代码行数:8,代码来源:utmpos.cs


示例5: PointLatLngAlt

 public PointLatLngAlt(PointLatLngAlt plla)
 {
     this.Lat = plla.Lat;
     this.Lng = plla.Lng;
     this.Alt = plla.Alt;
     this.color = plla.color;
     this.Tag = plla.Tag;
 }
开发者ID:jank3,项目名称:MissionPlanner,代码行数:8,代码来源:PointLatLngAlt.cs


示例6: Update

        public override void Update()
        {
            if (MainV2.comPort.MAV.cs.lat == 0 || MainV2.comPort.MAV.cs.lng == 0)
                return;
            if (Leader == null)
                Leader = MainV2.comPort;

            masterpos = new PointLatLngAlt(Leader.MAV.cs.lat, Leader.MAV.cs.lng, Leader.MAV.cs.alt, "");
        }
开发者ID:MikeCaptain,项目名称:swarm,代码行数:9,代码来源:Formation.cs


示例7: SendCommand

        public override void SendCommand()
        {
            if (masterpos.Lat == 0 || masterpos.Lng == 0)
                return;

            Console.WriteLine(DateTime.Now);
            Console.WriteLine("Leader {0} {1} {2}",masterpos.Lat,masterpos.Lng,masterpos.Alt);

            int a = 0;
            foreach (var port in MainV2.Comports)
            {
                if (port == Leader)
                    continue;

                PointLatLngAlt target = new PointLatLngAlt(masterpos);

                try
                {
                    //convert Wgs84ConversionInfo to utm
                    CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();

                    GeographicCoordinateSystem wgs84 = GeographicCoordinateSystem.WGS84;

                    int utmzone = (int)((masterpos.Lng - -186.0) / 6.0);

                    IProjectedCoordinateSystem utm = ProjectedCoordinateSystem.WGS84_UTM(utmzone, masterpos.Lat < 0 ? false : true);

                    ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(wgs84, utm);

                    double[] pll1 = { target.Lng, target.Lat };

                    double[] p1 = trans.MathTransform.Transform(pll1);

                    // add offsets to utm
                    p1[0] += ((HIL.Vector3)offsets[port]).x;
                    p1[1] += ((HIL.Vector3)offsets[port]).y;

                    // convert back to wgs84
                    IMathTransform inversedTransform = trans.MathTransform.Inverse();
                    double[] point = inversedTransform.Transform(p1);

                    target.Lat = point[1];
                    target.Lng = point[0];
                    target.Alt += ((HIL.Vector3)offsets[port]).z;

                    port.setGuidedModeWP(new Locationwp() { alt = (float)target.Alt, lat = target.Lat, lng = target.Lng, id = (byte)MAVLink.MAV_CMD.WAYPOINT });

                    Console.WriteLine("{0} {1} {2} {3}", port.ToString(), target.Lat, target.Lng, target.Alt);

                }
                catch (Exception ex) { Console.WriteLine("Failed to send command " + port.ToString() + "\n" + ex.ToString()); }

                a++;
            }


        }
开发者ID:RobertCL,项目名称:MissionPlanner,代码行数:57,代码来源:Formation.cs


示例8: pv_location_to_vector

        // pv_latlon_to_vector - convert lat/lon coordinates to a position vector
        public Vector3 pv_location_to_vector(PointLatLngAlt loc)
        {
            PointLatLngAlt home = MainV2.comPort.MAV.cs.HomeLocation;

            scaleLongDown = longitude_scale(home);
            scaleLongUp = 1.0f / scaleLongDown;

            Vector3 tmp = new Vector3((loc.Lat * 1.0e7f - home.Lat * 1.0e7f) * LATLON_TO_CM, (loc.Lng * 1.0e7f - home.Lng * 1.0e7f) * LATLON_TO_CM * scaleLongDown, loc.Alt * 100);
            return tmp;
        }
开发者ID:jackmaynard,项目名称:MissionPlanner,代码行数:11,代码来源:Spline2.cs


示例9: ProjectPoint

        public static PointLatLngAlt ProjectPoint()
        {
            PointLatLngAlt currentlocation = new PointLatLngAlt(MainV2.comPort.MAV.cs.lat, MainV2.comPort.MAV.cs.lng);

            double yawangle = MainV2.comPort.MAV.cs.campointc;
            double rollangle = MainV2.comPort.MAV.cs.campointb;
            double pitchangle = MainV2.comPort.MAV.cs.campointa;

            if ((float) MainV2.comPort.MAV.param["MNT_TYPE"] == 4)
            {
                yawangle = MainV2.comPort.MAVlist[71].cs.yaw;
                rollangle = MainV2.comPort.MAVlist[71].cs.roll;
                pitchangle = MainV2.comPort.MAVlist[71].cs.pitch;
            }

            int distout = 10;
            PointLatLngAlt newpos = PointLatLngAlt.Zero;

            //dist = Math.Tan((90 + pitchangle) * deg2rad) * (MainV2.comPort.MAV.cs.alt);

            while (distout < 1000)
            {
                // get a projected point to test intersection against - not using slope distance
                PointLatLngAlt newposdist = currentlocation.newpos(yawangle + MainV2.comPort.MAV.cs.yaw, distout);
                newposdist.Alt = srtm.getAltitude(newposdist.Lat, newposdist.Lng).alt;

                // get another point 50 infront
                PointLatLngAlt newposdist2 = currentlocation.newpos(yawangle + MainV2.comPort.MAV.cs.yaw, distout + 50);
                newposdist2.Alt = srtm.getAltitude(newposdist2.Lat, newposdist2.Lng).alt;

                // get the flat terrain distance out - at 0 alt
                double distflat = Math.Tan((90 + pitchangle) * deg2rad) * (MainV2.comPort.MAV.cs.altasl);

                // x is dist from plane, y is alt
                var newpoint = FindLineIntersection(new PointF(0,MainV2.comPort.MAV.cs.altasl), new PointF((float)distflat, 0),
                    new PointF((float)distout, (float)newposdist.Alt), new PointF((float)distout + 50, (float)newposdist2.Alt));

                if (newpoint.X != 0)
                {
                    newpos = newposdist2;
                    break;
                }

                distout += 50;
            }

            //Console.WriteLine("pitch " + pitchangle.ToString("0.000") + " yaw " + yawangle.ToString("0.000") + " dist" + dist.ToString("0.000"));

            //PointLatLngAlt newpos = currentlocation.newpos( yawangle + MainV2.comPort.MAV.cs.yaw, dist);

            //Console.WriteLine(newpos);
            return newpos;
        }
开发者ID:duyisu,项目名称:MissionPlanner,代码行数:53,代码来源:GimbalFootprint.cs


示例10: AddAirport

        public static void AddAirport(PointLatLngAlt plla)
        {
            // foreach (PointLatLngAlt item in airports)
            {
              //  if (item.GetDistance(plla) < 200)
                {
              //      return;
                }
            }

            airports.Add(plla);
        }
开发者ID:jimcunderwood,项目名称:MissionPlanner-1,代码行数:12,代码来源:Airports.cs


示例11: POIAdd

        public static void POIAdd(PointLatLngAlt Point, string tag)
        {
            // local copy
            PointLatLngAlt pnt = Point;

            pnt.Tag = tag + "\n" + pnt.ToString();

            POI.POIs.Add(pnt);

            if (POIModified != null)
                POIModified(null, null);
        }
开发者ID:jmachuca77,项目名称:MissionPlanner,代码行数:12,代码来源:POI.cs


示例12: POIDelete

 public static void POIDelete(PointLatLngAlt Point)
 {
     for (int a = 0; a < POI.POIs.Count; a++)
     {
         if (POI.POIs[a].Point() == Point)
         {
             POI.POIs.RemoveAt(a);
             if (POIModified != null)
                 POIModified(null, null);
             return;
         }
     }
 }
开发者ID:RobertCL,项目名称:MissionPlanner,代码行数:13,代码来源:POI.cs


示例13: ToLLA

        public PointLatLngAlt ToLLA()
        {
            IProjectedCoordinateSystem utm = ProjectedCoordinateSystem.WGS84_UTM(Math.Abs(zone), zone < 0 ? false : true);

            ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(wgs84, utm);

            // get leader utm coords
            double[] pll = trans.MathTransform.Inverse().Transform(this);

            PointLatLngAlt ans = new PointLatLngAlt(pll[1], pll[0]);
            if (this.Tag != null)
                ans.Tag = this.Tag.ToString();

            return ans;
        }
开发者ID:CraigElder,项目名称:MissionPlanner,代码行数:15,代码来源:utmpos.cs


示例14: GeneratePath

        public static List<PointLatLngAlt> GeneratePath(MAVState MAV)
        {
            List<PointLatLngAlt> result = new List<PointLatLngAlt>();

            MAVLink.mavlink_mission_item_t? prevwp = null;

            int a = -1;

            foreach (var wp in MAV.wps.Values)
            {
                a++;
                if (!prevwp.HasValue)
                {
                    // change firstwp/aka home to valid alt
                    prevwp = new MAVLink.mavlink_mission_item_t?(new MAVLink.mavlink_mission_item_t() { x=wp.x,y = wp.y, z = 0});
                    continue;
                }

                if (wp.command != (byte)MAVLink.MAV_CMD.WAYPOINT && wp.command != (byte)MAVLink.MAV_CMD.SPLINE_WAYPOINT)
                    continue;

                var wp1 = new PointLatLngAlt(prevwp.Value);
                var wp2 = new PointLatLngAlt(wp);
                var bearing = wp1.GetBearing(wp2);
                var distwps = wp1.GetDistance(wp2);
                var startalt = wp1.Alt;
                var endalt = wp2.Alt;

                if (startalt == 0)
                {
                    startalt = endalt;
                }

                if(distwps > 5000)
                    continue;

                for (double d = 0.1; d < distwps; d += 0.1)
                {
                    var pnt = wp1.newpos(bearing, d);
                    pnt.Alt = startalt + (d/distwps) * (endalt-startalt);
                    result.Add(pnt);
                }

                prevwp = wp;
            }

            return result;
        }
开发者ID:ArduPilot,项目名称:MissionPlanner,代码行数:48,代码来源:Path.cs


示例15: FindTrailPnt

        PointLatLngAlt FindTrailPnt(PointLatLngAlt from)
        {
            // get the start point for the distance
            int start = trail.IndexOf(from);

            for (int i = start+1; i < trail.Count; i++)
            {
                double dist = from.GetDistance(trail[i]); // 2d distance
                if (dist > FollowDistance)
                {
                    return trail[i];
                }
            }

            return null;
        }
开发者ID:neolu,项目名称:MissionPlanner,代码行数:16,代码来源:FollowPath.cs


示例16: POIAdd

        public static void POIAdd(PointLatLngAlt Point)
        {
            PointLatLngAlt pnt = Point;

            string output = "";

            if (DialogResult.OK != InputBox.Show("POI", "Enter ID", ref output))
                return;

            pnt.Tag = output + "\n" + pnt.ToString();

            POI.POIs.Add(pnt);

            if (POIModified != null)
                POIModified(null, null);
        }
开发者ID:RobertCL,项目名称:MissionPlanner,代码行数:16,代码来源:POI.cs


示例17: POIEdit

        public static void POIEdit(PointLatLngAlt Point)
        {
            string output = "";

            if (DialogResult.OK != InputBox.Show("POI", "Enter ID", ref output))
                return;

            for (int a = 0; a < POI.POIs.Count; a++)
            {
                if (POI.POIs[a].Point() == Point)
                {
                    POI.POIs[a].Tag = output + "\n" + Point.ToString();
                    if (POIModified != null)
                        POIModified(null, null);
                    return;
                }
            }
        }
开发者ID:RobertCL,项目名称:MissionPlanner,代码行数:18,代码来源:POI.cs


示例18: AddAirport

        public static void AddAirport(PointLatLngAlt plla)
        {
            lock (locker)
            {
                if (checkdups)
                {
                    foreach (PointLatLngAlt item in airports)
                    {
                        if (item.GetDistance(plla) < 1000) // 1000m
                        {
                            return;
                        }
                    }
                }

                airports.Add(plla);

                newairports = true;
            }
        }
开发者ID:RobertCL,项目名称:MissionPlanner,代码行数:20,代码来源:Airports.cs


示例19: ReceviedPacket

        bool ReceviedPacket(byte[] rawpacket)
        {
            if (rawpacket[5] == (byte)MAVLink.MAVLINK_MSG_ID.TERRAIN_REQUEST)
            {
                MAVLink.mavlink_terrain_request_t packet = rawpacket.ByteArrayToStructure<MAVLink.mavlink_terrain_request_t>();

                lastrequest = packet;

                log.Info("received TERRAIN_REQUEST " + packet.lat / 1e7 + " " + packet.lon / 1e7 + " space " + packet.grid_spacing + " " + Convert.ToString((long)packet.mask, 2));

                // 8 across - 7 down
                // cycle though the bitmask to check what we need to send (8*7)
                for (byte i = 0; i < 56; i++)
                {
                    // check to see if the ap requested this box.
                    if ((lastrequest.mask & ((ulong)1 << i)) > 0)
                    {
                        // get the requested lat and lon
                        double lat = lastrequest.lat / 1e7;
                        double lon = lastrequest.lon / 1e7;

                        // get the distance between grids
                        int bitgridspacing = lastrequest.grid_spacing * 4;

                        // get the new point, based on our current bit.
                        var newplla = new PointLatLngAlt(lat, lon).location_offset(bitgridspacing * (i % 8),bitgridspacing * (int)Math.Floor(i / 8.0));

                        // send a 4*4 grid, based on the lat lon of the bitmask
                        SendGrid(newplla.Lat, newplla.Lng, lastrequest.grid_spacing, i);
                    }
                }
            }
            else if (rawpacket[5] == (byte)MAVLink.MAVLINK_MSG_ID.TERRAIN_REPORT)
            {
                MAVLink.mavlink_terrain_report_t packet = rawpacket.ByteArrayToStructure<MAVLink.mavlink_terrain_report_t>();
                log.Info("received TERRAIN_REPORT " + packet.lat / 1e7 + " " + packet.lon / 1e7 + " " + packet.loaded + " " + packet.pending);

            }
            return false;
        }
开发者ID:newzealandpaul,项目名称:MissionPlanner,代码行数:40,代码来源:TerrainFollow.cs


示例20: ReadOurairports

        public static void ReadOurairports(string fn)
        {
            string[] lines = File.ReadAllLines(fn);

            foreach (var line in lines)
            {
                string[] items = line.Split(',');

                if (items.Length == 0)
                    continue;

                if (items[0] == "\"id\"")
                    continue;

                try
                {

                    string name = items[3];
                    int latOffset = 0;
                    while (name[0] == '"' && name[name.Length - 1] != '"')
                    {
                        latOffset += 1;
                        name = name + "," + items[3 + latOffset];
                    }
                    name.Trim('"');
                    double lat = double.Parse(items[4 + latOffset].Trim('"'), CultureInfo.InvariantCulture);
                    double lng = double.Parse(items[5 + latOffset].Trim('"'), CultureInfo.InvariantCulture);
                    double alt = 0;

                    //double alt = double.Parse(items[6 + latOffset].Trim('"')) * 0.3048;

                    var newap = new PointLatLngAlt(lat, lng, alt, name);

                    airports.Add(newap);
                    Console.WriteLine(newap);
                }
                catch { }
            }
        }
开发者ID:Bravojul,项目名称:MissionPlanner,代码行数:39,代码来源:Airports.cs



注:本文中的MissionPlanner.Utilities.PointLatLngAlt类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Utilities.utmpos类代码示例发布时间:2022-05-26
下一篇:
C# Utilities.Locationwp类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap