Mission Planner地面站中坐标是如何实时更新的


在 MainV2.comPort.MAV.cs. 中存放着飞控当前信息。把鼠标放到 cs 上会出现一个CurrentState类的简释。

在CurrentState.cs中有部分代码揭示了答案。

public float alt
        {
            get { return (_alt - altoffsethome)*multiplierdist; }
            set
            {
                // check update rate, and ensure time hasnt gone backwards                
                _alt = value;

                if ((datetime - lastalt).TotalSeconds >= 0.2 && oldalt != alt || lastalt > datetime)
                {
                    climbrate = (alt - oldalt)/(float) (datetime - lastalt).TotalSeconds;
                    verticalspeed = (alt - oldalt)/(float) (datetime - lastalt).TotalSeconds;
                    if (float.IsInfinity(_verticalspeed))
                        _verticalspeed = 0;
                    lastalt = datetime;
                    oldalt = alt;
                }
            }
        }

更直观的

 public void UpdateCurrentSettings(System.Windows.Forms.BindingSource bs, bool updatenow,
            MAVLinkInterface mavinterface, MAVState MAV)
        {
            lock (this)
            {
                if (DateTime.Now > lastupdate.AddMilliseconds(50) || updatenow) // 20 hz
                {
                    lastupdate = DateTime.Now;

……

也就是说,Mission Planner 是以时间偏差作为更新的标准的。

 

posted on 2017-10-10 20:12  workhardplayhard  阅读(1265)  评论(0编辑  收藏  举报

导航