public Autopilot_Module(GridTerminalSystemUtils GTS, IMyShipController controller, IngameTime ingameTime,
                                    PID_Controller.PIDSettings gyroPidSettings, PID_Controller.PIDSettings thrustPidSettings,
                                    EntityTracking_Module trackingModule) : this(GTS, controller, ingameTime, trackingModule)
            {
                thrustPidController = new PID_Controller(thrustPidSettings);

                gyroControl = new AdvGyroControl(gyroPidSettings, ingameTime);
            }
            public AdvGyroControl(PID_Controller.PIDSettings pidSettings, IngameTime ingameTime)
            {
                yawPid   = new PID_Controller(pidSettings);
                pitchPid = new PID_Controller(pidSettings);
                rollPid  = new PID_Controller(pidSettings);

                this.ingameTime = ingameTime;
            }
            public Autopilot_Module(GridTerminalSystemUtils GTS, IMyShipController controller, IngameTime ingameTime,
                                    PID_Controller.PIDSettings gyroPidSettings, PID_Controller.PIDSettings thrustPidSettings,
                                    EntityTracking_Module trackingModule)
            {
                GTS.GridTerminalSystem.GetBlocksOfType(allThrusters);
                GTS.GridTerminalSystem.GetBlocksOfType(gyros);

                this.controller = controller;
                this.ingameTime = ingameTime;

                thrustPidController = new PID_Controller(thrustPidSettings);

                gyroControl        = new AdvGyroControl(gyroPidSettings, ingameTime);
                thrustControl      = new AdvThrustControl(controller, allThrusters, ingameTime);
                collisionAvoidance = new CollisionAvoidance(controller, trackingModule, 10, 10);
                trackingModule.onEntityDetected += collisionAvoidance.OnEntityDetected;
            }
            public Autopilot_Module(GridTerminalSystemUtils GTS, IMyShipController controller, IngameTime ingameTime,
                                    EntityTracking_Module trackingModule)
            {
                GTS.GridTerminalSystem.GetBlocksOfType(allThrusters);
                GTS.GridTerminalSystem.GetBlocksOfType(gyros);

                this.controller = controller;
                this.ingameTime = ingameTime;

                thrustControl      = new AdvThrustControl(controller, allThrusters, ingameTime);
                collisionAvoidance = new CollisionAvoidance(controller, trackingModule, 10, 10);
                trackingModule.onEntityDetected += collisionAvoidance.OnEntityDetected;

                PID_Controller.PIDSettings onePid = new PID_Controller.PIDSettings
                {
                    PGain          = 1,
                    DerivativeGain = 0,
                    IntegralGain   = 0,
                };

                thrustPidController = new PID_Controller(onePid);

                gyroControl = new AdvGyroControl(onePid, ingameTime);
            }
 public AutoPilot(GridTerminalSystemUtils GTS, IMyShipController controller, IngameTime time,
                  PID_Controller.PIDSettings gyroPidSettings, PID_Controller.PIDSettings thrustPidSettings,
                  EntityTracking_Module entityTracking)
 {
     autopilotModule = new Autopilot_Module(GTS, controller, time, gyroPidSettings, thrustPidSettings, entityTracking);
 }
Exemplo n.º 6
0
        IEnumerator <bool> Initialize()
        {
            cameras = new List <IMyCameraBlock>();
            GridTerminalSystem.GetBlocksOfType(cameras, x => x.CubeGrid == Me.CubeGrid);
            foreach (var cam in cameras)
            {
                cam.EnableRaycast = true;
            }
            yield return(true);

            gyros = new List <IMyGyro>();
            GridTerminalSystem.GetBlocksOfType(gyros, x => x.CubeGrid == Me.CubeGrid);
            yield return(true);

            antennaComms = new ACPWrapper(this, x => x.CubeGrid == Me.CubeGrid);
            yield return(true);

            thrusters = new List <IMyThrust>();
            GridTerminalSystem.GetBlocksOfType(thrusters, x => x.CubeGrid == Me.CubeGrid);
            yield return(true);

            rc = GetBlockWithNameOnGrid(RCNAME) as IMyRemoteControl;
            yield return(true);

            mainCam = GetBlockWithNameOnGrid(MAINCAM) as IMyCameraBlock;
            yield return(true);

            var GTSUtils = new GridTerminalSystemUtils(Me, GridTerminalSystem);

            ingameTime = new IngameTime();
            yield return(true);

            entityTracking = new EntityTracking_Module(GTSUtils, rc, mainCam);
            yield return(true);

            var pid = new PID_Controller.PIDSettings
            {
                PGain = 1
            };

            autopilot = new Autopilot_Module(GTSUtils, rc, ingameTime, pid, pid, entityTracking);
            yield return(true);

            flightControl = new FlightControl(rc, gyros, thrusters, autopilot);
            yield return(true);

            guidance = new TargetGuidance(rc);
            yield return(true);

            clientSystem = new MissileManagementClient(antennaComms, rc, Me.EntityId, missileType);
            yield return(true);

            turretMonitor = new TurretMonitor(this);
            turretMonitor.OnTargetDetected += OnTargetDetected;
            yield return(true);

            proximityFuse = new ProximityFuse(rc, DETONATIONDIST, this);
            proximityFuse.OnEnemyInRange += proximityFuse.Detonate;

            DebugEcho("Initialized!");
        }