public Program() { // Retrieve the blocks we're going to use. blocks = new ExpectedBlocks(GridTerminalSystem); _panelLight = blocks.GetBlock <IMyInteriorLight>("Interior Light"); _textPanel = blocks.GetBlock <IMyTextPanel>("LCD Panel"); }
public Program() { // Load state if state was saved previously. int savedState; if (int.TryParse(Storage, out savedState)) { state = (State)savedState; } else { state = State.WaitingForPayload; } // Find all needed blocks. blocks = new ExpectedBlocks(GridTerminalSystem); blocks.FindBlock <IMyTextPanel>(CRANE_ARM_STATUS_PANEL); blocks.FindBlock <IMyPistonBase>(CRANE_ARM_PISTON); blocks.FindBlock <IMyMotorStator>(CRANE_ARM_ROTOR); blocks.FindBlocks <IMyThrust>(CRANE_ARM_THRUSTER, 6); blocks.FindBlocks <IMyShipConnector>(CRANE_ARM_CONNECTOR, 3); blocks.FindBlocks <IMyPistonBase>(CRANE_LIFT_PISTON, 2); // Initialize other utility classes. thrustControl = new ThrustControl(blocks); payloadPickupStateMachine = new PayloadPickupStateMachine(blocks); payloadTransportStateMachine = new PayloadTransportStateMachine(blocks, thrustControl); craneArmResetStateMachine = new CraneArmResetStateMachine(blocks, thrustControl); // Start update loop. Runtime.UpdateFrequency |= UpdateFrequency.Update1; }
public ThrustControl(ExpectedBlocks blocks) { thrusters = blocks.GetBlocks <IMyThrust>(CRANE_ARM_THRUSTER); rotor = blocks.GetBlock <IMyMotorStator>(CRANE_ARM_ROTOR); piston = blocks.GetBlock <IMyPistonBase>(CRANE_ARM_PISTON); thrust = thrusters[0].ThrustOverride / 1000; targetAngle = BOTTOM_ANGLE; previousAngle = ConvertAngle(rotor.Angle); speedHistory = new float[60]; accelerationHistory = new float[120]; }
public PayloadTransportStateMachine(ExpectedBlocks blocks, ThrustControl thrustControl) { craneArmRotor = blocks.GetBlock <IMyMotorStator>(CRANE_ARM_ROTOR); craneLiftPistons = blocks.GetBlocks <IMyPistonBase>(CRANE_LIFT_PISTON); this.thrustControl = thrustControl; }
public Program() { blocks = new ExpectedBlocks(GridTerminalSystem); blocks.FindBlocks <IMyLightingBlock>("Interior Light", -1); blocks.FindBlocks <IMyLightingBlock>("Corner Light", -1); }
public Program() { blocks = new ExpectedBlocks(GridTerminalSystem); blocks.FindBlocks <IMyPistonBase>(PISTON_DOOR, 2); blocks.FindBlocks <IMyMotorStator>(ROTOR_DOOR_POWER, 2); }
public PayloadPickupStateMachine(ExpectedBlocks blocks) { craneLiftPistons = blocks.GetBlocks <IMyPistonBase>(CRANE_LIFT_PISTON); craneConnectors = blocks.GetBlocks <IMyShipConnector>(CRANE_ARM_CONNECTOR); }
public CraneArmResetStateMachine(ExpectedBlocks blocks, ThrustControl thrustControl) { craneLiftPistons = blocks.GetBlocks <IMyPistonBase>(CRANE_LIFT_PISTON); this.thrustControl = thrustControl; }