public NewLocal(SerialComm comm) : base(comm) { A_SQUARED = Math.Pow(A, 2); D_SQUARED = A_SQUARED / 4.0 + Math.Pow(B, 2.0); D = Math.Sqrt(D_SQUARED); ALPHA = Math.Atan(2.0 * B / A); SIN_ALPHA = Math.Sin(ALPHA); COS_ALPHA = Math.Cos(ALPHA); MAX_R0 = Math.Sqrt(Math.Pow(A, 2.0) + Math.Pow(B, 2.0)); MAX_R1 = Math.Sqrt(Math.Pow(A, 2.0) + Math.Pow(B, 2.0)); MAX_R2 = Math.Sqrt(Math.Pow(A, 2.0) / 4.0 + Math.Pow(B, 2.0)); kalmanX = new Kalman1D(); kalmanX.Reset(0.1, 0.1, 0.1, 400, -500); kalmanY = new Kalman1D(); kalmanY.Reset(0.1, 0.1, 0.1, 400, -500); /*for (int i = 0; i < 4; i++) * { * kalmanX[i] = new Kalman1D(); * kalmanX[i].Reset(0.1, 0.1, 0.1, 400, -500); * kalmanY[i] = new Kalman1D(); * kalmanY[i].Reset(0.1, 0.1, 0.1, 400, -500); * }*/ this.comm = comm; sw = new StreamWriter("file.txt", false); }
public Robot(float x, float y, float r, string portName, bool setPosition = true, bool smallBot = false) : base(x, y) { this.rot = 0; this.r = r; this.rotationConst = (smallBot ? 16.03f : 15.0f); comm = new SerialComm(this, portName); if (setPosition) { comm.SetPosition(x, y); } }
public Localisation(SerialComm comm) : base(-500, -500) { A_SQUARED = Math.Pow(A, 2); D_SQUARED = A_SQUARED / 4.0 + Math.Pow(B, 2.0); D = Math.Sqrt(D_SQUARED); ALPHA = Math.Atan(2.0 * B / A); SIN_ALPHA = Math.Sin(ALPHA); COS_ALPHA = Math.Cos(ALPHA); MAX_R0 = Math.Sqrt(Math.Pow(A, 2.0) + Math.Pow(B, 2.0)); MAX_R1 = Math.Sqrt(Math.Pow(A, 2.0) + Math.Pow(B, 2.0)); MAX_R2 = Math.Sqrt(Math.Pow(A, 2.0) / 4.0 + Math.Pow(B, 2.0)); kalmanX = new Kalman1D(); kalmanX.Reset(0.1, 0.1, 0.1, 400, -500); kalmanY = new Kalman1D(); kalmanY.Reset(0.1, 0.1, 0.1, 400, -500); this.comm = comm; }