예제 #1
0
      // todo move this into object, i.e. static Read(XmlReader reader), static Write(XmlWriter)
      private TruckBusParameters ReadTruckBusParameters(XmlReader reader)
      {
         TruckBusParameters result = null;
         bool readResult = true;

         BusInterfaces busInterface = BusInterfaces.USBA;
         int bitRate = 0; // todo use second object to contain value before assignment
         int consumerHeartbeatRate = 0;
         int producerHeartbeatRate = 0;
         int controllerBusId = 0;
         int reelMotorBusId = 0;
         int reelDigitalBusId = 0;
         int reelAnalogBusId = 0;
         int reelEncoderBusId = 0;
         int feederTopFrontMotorBusId = 0;
         int feederTopRearMotorBusId = 0;
         int feederBottomFrontMotorBusId = 0;
         int feederBottomRearMotorBusId = 0;
         int feederEncoderBusId = 0;
         int guideLeftMotorBusId = 0;
         int guideRightMotorBusId = 0;
         int launchDigitalIoBusId = 0;
         int launchAnalogIoBusId = 0;
         int gpsBusId = 0;
         int frontPumpBusId = 0;
         int frontScaleRs232BusId = 0;
         int rearPumpBusId = 0;
         int rearScaleRs232BusId = 0;
         int controllerTraceMask = 0;
         int reelMotorTraceMask = 0;
         int reelDigitalTraceMask = 0;
         int reelAnalogTraceMask = 0;
         int reelEncoderTraceMask = 0;
         int feederTopFrontMotorTraceMask = 0;
         int feederTopRearMotorTraceMask = 0;
         int feederBottomFrontMotorTraceMask = 0;
         int feederBottomRearMotorTraceMask = 0;
         int feederEncoderTraceMask = 0;
         int guideLeftMotorTraceMask = 0;
         int guideRightMotorTraceMask = 0;
         int launchDigitalIoTraceMask = 0;
         int launchAnalogIoTraceMask = 0;
         int gpsTraceMask = 0;
         int frontPumpTraceMask = 0;
         int frontScaleRs232TraceMask = 0;
         int rearPumpTraceMask = 0;
         int rearScaleRs232TraceMask = 0;

         for (; readResult; )
         {
            readResult = reader.Read();

            if (reader.IsStartElement())
            {
               switch (reader.Name)
               {
                  case "BusInterface":
                  {
                     busInterface = this.ReadBusInterface(reader);
                     break;
                  }
                  case "BitRate":
                  {
                     bitRate = this.ReadInt(reader);
                     break;
                  }
                  case "ConsumerHeartbeatRate":
                  {
                     consumerHeartbeatRate = this.ReadInt(reader);
                     break;
                  }
                  case "ProducerHeartbeatRate":
                  {
                     producerHeartbeatRate = this.ReadInt(reader);
                     break;
                  }
                  case "ControllerBusId":
                  {
                     controllerBusId = this.ReadInt(reader);
                     break;
                  }
                  case "ReelMotorBusId":
                  {
                     reelMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "ReelDigitalBusId":
                  {
                     reelDigitalBusId = this.ReadInt(reader);
                     break;
                  }
                  case "ReelAnalogBusId":
                  {
                     reelAnalogBusId = this.ReadInt(reader);
                     break;
                  }
                  case "ReelEncoderBusId":
                  {
                     reelEncoderBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FeederTopFrontMotorBusId":
                  {
                     feederTopFrontMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FeederTopRearMotorBusId":
                  {
                     feederTopRearMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FeederBottomFrontMotorBusId":
                  {
                     feederBottomFrontMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FeederBottomRearMotorBusId":
                  {
                     feederBottomRearMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FeederEncoderBusId":
                  {
                     feederEncoderBusId = this.ReadInt(reader);
                     break;
                  }
                  case "GuideLeftMotorBusId":
                  {
                     guideLeftMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "GuideRightMotorBusId":
                  {
                     guideRightMotorBusId = this.ReadInt(reader);
                     break;
                  }
                  case "LaunchDigitalIoBusId":
                  {
                     launchDigitalIoBusId = this.ReadInt(reader);
                     break;
                  }
                  case "LaunchAnalogIoBusId":
                  {
                     launchAnalogIoBusId = this.ReadInt(reader);
                     break;
                  }
                  case "GpsBusId":
                  {
                     gpsBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FrontPumpBusId":
                  {
                     frontPumpBusId = this.ReadInt(reader);
                     break;
                  }
                  case "FrontScaleRs232BusId":
                  {
                     frontScaleRs232BusId = this.ReadInt(reader);
                     break;
                  }
                  case "RearPumpBusId":
                  {
                     rearPumpBusId = this.ReadInt(reader);
                     break;
                  }
                  case "RearScaleRs232BusId":
                  {
                     rearScaleRs232BusId = this.ReadInt(reader);
                     break;
                  }
                  case "ControllerTraceMask":
                  {
                     controllerTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "ReelMotorTraceMask":
                  {
                     reelMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "ReelDigitalTraceMask":
                  {
                     reelDigitalTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "ReelAnalogTraceMask":
                  {
                     reelAnalogTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "ReelEncoderTraceMask":
                  {
                     reelEncoderTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FeederTopFrontMotorTraceMask":
                  {
                     feederTopFrontMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FeederTopRearMotorTraceMask":
                  {
                     feederTopRearMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FeederBottomFrontMotorTraceMask":
                  {
                     feederBottomFrontMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FeederBottomRearMotorTraceMask":
                  {
                     feederBottomRearMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FeederEncoderTraceMask":
                  {
                     feederEncoderTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "GuideLeftMotorTraceMask":
                  {
                     guideLeftMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "GuideRightMotorTraceMask":
                  {
                     guideRightMotorTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "LaunchDigitalIoTraceMask":
                  {
                     launchDigitalIoTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "LaunchAnalogIoTraceMask":
                  {
                     launchAnalogIoTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "GpsTraceMask":
                  {
                     gpsTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FrontPumpTraceMask":
                  {
                     frontPumpTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "FrontScaleRs232TraceMask":
                  {
                     frontScaleRs232TraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "RearPumpTraceMask":
                  {
                     rearPumpTraceMask = this.ReadInt(reader);
                     break;
                  }
                  case "RearScaleRs232TraceMask":
                  {
                     rearScaleRs232TraceMask = this.ReadInt(reader);
                     break;
                  }
               }
            }
            else
            {
               if ("TruckBus" == reader.Name)
               {
                  result = new TruckBusParameters();

                  result.BusInterface = busInterface;
                  result.BitRate = bitRate;
                  
                  result.ConsumerHeartbeatRate = consumerHeartbeatRate;
                  result.ProducerHeartbeatRate = producerHeartbeatRate;
                  result.ControllerBusId = controllerBusId;
                  
                  result.ReelMotorBusId = reelMotorBusId;
                  result.ReelDigitalBusId = reelDigitalBusId;
                  result.ReelAnalogBusId = reelAnalogBusId;
                  result.ReelEncoderBusId = reelEncoderBusId;
                  result.FeederTopFrontMotorBusId = feederTopFrontMotorBusId;
                  result.FeederTopRearMotorBusId = feederTopRearMotorBusId;
                  result.FeederBottomFrontMotorBusId = feederBottomFrontMotorBusId;
                  result.FeederBottomRearMotorBusId = feederBottomRearMotorBusId;
                  result.FeederEncoderBusId = feederEncoderBusId;
                  result.GuideLeftMotorBusId = guideLeftMotorBusId;
                  result.GuideRightMotorBusId = guideRightMotorBusId;
                  result.LaunchDigitalIoBusId = launchDigitalIoBusId;
                  result.LaunchAnalogIoBusId = launchAnalogIoBusId;
                  result.GpsBusId = gpsBusId;
                  result.FrontPumpBusId = frontPumpBusId;
                  result.FrontScaleRs232BusId = frontScaleRs232BusId;
                  result.RearPumpBusId = rearPumpBusId;
                  result.RearScaleRs232BusId = rearScaleRs232BusId;

                  result.ControllerTraceMask = controllerTraceMask;
                  result.ReelMotorTraceMask = reelMotorTraceMask;
                  result.ReelDigitalTraceMask = reelDigitalTraceMask;
                  result.ReelAnalogTraceMask = reelAnalogTraceMask;
                  result.ReelEncoderTraceMask = reelEncoderTraceMask;
                  result.FeederTopFrontMotorTraceMask = feederTopFrontMotorTraceMask;
                  result.FeederTopRearMotorTraceMask = feederTopRearMotorTraceMask;
                  result.FeederBottomFrontMotorTraceMask = feederBottomFrontMotorTraceMask;
                  result.FeederBottomRearMotorTraceMask = feederBottomRearMotorTraceMask;
                  result.FeederEncoderTraceMask = feederEncoderTraceMask;
                  result.GuideLeftMotorTraceMask = guideLeftMotorTraceMask;
                  result.GuideRightMotorTraceMask = guideRightMotorTraceMask;
                  result.LaunchDigitalIoTraceMask = launchDigitalIoTraceMask;
                  result.LaunchAnalogIoTraceMask = launchAnalogIoTraceMask;
                  result.GpsTraceMask = gpsTraceMask;
                  result.FrontPumpTraceMask = frontPumpTraceMask;
                  result.FrontScaleRs232TraceMask = frontScaleRs232TraceMask;
                  result.RearPumpTraceMask = rearPumpTraceMask;
                  result.RearScaleRs232TraceMask = rearScaleRs232TraceMask;
                  
                  break;
               }
            }
         }

         return (result);
      }
예제 #2
0
      private void AssignDefaults(RobotApplications robotApplication = RobotApplications.repair)
      {
         this.RobotApplication = robotApplication;

         this.TruckBus = new TruckBusParameters();
         this.TruckBus.BusInterface = BusInterfaces.PCIA;
         this.TruckBus.BitRate = 50000;
         this.TruckBus.ConsumerHeartbeatRate = 3000;
         this.TruckBus.ProducerHeartbeatRate = 1000;
         this.TruckBus.ControllerBusId = 80;
         this.TruckBus.ReelMotorBusId = 70;
         this.TruckBus.ReelDigitalBusId = 17;
         this.TruckBus.ReelAnalogBusId = 19;
         this.TruckBus.ReelEncoderBusId = 21;
         this.TruckBus.FeederTopFrontMotorBusId = 64;
         this.TruckBus.FeederTopRearMotorBusId = 65;
         this.TruckBus.FeederBottomFrontMotorBusId = 66;
         this.TruckBus.FeederBottomRearMotorBusId = 67;
         this.TruckBus.FeederEncoderBusId = 22;
         this.TruckBus.GuideLeftMotorBusId = 68;
         this.TruckBus.GuideRightMotorBusId = 69;
         this.TruckBus.LaunchDigitalIoBusId = 16;
         this.TruckBus.LaunchAnalogIoBusId = 18;
         this.TruckBus.GpsBusId = 20;
         this.TruckBus.FrontPumpBusId = 71;
         this.TruckBus.FrontScaleRs232BusId = 96;
         this.TruckBus.RearPumpBusId = 72;
         this.TruckBus.RearScaleRs232BusId = 97;

         this.TruckBus.ControllerTraceMask = 0;
         this.TruckBus.ReelMotorTraceMask = 1;
         this.TruckBus.ReelDigitalTraceMask = 1;
         this.TruckBus.ReelAnalogTraceMask = 1;
         this.TruckBus.ReelEncoderTraceMask = 1;
         this.TruckBus.FeederTopFrontMotorTraceMask = 1;
         this.TruckBus.FeederTopRearMotorTraceMask = 1;
         this.TruckBus.FeederBottomFrontMotorTraceMask = 1;
         this.TruckBus.FeederBottomRearMotorTraceMask = 1;
         this.TruckBus.FeederEncoderTraceMask = 1;
         this.TruckBus.GuideLeftMotorTraceMask = 1;
         this.TruckBus.GuideRightMotorTraceMask = 1;
         this.TruckBus.LaunchDigitalIoTraceMask = 1;
         this.TruckBus.LaunchAnalogIoTraceMask = 1;
         this.TruckBus.GpsTraceMask = 1;
         this.TruckBus.FrontPumpTraceMask = 1;
         this.TruckBus.FrontScaleRs232TraceMask = 1;
         this.TruckBus.RearPumpTraceMask = 1;
         this.TruckBus.RearScaleRs232TraceMask = 1;

         this.JoystickDeadband = 5000;
         this.Latitude = double.NaN;
         this.Longitude = double.NaN;

         this.RobotBus = new RobotBusParameters();
         this.RobotBus.BusInterface = BusInterfaces.PCIB;
         this.RobotBus.BitRate = 50000;
         this.RobotBus.ConsumerHeartbeatRate = 3000;
         this.RobotBus.ProducerHeartbeatRate = 1000;
         this.RobotBus.ControllerBusId = 80;
         this.RobotBus.RobotBodyBusId = 32;
         this.RobotBus.RobotTopFrontWheelBusId = 49;
         this.RobotBus.RobotTopRearWheelBusId = 50;
         this.RobotBus.RobotBottomFrontWheelBusId = 51;
         this.RobotBus.RobotBottomRearWheelBusId = 52;
         this.RobotBus.ControllerTraceMask = 0;
         this.RobotBus.RobotBodyTraceMask = 1;
         this.RobotBus.RobotTopFrontWheelTraceMask = 1;
         this.RobotBus.RobotTopRearWheelTraceMask = 1;
         this.RobotBus.RobotBottomFrontWheelTraceMask = 1;
         this.RobotBus.RobotBottomRearWheelTraceMask = 1;

         this.EnableRobotBus = true;

         this.FrontScale = new DigitalScaleParameters("FrontScale", 1, 9600);
         this.RearScale = new DigitalScaleParameters("RearScale", 2, 9600);

         this.Trace = new IpEndpointParameters("Trace", "127.0.0.1", 10000);
         this.LocationServer = new IpEndpointParameters("LocationServer", "0.0.0.0", 5050);
         
         this.ThicknessSensor = new IpEndpointParameters("ThicknessSensor", "192.168.1.101", 0);
         this.ThicknessConversionUnit = new ValueParameter("ThicknessConversionUnit", "mm", 3, 0, 100, 1, 1, 1);
         
         this.StressSensor = new IpEndpointParameters("StressSensor", "192.168.1.102", 0);
         this.StressConversionUnit = new ValueParameter("StressConversionUnit", "MPa", 3, 0, 100, 1, 1, 1);

         this.NitrogenPressureConversionUnit = new ValueParameter("NitrogenPressureConversionUnit", "PSI", 3, 0, 1000, 1, 100, 100);
         this.NitrogenPressureCaution = new CautionParameter("NitrogenPressureCaution", 450, 425, 375, 350);

         this.RobotTotalCurrentConversionUnit = new ValueParameter("RobotTotalCurrentConversionUnit", "A", 2, 0, 1000, 1, 100, 100);
         this.LaunchTotalCurrentConversionUnit = new ValueParameter("LaunchTotalCurrentConversionUnit", "A", 2, 0, 1000, 1, 100, 100);

         this.GuideExtensionSpeed = new ValueParameter("GuideExtensionSpeed", "RPM", 0, 1, 4500, 1, 1500, 1500);
         this.GuideRetractionSpeed = new ValueParameter("GuideRetractionSpeed", "RPM", 0, 1, 4500, 1, 1500, 1500);
         this.GuideMomentaryButtonAction = true;

         this.ReelDistance = new ValueParameter("ReelDistance", "m", 0, 0, 0, 0, 0, 0);
         this.ReelDistanceScale = new ValueParameter("ReelDistanceScale", "m", 6, 0, 1000, 0, 1, 1);
         this.ReelMotionMode = MovementForwardControls.current;
         this.ReelReverseCurrent = new ValueParameter("ReelReverseCurrent", "A", 1, 0.0, 6.5, 0.1, 5.0, 5.0);
         this.ReelLockCurrent = new ValueParameter("ReelLockCurrent", "A", 1, 0.0, 6.5, 0.1, 2.0, 2.0);
         this.ReelCalibrationDistance = new ValueParameter("ReelCalibrationDistance", "m", 0, 1, 100, 1, 1, 1);
         this.ReelManualCurrent = new ValueParameter("ReelManualCurrent", "A", 1, 0.0, 6.5, 0.1, 5.0, 5.0);
         this.ReelReverseSpeed = new ValueParameter("ReelReverseSpeed", "m/MIN", 1, 0.0, 40.0, 0.1, 20.0, 20.0);
         this.ReelManualSpeed = new ValueParameter("ReelManualSpeed", "m/MIN", 1, 0.0, 40.0, 0.1, 20, 20);
         this.ReelVelocityToRpm = (1000 / 40.0); // 40.0 m/MIN at 1000 RPM

         this.FeederAutomaticTracking = false;
         this.FeederVelocityToRpm = (4000 / 12.05992); // 12.05992 m/MIN at 4000 RPM
         this.FeederTrackingCalibration = new ValueParameter("FeederTrackingCalibration", "%", 1, -100, 100, 0.1, 50, 50);
         this.FeederMaxSpeed = new ValueParameter("FeederMaxSpeed", "m/MIN", 2, 0, 12.05992, 1, 12, 12);
         this.FeederLowSpeedScale = new ValueParameter("FeederLowSpeedScale", "%", 0, 1, 100, 1, 30, 30);
         this.FeederLockCurrent = new ValueParameter("FeederLockCurrent", "A", 1, 0.0, 6.5, 0.1, 2.0, 2.0);
         this.FeederCurrentPer1kRPM = new ValueParameter("FeederCurrentPer1kRPM", "A", 1, 0.1, 3.0, 0.1, 0.8, 0.8);
         this.FeederManualSpeed = new ValueParameter("FeederManualSpeed", "m/MIN", 2, 0, 12.05992, 1, 7, 7);
         this.FeederCurrentCaution = new CautionParameter("FeederCurrentCaution", 6.0, 5.0, 0.0, 0.0);

         this.TopFrontFeederMotor = new FeederMotorParameters();
         this.SetFeederMotorDefaults(ref this.TopFrontFeederMotor, "TopFront", false, false);

         this.TopRearFeederMotor = new FeederMotorParameters();
         this.SetFeederMotorDefaults(ref this.TopRearFeederMotor, "TopRear", false, false);

         this.BottomFrontFeederMotor = new FeederMotorParameters();
         this.SetFeederMotorDefaults(ref this.BottomFrontFeederMotor, "BottomFront", true, true);

         this.BottomRearFeederMotor = new FeederMotorParameters();
         this.SetFeederMotorDefaults(ref this.BottomRearFeederMotor, "BottomRear", true, true);


         this.MovementMotorLockCurrent = new ValueParameter("MovementMotorLockCurrent", "A", 1, 0.1, 3.0, 0.1, 1.0, 1.0);
         this.MovementMotorMaxCurrent = new ValueParameter("MovementMotorMaxCurrent", "A", 1, 0.1, 3.0, 0.1, 3.0, 3.0);
         this.MovementMotorMaxSpeed = new ValueParameter("MovementMotorMaxSpeed", "m/MIN", 2, 0, 10, 1, 3.5, 3.5);
         this.MovementMotorCurrentPer1kRPM = new ValueParameter("MovementMotorCurrentPer1kRPM", "A", 1, 0.1, 3.0, 0.1, 1.0, 1.0);
         this.MovementMotorLowSpeedScale = new ValueParameter("MovementMotorLowSpeedScale", "%", 0, 1, 100, 1, 30, 30);
         this.MovementMotorManualJogDistance = new ValueParameter("MovementMotorManualJogDistance", "mm", 0, 1, 100, 1, 1, 1);
         this.MovementMotorManualMoveSpeed = new ValueParameter("MovementMotorManualMoveSpeed", "m/MIN", 2, 0, 10, 1, 2, 2);
         this.MovementMotorVelocityToRpm = (40000.0/19.04); // 19.04m/MIN at 40000 RPM, (0.476mm/(motor revolution)

         this.TopFrontMovementMotor = new MovementMotorParameters();
         this.SetMovementMotorDefaults(ref this.TopFrontMovementMotor, "TopFront", MovementForwardControls.velocity, MovementForwardControls.velocity, MovementForwardControls.velocity, MovementForwardControls.current);

         this.TopRearMovementMotor = new MovementMotorParameters();
         this.SetMovementMotorDefaults(ref this.TopRearMovementMotor, "TopRear", MovementForwardControls.velocity, MovementForwardControls.velocity, MovementForwardControls.velocity, MovementForwardControls.current);

         this.BottomFrontMovementMotor = new MovementMotorParameters();
         this.SetMovementMotorDefaults(ref this.BottomFrontMovementMotor, "BottomFront", MovementForwardControls.velocity, MovementForwardControls.velocity, MovementForwardControls.current, MovementForwardControls.current);

         this.BottomRearMovementMotor = new MovementMotorParameters();
         this.SetMovementMotorDefaults(ref this.BottomRearMovementMotor, "BottomRear", MovementForwardControls.velocity, MovementForwardControls.velocity, MovementForwardControls.current, MovementForwardControls.current);

         this.MovementCurrentCaution = new CautionParameter("MovementCurrentCaution", 15.0, 10.0, 0.0, 0.0);
         this.MovementTemperatureCaution = new CautionParameter("MovementTemperatureCaution", 130.0, 100.0, 0.0, 0.0);

         this.FrontToolSelected = true;

         this.FrontDrill = new DrillParameters();
         this.SetDrillDefaults(ref this.FrontDrill, "Front");

         this.RearDrill = new DrillParameters();
         this.SetDrillDefaults(ref this.RearDrill, "Rear");


         this.FrontPump = new PumpParameters();
         this.SetPumpDefaults(ref this.FrontPump);

         this.RearPump = new PumpParameters();
         this.SetPumpDefaults(ref this.RearPump);


         this.Osd = new OsdParameters();
         this.SetOsdDefaults(ref this.Osd);


         this.robotLightLevels = new ValueParameter[12];
         for (int i = 0; i < this.robotLightLevels.Length; i++)
         {
            ValueParameter value = new ValueParameter();
            this.SetLightDefaults(ref value);
            value.Name = "RobotLightLevel_" + (i + 1).ToString();
            this.robotLightLevels[i] = value;
         }

         this.launchLightLevels = new ValueParameter[4];
         for (int i = 0; i < this.launchLightLevels.Length; i++)
         {
            ValueParameter value = new ValueParameter();
            this.SetLightDefaults(ref value);
            value.Name = "LaunchLightLevel_" + (i + 1).ToString();
            this.launchLightLevels[i] = value;
         }
      }
예제 #3
0
      private void WriteTruckBusParameters(XmlWriter writer, TruckBusParameters truckBusParameters)
      {
         writer.WriteStartElement("TruckBus");

         writer.WriteComment("BusInterface from {USBA, USBB, PCIA, PCIB}");
         this.WriteElement(writer, "BusInterface", truckBusParameters.BusInterface.ToString());
         this.WriteElement(writer, "BitRate", truckBusParameters.BitRate);

         writer.WriteComment("Set heartbeat rates to 0 to disable while debugging");
         this.WriteElement(writer, "ConsumerHeartbeatRate", truckBusParameters.ConsumerHeartbeatRate);
         this.WriteElement(writer, "ProducerHeartbeatRate", truckBusParameters.ProducerHeartbeatRate);
         this.WriteElement(writer, "ControllerBusId", truckBusParameters.ControllerBusId);         
         
         this.WriteElement(writer, "ReelMotorBusId", truckBusParameters.ReelMotorBusId);
         this.WriteElement(writer, "ReelDigitalBusId", truckBusParameters.ReelDigitalBusId);
         this.WriteElement(writer, "ReelAnalogBusId", truckBusParameters.ReelAnalogBusId);
         this.WriteElement(writer, "ReelEncoderBusId", truckBusParameters.ReelEncoderBusId);
         this.WriteElement(writer, "FeederTopFrontMotorBusId", truckBusParameters.FeederTopFrontMotorBusId);
         this.WriteElement(writer, "FeederTopRearMotorBusId", truckBusParameters.FeederTopRearMotorBusId);
         this.WriteElement(writer, "FeederBottomFrontMotorBusId", truckBusParameters.FeederBottomFrontMotorBusId);
         this.WriteElement(writer, "FeederBottomRearMotorBusId", truckBusParameters.FeederBottomRearMotorBusId);
         this.WriteElement(writer, "FeederEncoderBusId", truckBusParameters.FeederEncoderBusId);
         this.WriteElement(writer, "GuideLeftMotorBusId", truckBusParameters.GuideLeftMotorBusId);
         this.WriteElement(writer, "GuideRightMotorBusId", truckBusParameters.GuideRightMotorBusId);
         this.WriteElement(writer, "LaunchDigitalIoBusId", truckBusParameters.LaunchDigitalIoBusId);
         this.WriteElement(writer, "LaunchAnalogIoBusId", truckBusParameters.LaunchAnalogIoBusId);
         this.WriteElement(writer, "GpsBusId", truckBusParameters.GpsBusId);
         this.WriteElement(writer, "FrontPumpBusId", truckBusParameters.FrontPumpBusId);
         this.WriteElement(writer, "FrontScaleRs232BusId", truckBusParameters.FrontScaleRs232BusId);
         this.WriteElement(writer, "RearPumpBusId", truckBusParameters.RearPumpBusId);
         this.WriteElement(writer, "RearScaleRs232BusId", truckBusParameters.RearScaleRs232BusId);

         this.WriteElement(writer, "ControllerTraceMask", truckBusParameters.ControllerTraceMask);
         this.WriteElement(writer, "ReelMotorTraceMask", truckBusParameters.ReelMotorTraceMask);
         this.WriteElement(writer, "ReelDigitalTraceMask", truckBusParameters.ReelDigitalTraceMask);
         this.WriteElement(writer, "ReelAnalogTraceMask", truckBusParameters.ReelAnalogTraceMask);
         this.WriteElement(writer, "ReelEncoderTraceMask", truckBusParameters.ReelEncoderTraceMask);
         this.WriteElement(writer, "FeederTopFrontMotorTraceMask", truckBusParameters.FeederTopFrontMotorTraceMask);
         this.WriteElement(writer, "FeederTopRearMotorTraceMask", truckBusParameters.FeederTopRearMotorTraceMask);
         this.WriteElement(writer, "FeederBottomFrontMotorTraceMask", truckBusParameters.FeederBottomFrontMotorTraceMask);
         this.WriteElement(writer, "FeederBottomRearMotorTraceMask", truckBusParameters.FeederBottomRearMotorTraceMask);
         this.WriteElement(writer, "FeederEncoderTraceMask", truckBusParameters.FeederEncoderTraceMask);
         this.WriteElement(writer, "GuideLeftMotorTraceMask", truckBusParameters.GuideLeftMotorTraceMask);
         this.WriteElement(writer, "GuideRightMotorTraceMask", truckBusParameters.GuideRightMotorTraceMask);
         this.WriteElement(writer, "LaunchDigitalIoTraceMask", truckBusParameters.LaunchDigitalIoTraceMask);
         this.WriteElement(writer, "LaunchAnalogIoTraceMask", truckBusParameters.LaunchAnalogIoTraceMask);
         this.WriteElement(writer, "GpsTraceMask", truckBusParameters.GpsTraceMask);
         this.WriteElement(writer, "FrontPumpTraceMask", truckBusParameters.FrontPumpTraceMask);
         this.WriteElement(writer, "FrontScaleRs232TraceMask", truckBusParameters.FrontScaleRs232TraceMask);
         this.WriteElement(writer, "RearPumpTraceMask", truckBusParameters.RearPumpTraceMask);
         this.WriteElement(writer, "RearScaleRs232TraceMask", truckBusParameters.RearScaleRs232TraceMask);

         writer.WriteEndElement();
      }
예제 #4
0
      private void ReadData(string filePath)
      {
         try
         {
            using (XmlReader reader = XmlReader.Create(filePath))
            {
               bool result = true;

               #region Drill Read
               {
                  for (; result;)
                  {
                     result = reader.Read();

                     if (reader.IsStartElement())
                     {
                        switch (reader.Name)
                        {
                           case "TruckBus":
                           {
                              TruckBusParameters truckBusParameters = this.ReadTruckBusParameters(reader);

                              if (null != truckBusParameters)
                              {
                                 this.TruckBus = truckBusParameters;
                              }

                              break;
                           }
                           case "RobotBus":
                           {
                              RobotBusParameters robotBusParameters = this.ReadRobotBusParameters(reader);

                              if (null != robotBusParameters)
                              {
                                 this.RobotBus = robotBusParameters;
                              }

                              break;
                           }
                           case "IpEndpoint":
                           {
                              IpEndpointParameters ipEndpointParameters = this.ReadIpEndpoint(reader);

                              if (null != ipEndpointParameters)
                              {
                                 switch (ipEndpointParameters.Name)
                                 {
                                    case "Trace":
                                    {
                                       this.Trace = ipEndpointParameters;
                                       break;
                                    }
                                    case "LocationServer":
                                    {
                                       this.LocationServer = ipEndpointParameters;
                                       break;
                                    }
                                    case "ThicknessSensor":
                                    {
                                       this.ThicknessSensor = ipEndpointParameters;
                                       break;
                                    }
                                    case "StressSensor":
                                    {
                                       this.StressSensor = ipEndpointParameters;
                                       break;
                                    }
                                 }
                              }

                              break;
                           }
                           case "DigitalScale":
                           {
                              DigitalScaleParameters digitalScaleParameters = this.ReadDigitalScaleParameters(reader);

                              if (null != digitalScaleParameters)
                              {
                                 switch (digitalScaleParameters.Location)
                                 {
                                    case "FrontScale":
                                    {
                                       this.FrontScale = digitalScaleParameters;
                                       break;
                                    }
                                    case "RearScale":
                                    {
                                       this.RearScale = digitalScaleParameters;
                                       break;
                                    }
                                 }
                              }

                              break;
                           }
                           case "Caution":
                           {
                              CautionParameter cautionParameter = this.ReadCautionParameters(reader);

                              if (null != cautionParameter)
                              {
                                 switch (cautionParameter.Name)
                                 {
                                    case "NitrogenPressureCaution":
                                    {
                                       this.NitrogenPressureCaution = cautionParameter;
                                       break;
                                    }
                                    case "FeederCurrentCaution":
                                    {
                                       this.FeederCurrentCaution = cautionParameter;
                                       break;
                                    }
                                    case "MovementCurrentCaution":
                                    {
                                       this.MovementCurrentCaution = cautionParameter;
                                       break;
                                    }
                                    case "MovementTemperatureCaution":
                                    {
                                       this.MovementTemperatureCaution = cautionParameter;
                                       break;
                                    }
                                 }
                              }

                              break;
                           }
                           case "Value":
                           {
                              ValueParameter valueParameter = this.ReadValueParameters(reader);

                              if (null != valueParameter)
                              {
                                 switch (valueParameter.Name)
                                 {
                                    case "ThicknessConversionUnit":
                                    {
                                       this.ThicknessConversionUnit = valueParameter;
                                       break;
                                    }
                                    case "StressConversionUnit":
                                    {
                                       this.StressConversionUnit = valueParameter;
                                       break;
                                    }
                                    case "NitrogenPressureConversionUnit":
                                    {
                                       this.NitrogenPressureConversionUnit = valueParameter;
                                       break;
                                    }
                                    case "RobotTotalCurrentConversionUnit":
                                    {
                                       this.RobotTotalCurrentConversionUnit = valueParameter;
                                       break;
                                    }
                                    case "LaunchTotalCurrentConversionUnit":
                                    {
                                       this.LaunchTotalCurrentConversionUnit = valueParameter;
                                       break;
                                    }
                                    case "GuideExtensionSpeed":
                                    {
                                       this.GuideExtensionSpeed = valueParameter;
                                       break;
                                    }
                                    case "GuideRetractionSpeed":
                                    {
                                       this.GuideRetractionSpeed = valueParameter;
                                       break;
                                    }
                                    case "ReelDistance":
                                    {
                                       this.ReelDistance = valueParameter;
                                       break;
                                    }
                                    case "ReelDistanceScale":
                                    {
                                       this.ReelDistanceScale = valueParameter;
                                       break;
                                    }
                                    case "ReelReverseCurrent":
                                    {
                                       this.ReelReverseCurrent = valueParameter;
                                       break;
                                    }
                                    case "ReelLockCurrent":
                                    {
                                       this.ReelLockCurrent = valueParameter;
                                       break;
                                    }
                                    case "ReelCalibrationDistance":
                                    {
                                       this.ReelCalibrationDistance = valueParameter;
                                       break;
                                    }
                                    case "ReelManualCurrent":
                                    {
                                       this.ReelManualCurrent = valueParameter;
                                       break;
                                    }
                                    case "ReelReverseSpeed":
                                    {
                                       this.ReelReverseSpeed = valueParameter;
                                       break;
                                    }
                                    case "ReelManualSpeed":
                                    {
                                       this.ReelManualSpeed = valueParameter;
                                       break;
                                    }                                       
                                    case "FeederTrackingCalibration":
                                    {
                                       this.FeederTrackingCalibration = valueParameter;
                                       break;
                                    }
                                    case "FeederMaxSpeed":
                                    {
                                       this.FeederMaxSpeed = valueParameter; 
                                       break;
                                    }
                                    case "FeederLowSpeedScale":
                                    {
                                       this.FeederLowSpeedScale = valueParameter;
                                       break;
                                    }
                                    case "FeederLockCurrent":
                                    {
                                       this.FeederLockCurrent = valueParameter; 
                                       break;
                                    }
                                    case "FeederCurrentPer1kRPM":
                                    {
                                       this.FeederCurrentPer1kRPM = valueParameter; 
                                       break;
                                    }
                                    case "FeederManualSpeed":
                                    {
                                       this.FeederManualSpeed = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorLockCurrent":
                                    {
                                       this.MovementMotorLockCurrent = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorMaxCurrent":
                                    {
                                       this.MovementMotorMaxCurrent = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorMaxSpeed":
                                    {
                                       this.MovementMotorMaxSpeed = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorCurrentPer1kRPM":
                                    {
                                       this.MovementMotorCurrentPer1kRPM = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorLowSpeedScale":
                                    {
                                       this.MovementMotorLowSpeedScale = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorManualJogDistance":
                                    {
                                       this.MovementMotorManualJogDistance = valueParameter;
                                       break;
                                    }
                                    case "MovementMotorManualMoveSpeed":
                                    {
                                       this.MovementMotorManualMoveSpeed = valueParameter;
                                       break;
                                    }
                                 }
                              }
                              
                              break;
                           }
                           case "RobotApplication":
                           {
                              this.RobotApplication = ReadRobotApplication(reader);
                              break;
                           }
                           case "EnableRobotBus":
                           {
                              this.EnableRobotBus = this.ReadBool(reader);
                              break;
                           }
                           case "JoystickDeadband":
                           {
                              this.JoystickDeadband = this.ReadInt(reader);
                              break;
                           }
                           case "Latitude":
                           {
                              this.Latitude = this.ReadDouble(reader);
                              break;
                           }
                           case "Longitude":
                           {
                              this.Longitude = this.ReadDouble(reader);
                              break;
                           }
                           case "GuideMomentaryButtonAction":
                           {
                              this.ReadElement(reader, ref this.GuideMomentaryButtonAction);
                              break;
                           }
                           case "ReelMotionMode":
                           {
                              this.ReelMotionMode = this.ReadMotorForwardControl(reader);
                              break;
                           }
                           case "ReelVelocityToRpm":
                           {
                              this.ReelVelocityToRpm = this.ReadDouble(reader);
                              break;
                           }
                           case "FeederAutomaticTracking":
                           {
                              this.ReadElement(reader, ref this.FeederAutomaticTracking);
                              break;
                           }
                           case "FeederVelocityToRpm":
                           {
                              this.FeederVelocityToRpm = this.ReadDouble(reader);
                              break;
                           }
                           case "FeederMotor":
                           {
                              FeederMotorParameters feederMotorParameters = this.ReadFeederMotorParameters(reader);

                              if (null != feederMotorParameters)
                              {
                                 switch (feederMotorParameters.Location)
                                 {
                                    case "TopFront":
                                    {
                                       this.TopFrontFeederMotor = feederMotorParameters;
                                       break;
                                    }
                                    case "TopRear":
                                    {
                                       this.TopRearFeederMotor = feederMotorParameters;
                                       break;
                                    }
                                    case "BottomFront":
                                    {
                                       this.BottomFrontFeederMotor = feederMotorParameters;
                                       break;
                                    }
                                    case "BottomRear":
                                    {
                                       this.BottomRearFeederMotor = feederMotorParameters;
                                       break;
                                    }
                                 }
                              }

                              break;
                           }
                           case "MovementMotor":
                           {
                              MovementMotorParameters movementMotorParameters = this.ReadMovementMotorParameters(reader);

                              if (null != movementMotorParameters)
                              {
                                 switch (movementMotorParameters.Location)
                                 {
                                    case "TopFront":
                                    {
                                       this.TopFrontMovementMotor = movementMotorParameters;
                                       break;
                                    }
                                    case "TopRear":
                                    {
                                       this.TopRearMovementMotor = movementMotorParameters;
                                       break;
                                    }
                                    case "BottomFront":
                                    {
                                       this.BottomFrontMovementMotor = movementMotorParameters;
                                       break;
                                    }
                                    case "BottomRear":
                                    {
                                       this.BottomRearMovementMotor = movementMotorParameters;
                                       break;
                                    }
                                 }
                              }

                              break;
                           }
                           case "MovementMotorVelocityToRpm":
                           {
                              this.MovementMotorVelocityToRpm = this.ReadDouble(reader);
                              break;
                           }
                           case "FrontToolSelected":
                           {
                              this.FrontToolSelected = this.ReadBool(reader);
                              break;
                           }
                           case "Drill":
                           {
                              DrillParameters drillParameters = this.ReadDrillParameters(reader);

                              if (null != drillParameters)
                              {
                                 switch (drillParameters.Location)
                                 {
                                    case "Front":
                                    {
                                       this.FrontDrill = drillParameters;
                                       break;
                                    }
                                    case "Rear":
                                    {
                                       this.RearDrill = drillParameters;
                                       break;
                                    }
                                 }
                              }

                              break;
                           }
                           case "Pump":
                           {
                              PumpParameters pumpParameters = this.ReadPumpParameters(reader);

                              if (null != pumpParameters)
                              {
                                 switch (pumpParameters.Location)
                                 {
                                    case "Front":
                                    {
                                       this.FrontPump = pumpParameters;
                                       break;
                                    }
                                    case "Rear":
                                    {
                                       this.RearPump = pumpParameters;
                                       break;
                                    }
                                 }
                              }
                              
                              break;
                           }
                           case "Osd":
                           {
                              OsdParameters osdParameters = this.ReadOsdParameters(reader);

                              if (null != osdParameters)
                              {
                                 this.Osd = osdParameters;
                              }
                              
                              break;
                           }
                           case "Lights":
                           {
                              this.ReadLightParameters(reader);
                              break;
                           }
                        }
                     }
                     else
                     {
#if false
                        switch (reader.Name)
                        {
                           case "Drills":
                           {
                              break;
                           }
                           case "Drill":
                           {
                              break;
                           }
                        }
#endif
                     }
                  }
               }
               #endregion

               reader.Close();
               reader.Dispose();
            }
         }
         catch { }
      }