示例#1
0
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.None;
            try
            {
                api = new WcPbApi();
                api.Activate(Me);

                debugPanels = new Dictionary <string, DebugPanel>();
                InitDebugPanels();

                DebugPanel debugLog = DebugPanelByName("log");
                debugLog.Title = "Debug Log";

                // The remote control block is the forward reference for this grid. I should probably change this to something else....
                remoteControlBlock = GridTerminalSystem.GetBlockWithName("Remote Control") as IMyRemoteControl;

                situationalAwareness = new SituationalAwareness(api, Me, AccelerationFilterCoeff, DebugPanelByName("sitcon"), DebugPanelByName("track"));
                navigationSystems    = new NavigationSystems(GridTerminalSystem, remoteControlBlock);
                motionController     = new Autopilot(navigationSystems, DebugPanelByName("heading"), DebugPanelByName("thrust"));

                currentTime = 0;
            }
            catch (Exception e)
            {
                Echo($"*** Caught exception {e.Message}\n{e.StackTrace}");
            }
        }
示例#2
0
            public Autopilot(NavigationSystems navigation_, DebugPanel headingDebug_, DebugPanel thrustDebug_)
            {
                // Initialize debug panels
                headingDebug = headingDebug_;
                thrustDebug  = thrustDebug_;
                if (headingDebug != null)
                {
                    headingDebug.Title = "Heading Control";
                }
                if (thrustDebug != null)
                {
                    thrustDebug.Title = "Thrust Control";
                }

                navigation = navigation_;

                thrustPID   = new PIDController(thrustPIDParams);
                rotationPID = new PIDController(rotationPIDParams);
            }