当前位置: 首页>>代码示例>>C#>>正文


C# Measurement.ConvertFromGeodedicToLocalNED方法代码示例

本文整理汇总了C#中Measurement.ConvertFromGeodedicToLocalNED方法的典型用法代码示例。如果您正苦于以下问题:C# Measurement.ConvertFromGeodedicToLocalNED方法的具体用法?C# Measurement.ConvertFromGeodedicToLocalNED怎么用?C# Measurement.ConvertFromGeodedicToLocalNED使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Measurement的用法示例。


在下文中一共展示了Measurement.ConvertFromGeodedicToLocalNED方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: setReferenceMeasurement

 internal void setReferenceMeasurement(Measurement referenceMeasurement)
 {
     referenceJUNK = referenceMeasurement;
     referenceMeasurementNED = referenceMeasurement.ConvertFromGeodedicToLocalNED(initialReferenceStartingPositionEFEC, initialReferenceStartingPositionGeodedic);
 }
开发者ID:helicopter,项目名称:UAVHelicopter,代码行数:5,代码来源:ControllerLaw.cs

示例2: processMeasurement

        internal void processMeasurement(Measurement newmeasurementgeodedic, System.IO.StreamWriter file, System.IO.StreamWriter file2)
        {
            //Need to convert new measurement into correct frame.
            //lets do this according to the doc. First we go from geodedic to EFEC, then to inertial, then we do some math
            //and convert to body.
            //so basically get newmeasurement into NED.
            //I also have to ensure that the reference measurement gets properly transformed to local NED

            /**
             * 1. ensure that the new measurement gets transformed to local NED
             * 2. ensure that the first new measurement gets set to previous measurement
             * 3. ensure that the reference measurement gets transformed to local NED
             * 4. Ensure that the takeoff point is transformed to ECEF then used for REF for other conversions to NED
             * 5. make sure appropriate rotations are made for local NED to body frame.
             * 6. ensure body frame still applies because it said stuff about body only being used for velocity.
             */
            Measurement newMeasurementLocalNED = newmeasurementgeodedic.ConvertFromGeodedicToLocalNED(initialReferenceStartingPositionEFEC,
                initialReferenceStartingPositionGeodedic);

            if (firstMeasurement)
            {
                firstMeasurement = false;
                previousMeasurementNED = newMeasurementLocalNED.Copy();
                currentMeasurementNED = newMeasurementLocalNED.Copy();

                return;
            }
            else
            {
                previousMeasurementNED = currentMeasurementNED.Copy();
                currentMeasurementNED = newMeasurementLocalNED.Copy();
            }

               /* Measurement destinationBody = referenceMeasurementNED.Copy();
            destinationBody.Orientation = newMeasurementLocalNED.Orientation;
            destinationBody = destinationBody.ConvertFromLocalNEDToBodyFrame();

            Measurement newMeasurementBody = newMeasurementLocalNED.Copy();
            newMeasurementBody = newMeasurementBody.ConvertFromLocalNEDToBodyFrame();
            */

              //  Position errorPositionBodyFrame = destinationBody.Position.SubtractPosition(newMeasurementBody.Position);

            Position errorPositionNED = referenceMeasurementNED.Position.SubtractPosition(newMeasurementLocalNED.Position);
            Measurement temp = newMeasurementLocalNED.Copy();
            temp.Position = errorPositionNED;
            Position errorPositionBodyFrame = temp.ConvertFromLocalNEDToBodyFrame().Position;
            errorPositionBodyFrame.ZAltitudePosition = errorPositionNED.ZAltitudePosition;

            //*********
            //Calculate integrals
            //**********
            integralOfXBodyLatitude = integralOfXBodyLatitude + errorPositionBodyFrame.XLatitudePosition * Util.TIMEBETWEENINTERVALS;
            //double integralOfYBodyLongitude = calculateIntegral(1);
            integralOfYBodyLongitude = integralOfYBodyLongitude + errorPositionBodyFrame.YLongitudePosition * Util.TIMEBETWEENINTERVALS;
               //     integralOfZBodyAltitude = integralOfZBodyAltitude + errorPositionBodyFrame.ZAltitudePosition;

            Measurement currentmeasurementBodyFrame = currentMeasurementNED.ConvertFromLocalNEDToBodyFrame();
            Measurement previousmeasurementBodyFrame = previousMeasurementNED.ConvertFromLocalNEDToBodyFrame();

            //**********
            //Calculate Velocity
            //**********
               // double xVelocityBodyFrame = (currentmeasurementBodyFrame.Position.XLatitudePosition - previousmeasurementBodyFrame.Position.XLatitudePosition) / Util.TIMEBETWEENINTERVALS;
            //double yVelocityBodyFrame = (currentmeasurementBodyFrame.Position.YLongitudePosition - previousmeasurementBodyFrame.Position.YLongitudePosition) / Util.TIMEBETWEENINTERVALS;

            double xVelocityBodyFrame = currentmeasurementBodyFrame.Velocity.XVelocityBodyFrame;
            double yVelocityBodyFrame = currentmeasurementBodyFrame.Velocity.YVelocityBodyFrame;

            //Note: i'm not using body frame z velocity because the error isn't in body frame. I'm rationalizing this because for z we are not
            //producing an angle.
            //double zVelocityBodyFrame = (currentmeasurementBodyFrame.Position.ZAltitudePosition - previousmeasurementBodyFrame.Position.ZAltitudePosition) / Util.TIMEBETWEENINTERVALS;
              //  double zVelocityBodyFrame = (currentMeasurementNED.Position.ZAltitudePosition - previousMeasurementNED.Position.ZAltitudePosition) / Util.TIMEBETWEENINTERVALS;
            double zVelocityBodyFrame = currentmeasurementBodyFrame.Velocity.ZVelocityBodyFrame;

            //Body and ned comparison works here because the velocity for the reference was already in body frame. (m/s)
            double velocityErrorX = xVelocityBodyFrame - referenceMeasurementNED.Velocity.XVelocityBodyFrame;
            double velocityErrorY = yVelocityBodyFrame - referenceMeasurementNED.Velocity.YVelocityBodyFrame;
            double velocityErrorZ = zVelocityBodyFrame - referenceMeasurementNED.Velocity.ZVelocityBodyFrame;

            //***************
            //Calculate weighted values
            //**************

            //Calculate weighted integrals
            double weightedIntegralOfXBodyLatitude = integralOfXBodyLatitude * Util.K_ETA_X;
            double weightedIntegralOfYBodyLongitude = integralOfYBodyLongitude * Util.K_ETA_Y;

            //    double weightedIntegralOfZBodyAltitude = integralOfZBodyAltitude * Util.K_ETA_Z;

            //Calculate weighted proportional values
            double weightedProportionalErrorX = errorPositionBodyFrame.XLatitudePosition * Util.K_X;
            double weightedProportionalErrorY = errorPositionBodyFrame.YLongitudePosition * Util.K_Y;
            double weightedProportionalErrorZ = errorPositionBodyFrame.ZAltitudePosition * Util.K_Z;

            double weightedDerivativeVelocityX = velocityErrorX * Util.K_U;
            double weightedDerivativeVelocityY = velocityErrorY * Util.K_V;
            double weightedDerivativeVelocityZ = velocityErrorZ * Util.K_W;

            /*
//.........这里部分代码省略.........
开发者ID:helicopter,项目名称:UAVHelicopter,代码行数:101,代码来源:ControllerLaw.cs


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