/// <summary> /// copies all members to a target /// </summary> /// <param name="target"></param> public virtual void CopyTo(IDssSerializable target) { // throw new NotImplementedException("class GpsState does not have to implement IDssSerializable - do not call CopyTo()"); GpsState typedTarget = target as GpsState; if (typedTarget == null) { throw new ArgumentException("GpsState::CopyTo({0}) requires type {0}", this.GetType().FullName); } typedTarget.GPGGA_PositionFixIndicator = this.GPGGA_PositionFixIndicator; typedTarget.GPGGA_AltitudeMeters = this.GPGGA_AltitudeMeters; typedTarget.GPGGA_Latitude = this.GPGGA_Latitude; typedTarget.GPGGA_Longitude = this.GPGGA_Longitude; typedTarget.GPGGA_HorizontalDilutionOfPrecision = this.GPGGA_HorizontalDilutionOfPrecision; typedTarget.GPGGA_SatellitesUsed = this.GPGGA_SatellitesUsed; typedTarget.GPGGA_LastUpdate = this.GPGGA_LastUpdate; typedTarget.GPGLL_MarginOfError = this.GPGLL_MarginOfError; typedTarget.GPGLL_Status = this.GPGLL_Status; typedTarget.GPGLL_Latitude = this.GPGLL_Latitude; typedTarget.GPGLL_Longitude = this.GPGLL_Longitude; typedTarget.GPGLL_LastUpdate = this.GPGLL_LastUpdate; typedTarget.GPGSA_Status = this.GPGSA_Status; typedTarget.GPGSA_Mode = this.GPGSA_Mode; typedTarget.GPGSA_SphericalDilutionOfPrecision = this.GPGSA_SphericalDilutionOfPrecision; typedTarget.GPGSA_HorizontalDilutionOfPrecision = this.GPGSA_HorizontalDilutionOfPrecision; typedTarget.GPGSA_VerticalDilutionOfPrecision = this.GPGSA_VerticalDilutionOfPrecision; typedTarget.GPGSA_LastUpdate = this.GPGSA_LastUpdate; typedTarget.GPGSV_SatellitesInView = this.GPGSV_SatellitesInView; typedTarget.GPGSV_LastUpdate = this.GPGSV_LastUpdate; typedTarget.GPRMC_Status = this.GPRMC_Status; typedTarget.GPRMC_Latitude = this.GPRMC_Latitude; typedTarget.GPRMC_Longitude = this.GPRMC_Longitude; typedTarget.GPRMC_LastUpdate = this.GPRMC_LastUpdate; typedTarget.GPVTG_CourseDegrees = this.GPVTG_CourseDegrees; typedTarget.GPVTG_SpeedMetersPerSecond = this.GPVTG_SpeedMetersPerSecond; typedTarget.GPVTG_LastUpdate = this.GPVTG_LastUpdate; }
public void Init() { Dropping = false; IsTurning = false; LastTurnStarted = DateTime.MinValue; LastTurnCompleted = DateTime.MinValue; if (WheelsEncoderState == null) { WheelsEncoderState = new WheelsEncoderState(); } if (collisionState == null) { collisionState = new CollisionState(); } if (gpsState == null) { gpsState = new GpsState(); } if (MostRecentAnalogValues == null) { MostRecentAnalogValues = new proxibrick.AnalogDataDssSerializable() { TimeStamp = DateTime.MinValue }; } MostRecentLaserTimeStamp = DateTime.Now; if (VoiceCommandState == null) { VoiceCommandState = new VoiceCommandState(); } int MAX_HUMANS_TO_TRACK = 7; // FrameProcessor preallocates 7 HumanInteractionStates = new HumanInteractionState[MAX_HUMANS_TO_TRACK]; for (int i = 0; i < HumanInteractionStates.Length; i++) { HumanInteractionStates[i] = new HumanInteractionState(); } if (followDirectionPidControllerAngularSpeed == null) { followDirectionPidControllerAngularSpeed = new PIDController() { Name = "AngularSpeed", MaxIntegralError = 180.0d, // degrees; anything more causes controller reset (error too large) MaxUpdateIntervalSec = 10.0d, // ms; anything more causes controller reset (interval too long) MaxPidValue = 100.0d, // pid factor upper limit MinPidValue = 0.0d, // pid factor lower limit Kp = PIDController.ProportionalGainDefault, // Proportional constant, 3.0 Ki = PIDController.IntegralGainDefault, // Integral constant, 0.1 Kd = PIDController.DerivativeGainDefault // Derivative constant, 0.5 }; } if (followDirectionPidControllerLinearSpeed == null) { followDirectionPidControllerLinearSpeed = new PIDController() { Name = "LinearSpeed", MaxIntegralError = 2000.0d, // mm/sec; anything more causes controller reset (error too large) MaxUpdateIntervalSec = 10.0d, // ms; anything more causes controller reset (interval too long) MaxPidValue = 1000.0d, // pid factor upper limit MinPidValue = 0.0d, // pid factor lower limit Kp = PIDController.ProportionalGainDefault, // Proportional constant, 3.0 Ki = PIDController.IntegralGainDefault, // Integral constant, 0.1 Kd = PIDController.DerivativeGainDefault // Derivative constant, 0.5 }; } if (PowerScale == 0.0d) { PowerScale = 0.5d; } }