public Controller(RigidBody obj, MainWindow x) { _targetPos = 0.4*1000; _prevErr=0; _myobj = obj; _main = x; }
public void loaded() { ctrlIsOn = false; btnControllerSwitch.Content = "Turn On"; SolidColorBrush dd = new SolidColorBrush(); dd.Color = Colors.Green; btnControllerSwitch.Background = dd; cw = this.canv.Width; ch = this.canv.Height; w = this.circle.Width; h = this.circle.Height; txtPosY.Text = "5"; myObj = new RigidBody(); myObj.radius = w / 2; myWorld = new World(myObj); myCtrl = new Controller(myObj, this); myCtrl.Kp = 0.5; myCtrl.Kd_up = 2; myCtrl.Kd_down = 16; myCtrl.Ki = 0.1; txtKp.Text = myCtrl.Kp.ToString(); txtKd_up.Text = myCtrl.Kd_up.ToString(); txtKd_down.Text = myCtrl.Kd_down.ToString(); txtKi.Text = myCtrl.Ki.ToString(); angle = 90; //timer values t = 0; tInterval = 0.01; myWorld.tInterval = tInterval; highLine = new LineAttitude(this.canv); lowLine = new LineAttitude(this.canv); targetLine = new LineAttitude(this.canv); setTargetHeight(2.5); txtTarget.Text = (targetHeight/100).ToString(); Timer = new DispatcherTimer(); Timer.Interval = new TimeSpan(0, 0, 0, 0, 1); Timer.Tick += Timer_Tick; // Console.WriteLine(this.canv.Width + " " + this.canv.Height); updateLine(angle); poseCircle(); Timer.Start(); }
public World(RigidBody rb) { myObj = rb; angle = 90; tempCnt = 0; // random number }