/// <summary> /// Initializes a new instance of the DashboardForm class /// </summary> /// <param name="theEventsPort">The Events Port for passing events back to the service</param> /// <param name="state">The service state</param> public ObstacleAvoidanceForm(ObstacleAvoidanceFormEvents theEventsPort, ObstacleAvoidanceDriveState state) { this.eventsPort = theEventsPort; this.InitializeComponent(); this.UpdatePIDControllersValue(state); }
/// <summary> /// Update PID controller parameter values on the form. /// This is a one-off call during constructor where we need to /// set the initial state of the PID controllers /// </summary> /// <param name="state">state</param> public void UpdatePIDControllersValue(ObstacleAvoidanceDriveState state) { // Set all the PID values on the form, copying them from state: this.textBoxAngularKp.Text = state.Controller.Kp.ToString(); this.textBoxAngularKi.Text = state.Controller.Ki.ToString(); this.textBoxAngularKd.Text = state.Controller.Kd.ToString(); this.textBoxAngularMax.Text = state.Controller.MaxPidValue.ToString(); this.textBoxAngularMin.Text = state.Controller.MinPidValue.ToString(); this.textBoxAngularIntegralMax.Text = state.Controller.MaxIntegralError.ToString(); }
/// <summary> /// Initializes a new instance of the DashboardForm class /// </summary> /// <param name="theEventsPort">The Events Port for passing events back to the service</param> /// <param name="state">The service state</param> public ObstacleAvoidanceForm(ObstacleAvoidanceFormEvents theEventsPort, ObstacleAvoidanceDriveState state) { this.eventsPort = theEventsPort; this.InitializeComponent(); this.UpdatePIDControllersValue( state.Controller.Kp, state.Controller.Ki, state.Controller.Kd); this.currentPIDSelection = 0; this.pidControllersControl = new List <Ccr.Core.Tuple <NumericUpDown, Control> >() { new Ccr.Core.Tuple <NumericUpDown, Control>(this.KpNumeric, this.KpIndicator), new Ccr.Core.Tuple <NumericUpDown, Control>(this.KiNumeric, this.KiIndicator), new Ccr.Core.Tuple <NumericUpDown, Control>(this.KdNumeric, this.KdIndicator) }; this.pidControllersControl[this.currentPIDSelection].Item1.Visible = true; }