public void SetRotateRate(RotateRate rate) //不改变方向,只改变转速,界面 { _rotateController.SetRotateRate(rate); if (_isSectionSweeping) { BeginSectionSweep(_sweepSection); //扇扫状态,重新计算惯性区域 } }
public void GetSweepModeTest() { AntennaRotateController controller = new AntennaRotateController(); RotateDirection direction = RotateDirection.ClockWise; RotateRate rate = RotateRate.Rpm10; RotateMode expectedMode = RotateMode.ClockWise10; Assert.AreEqual(expectedMode, AntennaRotateController.GetSweepMode(direction, rate)); direction = RotateDirection.CounterClockWise; rate = RotateRate.Rpm10; expectedMode = RotateMode.CounterClockWise10; Assert.AreEqual(expectedMode, AntennaRotateController.GetSweepMode(direction, rate)); }
public static RotateMode GetSweepMode(RotateDirection direction, RotateRate rate) { int sign; switch (direction) { case RotateDirection.ClockWise: sign = 1; break; case RotateDirection.CounterClockWise: sign = -1; break; default: throw new ArgumentOutOfRangeException(nameof(direction), direction, null); } return((RotateMode)((int)rate * sign)); }
public void GetSweepModeTest() { RotateRate rate = RotateRate.Rpm5; RotateDirection direction = RotateDirection.ClockWise; RotateMode expectedMode = RotateMode.ClockWise5; Assert.AreEqual(expectedMode, AntennaRotateController.GetSweepMode(direction, rate)); rate = RotateRate.Rpm0; direction = RotateDirection.ClockWise; expectedMode = RotateMode.Stop; Assert.AreEqual(expectedMode, AntennaRotateController.GetSweepMode(direction, rate)); rate = RotateRate.Rpm0; direction = RotateDirection.CounterClockWise; expectedMode = RotateMode.Stop; Assert.AreEqual(expectedMode, AntennaRotateController.GetSweepMode(direction, rate)); rate = RotateRate.Rpm10; direction = RotateDirection.CounterClockWise; expectedMode = RotateMode.CounterClockWise10; Assert.AreEqual(expectedMode, AntennaRotateController.GetSweepMode(direction, rate)); }
// Use this for initialization void Start() { rate = gameObject.GetComponent <RotateRate>(); errors = new float[objects.Length]; prevError = new float[objects.Length]; proportional = new float[objects.Length]; integral = new float[objects.Length]; derivative = new float[objects.Length]; negs = new int[objects.Length]; for (int i = 0; i < objects.Length; i++) { proportional[i] = 0; integral[i] = 0; derivative[i] = 0; prevError[i] = 0; } }
//设置天线转速 public void AntennaSetRotationRate(RotateRate rate) => new AntennaSetRotationRateCommand(rate).Execute();
public AntennaSetRotationRateCommand(RotateRate rate) : base() { this.rate = rate; }
public void SetSweepModeData(RotateDirection direction, RotateRate rate) { Direction = direction; Rate = rate; Mode = GetSweepMode(); //默认值为顺时针5转每分钟 }
public void SetRotateRate(RotateRate rotateRate) { SetSweepModeData(Direction, rotateRate); //StartSweep(); Sweep(); }