public GyroControl(IMyCubeBlock rc, UpdateFrequency tickSpeed, List <IMyGyro> gyros) { if (rc == null) { throw new Exception("Reference block null."); } this.rc = rc; this.gyros = gyros; double factor = 1; if (tickSpeed == UpdateFrequency.Update10) { factor = 10; } else if (tickSpeed == UpdateFrequency.Update100) { factor = 100; } double secondsPerTick = (1.0 / 60) * factor; anglePID = new VectorPID(gyroP / factor, gyroI / factor, gyroD / factor, -gyroMax, gyroMax, secondsPerTick); Reset(); }
public GyroControl(IMyShipController rc) { this.rc = rc; gyros = GetBlocks <IMyGyro>(); anglePID = new VectorPID(18, 0, 3, -1000, 1000, 1.0 / 60); Reset(); }
public ThrusterControl(IMyShipController rc, UpdateFrequency tickSpeed, List <IMyThrust> thrusters, Mode mode = Mode.Min) { if (rc == null) { throw new Exception("Ship controller null."); } double factor = 1; if (tickSpeed == UpdateFrequency.Update10) { factor = 10; } else if (tickSpeed == UpdateFrequency.Update100) { factor = 100; } double secondsPerTick = (1.0 / 60) * factor; this.rc = rc; Dictionary <Base6Directions.Direction, ThrusterGroup> temp = new Dictionary <Base6Directions.Direction, ThrusterGroup>(6); foreach (IMyThrust t in thrusters) { t.ThrustOverride = 0; t.Enabled = true; if (temp.ContainsKey(t.Orientation.Forward)) { temp [t.Orientation.Forward].Add(t); } else { ThrusterGroup newThrust = new ThrusterGroup(mode); newThrust.Add(t); temp.Add(t.Orientation.Forward, newThrust); } } thrust = temp.Values.ToList(); pid = new VectorPID(thrustP / factor, thrustI / factor, thrustD / factor, thrustDecay / factor, secondsPerTick); }
public ThrusterControl(IMyShipController rc, UpdateFrequency tickSpeed, List <IMyThrust> thrusters) { if (rc == null) { throw new Exception("Ship controller null."); } double factor = 1; if (tickSpeed == UpdateFrequency.Update10) { factor = 10; } else if (tickSpeed == UpdateFrequency.Update100) { factor = 100; } double secondsPerTick = (1.0 / 60) * factor; pid = new VectorPID(thrustP / factor, thrustI / factor, thrustD / factor, thrustDecay / factor, secondsPerTick); this.rc = rc; this.thrusters = thrusters; Reset(); }