private void Awake() { m_Rigidbody = GetComponent <Rigidbody>(); m_Car = GetComponent <CarController>(); m_Pid = GetComponent <PidController>(); m_Control = GetComponent <CarUserControl>(); int width, height, fps; if (SettingsManager.Instance == null) { width = 320; height = 160; fps = 15; } else { width = SettingsManager.Instance.Settings.Width; height = SettingsManager.Instance.Settings.Height; fps = SettingsManager.Instance.Settings.FPS; } m_TargetTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32); foreach (MyCamera cam in m_Cameras) { cam.Camera.targetTexture = m_TargetTexture; cam.Camera.enabled = false; } m_FrameDelay = 1 / ((float)fps); }
public static IObservable <EulerAngles> Manipulate( this IObservable <EulerAngles> processVariable, IObservable <EulerAngles> setpoint, PidController controllerPitch, PidController controllerRoll, PidController controllerYaw) { return(processVariable .CombineLatest( setpoint, (pv, sp) => new { ProcessVariable = pv, Setpoint = sp }) .TimeInterval() .Select(t => { double dt = t.Interval.TotalSeconds; double manipulatedVariablePitch = controllerPitch.Manipulate( processVariable: t.Value.ProcessVariable.Pitch, setpoint: t.Value.Setpoint.Pitch, elapsedTime: dt); double manipulatedVariableRoll = controllerRoll.Manipulate( processVariable: t.Value.ProcessVariable.Roll, setpoint: t.Value.Setpoint.Roll, elapsedTime: dt); double manipulatedVariableYaw = controllerYaw.Manipulate( processVariable: t.Value.ProcessVariable.Yaw, setpoint: t.Value.Setpoint.Yaw, elapsedTime: dt); return new EulerAngles( pitch: manipulatedVariablePitch, roll: manipulatedVariableRoll, yaw: manipulatedVariableYaw); })); }
public void Save() { var data = GetSaveData(SaveFileName, SaveName); data ["PID"] = pidController; data ["PROP_DIAM"] = propDiam; data ["PROP_PITCH"] = PITCH; data ["PROP_MASS"] = propMass; data ["MOTOR_KV"] = z; data ["MOTOR_RES"] = r; data ["MOTOR_CUR"] = i0; data ["BATTERY_V"] = y; data ["FRAME_MASS"] = rigidBody.mass / scale; data ["FRAME_RES"] = airResistance; data ["PROP_E"] = PROP_E; data ["FRAME_SIZE"] = frameSize; data.Save(); var pidData = GetSaveData(PidController.SaveFileName, SaveName); PidController.Save(pidData); pidData.Save(); var inputData = GetSaveData(Inputs.SaveFileName, ""); Inputs.Save(inputData); inputData.Save(); Debug.Log("Saved " + saveName); }
public Form1(PidController controller) { InitializeComponent(); piController = controller; measurementTemp[0, 0] = "Tagname"; measurementTemp[0, 1] = "value"; measurementTemp[0, 2] = "status"; measurementTemp[0, 3] = "quality"; measurementU[0, 0] = "Tagname"; measurementU[0, 1] = "value"; measurementU[0, 2] = "status"; measurementU[0, 3] = "quality"; //tagData[0, 0] = "TagId";[0, 1] = }
void Awake() { m_Car = GetComponent <CarController> (); m_Pid = GetComponent <PidController> (); GameObject camera = GameObject.FindWithTag("MainCamera"); m_Graph = camera.GetComponent <GraphManager> (); }
private void Awake() { GameObject lazik = GameObject.FindWithTag("Player"); m_Car = lazik.GetComponent <CarController>(); m_Pid = lazik.GetComponent <PidController>(); m_Control = lazik.GetComponent <CarUserControl>(); m_Socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>(); }
public Drone(DroneController drone, float R, Vector3 goal) { this.R = R; this.goal = goal; controller = new PidController(0.1, 0.1, 0.3, drone.max_speed, 2); //TODO: Need to fine tune these start = DateTime.Now; id = drone.GetInstanceID(); Update(drone); }
public PID(Vector3 PIDvaluesHigh, Vector3 PIDvaluesLow) { PIDhigh = new PidController(PIDvaluesHigh.x, PIDvaluesHigh.y, PIDvaluesHigh.z, 1, -1); PIDlow = new PidController(PIDvaluesLow.x, PIDvaluesLow.y, PIDvaluesLow.z, 1, -1); PIDhigh.SetPoint = 0; PIDlow.SetPoint = 0; mode = PIDMode.Low; }
public AngularVelocityPidController( double proportionalGainX, double integralGainX, double derivativeGainX, double proportionalGainY, double integralGainY, double derivativeGainY, double proportionalGainZ, double integralGainZ, double derivativeGainZ) { _controllerX = new PidController(proportionalGainX, integralGainX, derivativeGainX); _controllerY = new PidController(proportionalGainY, integralGainY, derivativeGainY); _controllerZ = new PidController(proportionalGainZ, integralGainZ, derivativeGainZ); }
public Form1() { InitializeComponent(); airHeater = new AirHeater(timestep); lowPassFilter = new LowPassFilter(timestep, 0.5, airHeater.tenv); pid = new PidController(0.4, 48, timestep, Convert.ToDouble(txtSP.Text)); chartProcess.ChartAreas[0].AxisX.Interval = 15.0; chartProcess.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Seconds; chartProcess.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss";
public AngularVelocityPidController( double proportionalGainX, double integralGainX, double derivativeGainX, double maxErrorCumulativeX, double proportionalGainY, double integralGainY, double derivativeGainY, double maxErrorCumulativeY, double proportionalGainZ, double integralGainZ, double derivativeGainZ, double maxErrorCumulativeZ) { _controllerX = new PidController(proportionalGainX, integralGainX, derivativeGainX, maxErrorCumulativeX); _controllerY = new PidController(proportionalGainY, integralGainY, derivativeGainY, maxErrorCumulativeY); _controllerZ = new PidController(proportionalGainZ, integralGainZ, derivativeGainZ, maxErrorCumulativeZ); }
public AngularPositionPidController( double proportionalGainPitch, double integralGainPitch, double derivativeGainPitch, double proportionalGainRoll, double integralGainRoll, double derivativeGainRoll, double proportionalGainYaw, double integralGainYaw, double derivativeGainYaw) { _controllerX = new PidController(proportionalGainPitch, integralGainPitch, derivativeGainPitch); _controllerY = new PidController(proportionalGainRoll, integralGainRoll, derivativeGainRoll); _controllerZ = new PidController(proportionalGainYaw, integralGainYaw, derivativeGainYaw); }
public AngularPositionPidController( double proportionalGainPitch, double integralGainPitch, double derivativeGainPitch, double maxErrorCumulativeX, double proportionalGainRoll, double integralGainRoll, double derivativeGainRoll, double maxErrorCumulativeY, double proportionalGainYaw, double integralGainYaw, double derivativeGainYaw, double maxErrorCumulativeZ) { _controllerX = new PidController(proportionalGainPitch, integralGainPitch, derivativeGainPitch, maxErrorCumulativeX); _controllerY = new PidController(proportionalGainRoll, integralGainRoll, derivativeGainRoll, maxErrorCumulativeY); _controllerZ = new PidController(proportionalGainYaw, integralGainYaw, derivativeGainYaw, maxErrorCumulativeZ); }
public void Start() { Debug.Log("WAP: Begin Autopilot.Start"); Texture launcherButtonTexture = GameDatabase.Instance.GetTexture("WarrigalsAutopilot/wap-icon", asNormalMap: false); _appLauncherButton = ApplicationLauncher.Instance.AddModApplication( onTrue: () => _showGui = true, onFalse: () => _showGui = false, onHover: null, onHoverOut: null, onEnable: null, onDisable: null, visibleInScenes: ApplicationLauncher.AppScenes.FLIGHT, texture: launcherButtonTexture ); _bankController = new BankController(ActiveVessel); _bankController.OnDisable += () => _headingController.Enabled = false; _headingController = new HeadingController(ActiveVessel, _bankController); _headingController.OnEnable += () => _bankController.Enabled = true; _pitchController = new PitchController(ActiveVessel); _pitchController.OnDisable += () => { _vertSpeedController.Enabled = false; _speedByPitchController.Enabled = false; }; _vertSpeedController = new VertSpeedController(ActiveVessel, _pitchController); _vertSpeedController.OnEnable += () => { _pitchController.Enabled = true; _speedByPitchController.Enabled = false; }; _vertSpeedController.OnDisable += () => { _altitudeController.Enabled = false; }; _altitudeController = new AltitudeController(ActiveVessel, _vertSpeedController); _altitudeController.OnEnable += () => { _vertSpeedController.Enabled = true; }; _speedByPitchController = new SpeedByPitchController(ActiveVessel, _pitchController); _speedByPitchController.OnEnable += () => { _pitchController.Enabled = true; _vertSpeedController.Enabled = false; }; Debug.Log("WAP: End Autopilot.Start"); }
private void Awake() { GameObject lazik = GameObject.FindWithTag("Player"); m_Record = lazik.GetComponent <RecordScript>(); m_Car = lazik.GetComponent <CarController>(); m_Pid = lazik.GetComponent <PidController>(); m_Control = lazik.GetComponent <CarUserControl>(); m_RecordImage = GameObject.Find("RecordButton").GetComponent <Image>(); }
public void UpdatePIDValue(float valueP, float valueI, float valueD, float valueMin, float valueMax) { Debug.Log("Update servo PID"); this.valueP = valueP; this.valueI = valueI; this.valueD = valueD; this.valueMin = valueMin; this.valueMax = valueMax; speedPID = new PidController(this.valueP, this.valueI, this.valueD, this.valueMax, this.valueMin); speedPID.SetPoint = 0; }
private void Awake() { m_Controller = GetComponent <PidController> (); if (m_Autonomous) { CurrentMode = Mode.Autonomous; } else { CurrentMode = Mode.Manual; } }
public void TestMethod() { ControllerParameters cParams = new ControllerParameters(0, 0, 0, new double[] { 0, 0 }, new DateTime(1, 1, 1, 0, 0, 0), new DateTime(1, 1, 1, 0, 0, 30), 1); PidController cont = new PidController(cParams, Transients); cont.SolveSimulation(); ResultsToCsv(cont); }
void UpdatePIDValues(PIDProfile newPIDprofile) { Debug.Log("set pid values to " + newPIDprofile.name); proximityPIDX = new PidController(newPIDprofile.PIDxP, newPIDprofile.PIDxI, newPIDprofile.PIDxD, 1, -1); proximityPIDY = new PidController(newPIDprofile.PIDyP, newPIDprofile.PIDyI, newPIDprofile.PIDyD, 1, -1); proximityPIDZ = new PidController(newPIDprofile.PIDzP, newPIDprofile.PIDzI, newPIDprofile.PIDzD, 1, -1); yawPID = new PidController(newPIDprofile.yawP, newPIDprofile.yawI, newPIDprofile.yawD, 1, -1); proximityPIDX.SetPoint = 0; proximityPIDY.SetPoint = 0; proximityPIDZ.SetPoint = 0; yawPID.SetPoint = 0; }
public static IObservable <EulerAngles> Manipulate( this IObservable <EulerAngles> processVariable, IObservable <EulerAngles> setpoint, double proportionalGainPitch, double integralGainPitch, double derivativeGainPitch, double maxErrorCumulativeX, double proportionalGainRoll, double integralGainRoll, double derivativeGainRoll, double maxErrorCumulativeY, double proportionalGainYaw, double integralGainYaw, double derivativeGainYaw, double maxErrorCumulativeZ) { var controllerPitch = new PidController(proportionalGainPitch, integralGainPitch, derivativeGainPitch, maxErrorCumulativeX); var controllerRoll = new PidController(proportionalGainRoll, integralGainRoll, derivativeGainRoll, maxErrorCumulativeY); var controllerYaw = new PidController(proportionalGainYaw, integralGainYaw, derivativeGainYaw, maxErrorCumulativeZ); return(Manipulate(processVariable, setpoint, controllerPitch, controllerRoll, controllerYaw)); }
private void ResultsToCsv(PidController cont) { StringBuilder csvContent = new StringBuilder(); string filePath = @"D:\My_Data\GithubRepos\Active\PIDController\PIDController.UnitTests\test.csv"; for (long i = 0; i < cont.TimeValuesMilliseconds.LongLength; i++) { string curRow = string.Format($"{cont.TimeValuesMilliseconds[i]},{cont.YValues[i]},{cont.YDotValues[i]},{cont.YDoubleDotValues[i]}"); csvContent.AppendLine(curRow); } File.WriteAllText(filePath, csvContent.ToString()); }
public double updateDirectionalController( MyContext context, PidController controller, Vector3D direction, Vector3D desiredPosition, Vector3D currentPosition, TimeSpan timeSinceLastUpdate ) { Vector3D errorVector = desiredPosition - currentPosition; double error = errorVector.Dot(direction); double position = currentPosition.Dot(direction); double control = controller.update(timeSinceLastUpdate, error, position, context.Program); return(control); }
private void displayController(MyContext context, PidController controller, string name) { context.displayDebugText( string.Format( "{0}:\nP={1:0.00}\nI={2:0.00}\nD={3}\nCTRL={4}\nErr={5}\nPos={6}\nIntegral={7};\nDerivative={8}\n", name, controller.getPTerm(), controller.getITerm(), controller.getDTerm(), controller.getControl(), controller.getError(), controller.getPosition(), controller.getErrorIntegral(), controller.getPositionDerivative() ), false ); }
public MainWindow() { sim = new AirHeaterSimulation(21.5, 0); airHeaterCom = new SimulatedHeaterReader(new LowPassFilter(21.5), sim); //airHeaterCom = new AirHeaterReader(new LowPassFilter(21.5)); //airHeater = new DaqReader(new LowPassFilter(21.5)); analogWaveform = new AnalogWaveform <double>(0); //unfilteredAnalogWaveform = new AnalogWaveform<double>(0); InitializeComponent(); TemperatureGraph.DataSource = analogWaveform; //TemperatureGraphUnfiltered.DataSource = unfilteredAnalogWaveform; DataContext = this; RunViewUpdater(); pidControl = new PidController(airHeaterCom); //realPid = new PidReader(); opcClient = new OpcClient(airHeaterCom, pidControl); SetPoint = 25; }
public void ItMustConvege() { var rand = new Random(); var desired = 100 * rand.NextDouble(); var measured = 100 * rand.NextDouble(); var controller = new PidController(0.6, 0.4); for (int i = 0; i < 35; i++) { var error = desired - measured; Debug.WriteLine("{0} e: {1}", i, error); var output = controller.Control(error, 1); desired += 10; measured = measured + output; } Assert.IsTrue(Math.Abs(desired - measured) <= 1e-5); }
private void Awake() { speedPID = new PidController(valueP, valueI, valueD, valueMax, valueMin); }
public AngularPositionPidController(double proportionalGain, double integralGain, double derivativeGain, double maxErrorCumulative) { _controllerX = new PidController(proportionalGain, integralGain, derivativeGain, maxErrorCumulative); _controllerY = new PidController(proportionalGain, integralGain, derivativeGain, maxErrorCumulative); _controllerZ = new PidController(proportionalGain, integralGain, derivativeGain, maxErrorCumulative); }
public AngularVelocityPidController(double proportionalGain, double integralGain, double derivativeGain) { _controllerX = new PidController(proportionalGain, integralGain, derivativeGain); _controllerY = new PidController(proportionalGain, integralGain, derivativeGain); _controllerZ = new PidController(proportionalGain, integralGain, derivativeGain); }
//public AnimationCurve myCurve; public void CustomAwake(MemoryBridge memoryBridge) { this.memoryBridge = memoryBridge; vesselControl = memoryBridge.vesselControl; IRmanager = gameObject.GetComponent <IR_Manager>(); //convert IR parts on this vessel to robotic servos and create limbcontroller/limbs IRmanager.CustomAwake(memoryBridge, memoryBridge.vesselControl, ref limbs); steeringPID = new PidController(1, 0, .3f, .3, -.3f); steeringPID.SetPoint = 0; Debug.Log("IR Manager Enabled, Limb Count : " + limbs.Count); if (limbs.Count == 6) { Debug.Log("robot is a hexapod"); groupLeft = new HexapodLimbGroup(); groupLeft.limbs = new List <LimbController>(); groupRight = new HexapodLimbGroup(); groupRight.limbs = new List <LimbController>(); group0 = new HexapodLimbGroup(); group0.limbs = new List <LimbController>(); group1 = new HexapodLimbGroup(); group1.limbs = new List <LimbController>(); foreach (var limb in limbs) { limb.roboticController = this; var offset = memoryBridge.vesselControl.vessel.transform.InverseTransformPoint(limb.transform.position); Debug.Log(limb.name); var group = groupRight; if (offset.x < 0) { Debug.Log("left leg found"); group = groupLeft; } group.limbs.Add(limb); if (limb.name.Contains("1")) { Debug.Log("limb one found"); group.limb0 = limb; } if (limb.name.Contains("2")) { Debug.Log("limb two found"); group.limb1 = limb; } if (limb.name.Contains("3")) { Debug.Log("limb three found"); group.limb2 = limb; } if (offset.x < 0) { groupLeft = group; } else { groupRight = group; } } foreach (var item in groupRight.limbs) { Debug.Log(item.name); } group0.limbs.Add(groupLeft.limb0); group0.limbs.Add(groupLeft.limb2); group0.limbs.Add(groupRight.limb1); group1.limbs.Add(groupRight.limb0); group1.limbs.Add(groupRight.limb2); group1.limbs.Add(groupLeft.limb1); foreach (var limb in groupLeft.limbs) { Debug.Log("Group Left Limb : " + limb.name); } foreach (var limb in groupRight.limbs) { Debug.Log("Group Right Limb : " + limb.name); } } }
public ProximityPID(double P, double I, double D, double max, double min) { trgtPID = new PidController(P, I, D, max, min); trgtPID.SetPoint = 0; }