コード例 #1
0
      private bool UpdateFeederMotor(ElmoWhistleMotor motor, FeederMotorStatus status, FeederMotorParameters parameters)
      {
         bool scheduled = false;

         if (null == motor.FaultReason)
         {
            bool modeChange = false;
            ElmoWhistleMotor.ControlModes neededControlMode = ElmoWhistleMotor.ControlModes.singleLoopPosition;
            ElmoWhistleMotor.Modes neededMode = ElmoWhistleMotor.Modes.undefined;
            double neededValue = 0;

            double inversionValue = (MotorDirections.Normal == parameters.Direction) ? 1 : -1;
            inversionValue *= (false == parameters.PositionInversion) ? 1 : -1;

            if (MotorStates.Disabled == parameters.State)
            {
               neededControlMode = ElmoWhistleMotor.ControlModes.singleLoopPosition;

               if (0 == status.requestedVelocity)
               {
                  neededMode = ElmoWhistleMotor.Modes.off;
                  neededValue = 0;
               }
               else
               {
                  neededMode = ElmoWhistleMotor.Modes.velocity;
                  neededValue = 0;
               }
            }
            else if (MotorStates.Enabled == parameters.State)
            {
               if (FeederModes.off == this.feederModeSetPoint)
               {
                  neededControlMode = ElmoWhistleMotor.ControlModes.singleLoopPosition;

                  if (0 == status.requestedVelocity)
                  {
                     neededMode = ElmoWhistleMotor.Modes.off;
                     neededValue = 0;
                  }
                  else
                  {
                     neededMode = ElmoWhistleMotor.Modes.velocity;
                     neededValue = 0;
                  }
               }
               else if (FeederModes.move == this.feederModeSetPoint)
               {
                  neededControlMode = ElmoWhistleMotor.ControlModes.singleLoopPosition;

                  bool velocityMode = true;

                  if (((false != parameters.PositivePusher) && (this.feederVelocitySetPoint < 0)) ||
                      ((false == parameters.PositivePusher) && (this.feederVelocitySetPoint > 0)))
                  {
                     velocityMode = false;
                  }

                  if (false != velocityMode)
                  {
                     neededMode = ElmoWhistleMotor.Modes.velocity;
                     neededValue = this.feederVelocitySetPoint;
                  }
                  else
                  {
                     double neededCurrent = ParameterAccessor.Instance.FeederCurrentPer1kRPM.OperationalValue * this.feederVelocitySetPoint * ParameterAccessor.Instance.FeederVelocityToRpm / 1000;
                     neededMode = ElmoWhistleMotor.Modes.current;
                     neededValue = neededCurrent;
                  }
               }
               else if (FeederModes.locked == this.feederModeSetPoint)
               {
                  neededControlMode = ElmoWhistleMotor.ControlModes.microStepper;
                  neededMode = ElmoWhistleMotor.Modes.current;
                  neededValue = ParameterAccessor.Instance.FeederLockCurrent.OperationalValue;
                  inversionValue = 1.0;
               }
            }
            else if (MotorStates.Locked == parameters.State)
            {
               neededControlMode = ElmoWhistleMotor.ControlModes.microStepper;
               neededMode = ElmoWhistleMotor.Modes.current;
               neededValue = ParameterAccessor.Instance.FeederLockCurrent.OperationalValue;
               inversionValue = 1.0;
            }

            if ((neededControlMode != status.requestedControlMode) ||
                (neededMode != status.requestedMode))
            {
               bool requestedZero = false;
               bool atZero = false;

               if ((ElmoWhistleMotor.Modes.undefined == status.requestedMode) ||
                   (ElmoWhistleMotor.Modes.off == status.requestedMode) ||
                   ((ElmoWhistleMotor.Modes.velocity == status.requestedMode) && (0 == status.requestedVelocity)) ||
                   ((ElmoWhistleMotor.Modes.current == status.requestedMode) && (0 == status.requestedCurrent)))
               {
                  requestedZero = true;
               }

               if ((ElmoWhistleMotor.Modes.undefined == status.requestedMode) ||
                   (ElmoWhistleMotor.Modes.off == status.requestedMode) ||
                   ((ElmoWhistleMotor.Modes.velocity == status.requestedMode) && (0 == motor.RPM)) ||
                   ((ElmoWhistleMotor.Modes.current == status.requestedMode) && (0 == motor.Torque)))
               {
                  atZero = true;
               }

               if ((false == requestedZero) || (false == atZero))
               {
                  neededValue = 0;
               }
               else
               {
                  motor.SetControlMode(neededControlMode);
                  status.requestedControlMode = neededControlMode;

                  if (ElmoWhistleMotor.ControlModes.singleLoopPosition == status.requestedControlMode)
                  {
                     motor.SetMode(neededMode);
                     status.requestedMode = neededMode;
                  }
                  else
                  {
                     status.requestedMode = neededMode;
                  }

                  Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} control={1}, mode={2}", motor.Name, status.requestedControlMode, status.requestedMode);
                  modeChange = true;
               }
            }

            if (((neededControlMode == status.requestedControlMode) && (neededMode == status.requestedMode)) ||
                (0 == neededValue))
            {
               if (ElmoWhistleMotor.ControlModes.singleLoopPosition == status.requestedControlMode)
               {
                  if (ElmoWhistleMotor.Modes.velocity == status.requestedMode)
                  {
                     if ((neededValue != status.requestedVelocity) || (false != modeChange) || (false != this.evaluateFeederParameters))
                     {
                        int velocityRpm = (int)(inversionValue * neededValue * ParameterAccessor.Instance.FeederVelocityToRpm);
                        motor.ScheduleVelocity(velocityRpm);
                        scheduled = true;

                        status.requestedVelocity = neededValue;
                        Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} velocity {1:0.00} {2}", motor.Name, neededValue, velocityRpm);
                     }
                  }
                  else if (ElmoWhistleMotor.Modes.current == status.requestedMode)
                  {
                     if ((neededValue != status.requestedCurrent) || (false != modeChange) || (false != this.evaluateFeederParameters))
                     {
                        float torqueCurrent = (float)(inversionValue * neededValue);
                        motor.ScheduleTorque(torqueCurrent);
                        scheduled = true;

                        status.requestedCurrent = neededValue;
                        Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} current {1:0.000} {2:0.000}", motor.Name, neededValue, torqueCurrent);
                     }
                  }
                  else if (ElmoWhistleMotor.Modes.off == status.requestedMode)
                  {
                     if (false != modeChange)
                     {
                        motor.ScheduleVelocity(0);
                        scheduled = true;

                        status.requestedVelocity = 0;
                        Tracer.WriteMedium(TraceGroup.RBUS, null, "{0} velocity=0 rpm=0", motor.Name, 0, 0);
                     }
                  }
               }
               else if (ElmoWhistleMotor.ControlModes.microStepper == status.requestedControlMode)
               {
                  if ((neededValue != status.requestedCurrent) || (false != modeChange))
                  {
                     float torqueCurrent = (float)neededValue;
                     motor.SetStepperCurrent(torqueCurrent);
                     status.requestedCurrent = neededValue;
                     Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} lock current {1}", motor.Name, neededValue);
                  }
               }
            }
         }

         return (scheduled);
      }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: OakdaleDaddy/ULC-build
      public MainForm()
      {
         this.InitializeComponent();
         this.StatusLabel.Text = "";

         this.device = new Device("device", 0);
         this.downloadDevice = new Device("download device", 0);

         this.digitalIo = new PeakDigitalIo("digital IO", 0);
         this.digitalIo.OnInputChange = new PeakDigitalIo.InputChangeHandler(this.DigitalIoChangeHandler);

         this.analogIo = new PeakAnalogIo("analog IO", 0);

         this.encoder = new KublerRotaryEncoder("encoder", 0);
         
         this.motor = new ElmoWhistleMotor("motor", 0);
         this.motor.OnInputChange = new ElmoWhistleMotor.InputChangeHandler(this.MotorInputChangeHandler);
         
         this.camera = new UlcRoboticsCamera("camera", 0);
         this.gps = new UlcRoboticsGps("gps", 0);
         this.nicbotBody = new UlcRoboticsNicbotBody("nicbot body", 0);
         this.nicbotWheel = new UlcRoboticsNicbotWheel("nicbot wheel", 0);
                  
         this.rs232 = new UlcRoboticsRs232("rs232", 0);
         this.rs232.OnSerialReceive = new UlcRoboticsRs232.SerialReceiveHandler(this.Rs232ReceiveHandler);
         this.rs232RxQueue = new Queue();
         
         this.busInterface = new BusInterface();
         this.busInterface.AddDevice(this.device);
         this.busInterface.AddDevice(this.downloadDevice);
         this.busInterface.AddDevice(this.digitalIo);
         this.busInterface.AddDevice(this.analogIo);
         this.busInterface.AddDevice(this.encoder);
         this.busInterface.AddDevice(this.motor);
         this.busInterface.AddDevice(this.camera);
         this.busInterface.AddDevice(this.gps);
         this.busInterface.AddDevice(this.nicbotBody);
         this.busInterface.AddDevice(this.nicbotWheel);
         this.busInterface.AddDevice(this.rs232);

         Array interfaces = Enum.GetValues(typeof(BusInterfaces));

         this.BusInterfaceComboBox.Items.Clear();
         for (IEnumerator i = interfaces.GetEnumerator(); i.MoveNext(); )
         {
            this.BusInterfaceComboBox.Items.Add(i.Current);
         }
         this.BusInterfaceComboBox.SelectedIndex = 0;


         this.BaudComboBox.Items.Clear();
         this.BaudComboBox.Items.Add("10000");
         this.BaudComboBox.Items.Add("20000");
         this.BaudComboBox.Items.Add("50000");
         this.BaudComboBox.Items.Add("100000");
         this.BaudComboBox.Items.Add("125000");
         this.BaudComboBox.Items.Add("250000");
         this.BaudComboBox.Items.Add("500000");
         this.BaudComboBox.Items.Add("1000000");
         this.BaudComboBox.SelectedIndex = 5;


         this.DigitalIoBaudComboBox.Items.Clear();
         this.DigitalIoBaudComboBox.Items.Add("1000000");
         this.DigitalIoBaudComboBox.Items.Add("800000");
         this.DigitalIoBaudComboBox.Items.Add("500000");
         this.DigitalIoBaudComboBox.Items.Add("250000");
         this.DigitalIoBaudComboBox.Items.Add("125000");
         this.DigitalIoBaudComboBox.Items.Add("50000");
         this.DigitalIoBaudComboBox.SelectedIndex = 5;


         this.AnalogIoBaudComboBox.Items.Clear();
         this.AnalogIoBaudComboBox.Items.Add("1000000");
         this.AnalogIoBaudComboBox.Items.Add("800000");
         this.AnalogIoBaudComboBox.Items.Add("500000");
         this.AnalogIoBaudComboBox.Items.Add("250000");
         this.AnalogIoBaudComboBox.Items.Add("125000");
         this.AnalogIoBaudComboBox.Items.Add("50000");
         this.AnalogIoBaudComboBox.SelectedIndex = 5;


         this.EncoderBaudComboBox.Items.Clear();
         this.EncoderBaudComboBox.Items.Add("10000");
         this.EncoderBaudComboBox.Items.Add("20000");
         this.EncoderBaudComboBox.Items.Add("50000");
         this.EncoderBaudComboBox.Items.Add("100000");
         this.EncoderBaudComboBox.Items.Add("125000");
         this.EncoderBaudComboBox.Items.Add("250000");
         this.EncoderBaudComboBox.Items.Add("500000");
         this.EncoderBaudComboBox.Items.Add("1000000");
         this.EncoderBaudComboBox.SelectedIndex = 6;

         this.MotorModeComboBox.SelectedIndex = 0;

         this.CameraBaudComboBox.Items.Clear();
         this.CameraBaudComboBox.Items.Add("10000");
         this.CameraBaudComboBox.Items.Add("20000");
         this.CameraBaudComboBox.Items.Add("50000");
         this.CameraBaudComboBox.Items.Add("125000");
         this.CameraBaudComboBox.Items.Add("250000");
         this.CameraBaudComboBox.Items.Add("500000");
         this.CameraBaudComboBox.Items.Add("1000000");
         this.CameraBaudComboBox.SelectedIndex = 5;


         this.GpsBaudComboBox.Items.Clear();
         this.GpsBaudComboBox.Items.Add("10000");
         this.GpsBaudComboBox.Items.Add("20000");
         this.GpsBaudComboBox.Items.Add("50000");
         this.GpsBaudComboBox.Items.Add("125000");
         this.GpsBaudComboBox.Items.Add("250000");
         this.GpsBaudComboBox.Items.Add("500000");
         this.GpsBaudComboBox.Items.Add("1000000");
         this.GpsBaudComboBox.SelectedIndex = 5;


         this.NicbotBodyBaudComboBox.Items.Clear();
         this.NicbotBodyBaudComboBox.Items.Add("10000");
         this.NicbotBodyBaudComboBox.Items.Add("20000");
         this.NicbotBodyBaudComboBox.Items.Add("50000");
         this.NicbotBodyBaudComboBox.Items.Add("100000");
         this.NicbotBodyBaudComboBox.Items.Add("125000");
         this.NicbotBodyBaudComboBox.Items.Add("250000");
         this.NicbotBodyBaudComboBox.Items.Add("500000");
         this.NicbotBodyBaudComboBox.Items.Add("1000000");
         this.NicbotBodyBaudComboBox.SelectedIndex = 5;


         this.NicbotWheelModeComboBox.SelectedIndex = 0;
         
         this.NicbotWheelBaudComboBox.Items.Clear();
         this.NicbotWheelBaudComboBox.Items.Add("10000");
         this.NicbotWheelBaudComboBox.Items.Add("20000");
         this.NicbotWheelBaudComboBox.Items.Add("50000");
         this.NicbotWheelBaudComboBox.Items.Add("100000");
         this.NicbotWheelBaudComboBox.Items.Add("125000");
         this.NicbotWheelBaudComboBox.Items.Add("250000");
         this.NicbotWheelBaudComboBox.Items.Add("500000");
         this.NicbotWheelBaudComboBox.Items.Add("1000000");
         this.NicbotWheelBaudComboBox.SelectedIndex = 5;


         this.Rs232BaudComboBox.Items.Clear();
         this.Rs232BaudComboBox.Items.Add("10000");
         this.Rs232BaudComboBox.Items.Add("20000");
         this.Rs232BaudComboBox.Items.Add("50000");
         this.Rs232BaudComboBox.Items.Add("125000");
         this.Rs232BaudComboBox.Items.Add("250000");
         this.Rs232BaudComboBox.Items.Add("500000");
         this.Rs232BaudComboBox.Items.Add("1000000");
         this.Rs232BaudComboBox.SelectedIndex = 5;

         this.NicbotAutoDrillOriginCheckBox.Checked = false;
         this.NicbotAutoDrillContinuousModeRadioButton.Checked = true;
         this.NicbotAutoDrillDistanceRetractionRadioButton.Checked = true;

         this.traceQueue = new Queue();

         QueuedTraceListener queuedTraceListener = new QueuedTraceListener(this.traceQueue);
         Trace.Listeners.Add(queuedTraceListener);

         Tracer.MaskString = "FFFFFFFF";

         this.ActivityButton.Text = "Start";
         this.active = false;

         this.DownloadProgressLabel.Text = "";
         this.DownloadActivityButton.Text = "Start";
         this.downloadActive = false;

         this.HeartbeatActivityButton.Text = "Start";
         this.heartbeatActive = false;

         this.GpsDegreesRadioButton.Checked = true;
      }
コード例 #3
0
      private void Initialize()
      {
         this.busReceiveQueue = new Queue();
         this.deviceResetQueue = new Queue();

         this.reelMotor = new ElmoWhistleMotor("reel motor", (byte)ParameterAccessor.Instance.TruckBus.ReelMotorBusId);
         this.reelDigitalIo = new PeakDigitalIo("reel digital IO", (byte)ParameterAccessor.Instance.TruckBus.ReelDigitalBusId);
         this.reelAnalogIo = new PeakAnalogIo("reel analog IO", (byte)ParameterAccessor.Instance.TruckBus.ReelAnalogBusId);
         this.reelEncoder = new KublerRotaryEncoder("reel encoder", (byte)ParameterAccessor.Instance.TruckBus.ReelEncoderBusId);
         this.feederTopFrontMotor = new ElmoWhistleMotor("feeder tf-motor", (byte)ParameterAccessor.Instance.TruckBus.FeederTopFrontMotorBusId);
         this.feederTopRearMotor = new ElmoWhistleMotor("feeder tr-motor", (byte)ParameterAccessor.Instance.TruckBus.FeederTopRearMotorBusId);
         this.feederBottomFrontMotor = new ElmoWhistleMotor("feeder bf-motor", (byte)ParameterAccessor.Instance.TruckBus.FeederBottomFrontMotorBusId);
         this.feederBottomRearMotor = new ElmoWhistleMotor("feeder br-motor", (byte)ParameterAccessor.Instance.TruckBus.FeederBottomRearMotorBusId);
         this.feederEncoder = new KublerRotaryEncoder("feeder encoder", (byte)ParameterAccessor.Instance.TruckBus.FeederEncoderBusId);
         this.guideLeftMotor = new ElmoWhistleMotor("guide l-motor", (byte)ParameterAccessor.Instance.TruckBus.GuideLeftMotorBusId);
         this.guideRightMotor = new ElmoWhistleMotor("guide r-motor", (byte)ParameterAccessor.Instance.TruckBus.GuideRightMotorBusId);
         this.launchDigitalIo = new PeakDigitalIo("launch digital IO", (byte)ParameterAccessor.Instance.TruckBus.LaunchDigitalIoBusId);
         this.launchAnalogIo = new PeakAnalogIo("launch analog IO", (byte)ParameterAccessor.Instance.TruckBus.LaunchAnalogIoBusId);
         this.gps = new UlcRoboticsGps("gps", (byte)ParameterAccessor.Instance.TruckBus.GpsBusId);

         if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication)
         {
            this.frontPumpMotor = new ElmoWhistleMotor("front pump motor", (byte)ParameterAccessor.Instance.TruckBus.FrontPumpBusId);
            this.frontScaleRs232 = new UlcRoboticsRs232("front scale rs232", (byte)ParameterAccessor.Instance.TruckBus.FrontScaleRs232BusId);
            this.frontScaleRs232.OnSerialReceive = new UlcRoboticsRs232.SerialReceiveHandler(FgDigitalScale.Front.Receive);

            this.rearPumpMotor = new ElmoWhistleMotor("rear pump motor", (byte)ParameterAccessor.Instance.TruckBus.RearPumpBusId);
            this.rearScaleRs232 = new UlcRoboticsRs232("rear scale rs232", (byte)ParameterAccessor.Instance.TruckBus.RearScaleRs232BusId);
            this.rearScaleRs232.OnSerialReceive = new UlcRoboticsRs232.SerialReceiveHandler(FgDigitalScale.Rear.Receive);
         }

         this.deviceList = new ArrayList();
         this.deviceList.Add(this.reelMotor);
         this.deviceList.Add(this.reelEncoder);
         this.deviceList.Add(this.feederTopFrontMotor);
         this.deviceList.Add(this.feederTopRearMotor);
         this.deviceList.Add(this.feederBottomFrontMotor);
         this.deviceList.Add(this.feederBottomRearMotor);
         this.deviceList.Add(this.feederEncoder);
         this.deviceList.Add(this.guideLeftMotor);
         this.deviceList.Add(this.guideRightMotor);
         this.deviceList.Add(this.reelDigitalIo);
         this.deviceList.Add(this.launchDigitalIo);
         this.deviceList.Add(this.reelAnalogIo);
         this.deviceList.Add(this.launchAnalogIo);
         this.deviceList.Add(this.gps);

         if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication)
         {
            this.deviceList.Add(this.frontPumpMotor);
            this.deviceList.Add(this.frontScaleRs232);

            this.deviceList.Add(this.rearPumpMotor);
            this.deviceList.Add(this.rearScaleRs232);
         }

         foreach (Device device in this.deviceList)
         {
            device.OnReceiveTrace = new Device.ReceiveTraceHandler(this.DeviceTraceReceive);
            device.OnTransmitTrace = new Device.TransmitTraceHandler(this.DeviceTraceTransmit);
            device.OnTransmit = new Device.TransmitHandler(this.DeviceTransmit);
            device.OnCommError = new Device.CommErrorHandler(this.DeviceError);
         }

         this.reelDigitalIo.OnInputChange = new PeakDigitalIo.InputChangeHandler(this.DigitalIoInputChangeHandler);
         this.launchDigitalIo.OnInputChange = new PeakDigitalIo.InputChangeHandler(this.DigitalIoInputChangeHandler);

         this.feederTopFrontStatus = new FeederMotorStatus();
         this.feederTopRearStatus = new FeederMotorStatus();
         this.feederBottomFrontStatus = new FeederMotorStatus();
         this.feederBottomRearStatus = new FeederMotorStatus();

         this.guideLeftStatus = new GuideMotorStatus();
         this.guideRightStatus = new GuideMotorStatus();
      }
コード例 #4
0
      private void StartFeederMotor(ElmoWhistleMotor motor)
      {
         if (null == motor.FaultReason)
         {
            motor.SetConsumerHeartbeat((UInt16)ParameterAccessor.Instance.TruckBus.ConsumerHeartbeatRate, (byte)ParameterAccessor.Instance.TruckBus.ControllerBusId);
            motor.SetProducerHeartbeat((UInt16)ParameterAccessor.Instance.TruckBus.ProducerHeartbeatRate);
            motor.Start();

            Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} started", motor.Name);
         }
      }
コード例 #5
0
      private void UpdatePumpMotor(ElmoWhistleMotor motor, double setPoint, ref ElmoWhistleMotor.Modes requestedMode, ref double requestedSetPoint)
      {
         if (null == motor.FaultReason)
         {
            bool modeChange = false;
            ElmoWhistleMotor.Modes neededMode = ElmoWhistleMotor.Modes.undefined;
            double neededValue = 0;

            if (0 == setPoint)
            {
               if (0 == requestedSetPoint)
               {
                  neededMode = ElmoWhistleMotor.Modes.off;
                  neededValue = 0;
               }
               else
               {
                  neededMode = ElmoWhistleMotor.Modes.velocity;
                  neededValue = 0;
               }
            }
            else
            {
               neededMode = ElmoWhistleMotor.Modes.velocity;
               neededValue = setPoint;
            }

            if (neededMode != requestedMode)
            {
               motor.SetMode(neededMode);
               requestedMode = neededMode;
               modeChange = true;
               Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} {1}", motor.Name, requestedMode.ToString());
            }

            if (ElmoWhistleMotor.Modes.velocity == requestedMode)
            {
               if ((neededValue != requestedSetPoint) || (false != modeChange))
               {
                  motor.SetVelocity((int)neededValue);
                  requestedSetPoint = neededValue;
                  Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} velocity {1} {2}", motor.Name, neededValue, requestedSetPoint);
               }
            }
         }           
      }
コード例 #6
0
      private void UpdateGuideMotor(ElmoWhistleMotor motor, GuideMotorStatus status)
      {
         if (null == motor.FaultReason)
         {
            double neededValue = 0;

            if (GuideDirections.retract == status.direction)
            {
               if (status.RetractionLimit == false)
               {
                  neededValue = ParameterAccessor.Instance.GuideRetractionSpeed.OperationalValue;
               }
               else
               {
                  status.direction = GuideDirections.off;
                  neededValue = 0;
               }
            }
            else if (GuideDirections.extend == status.direction)
            {
               if (status.ExtensionLimit == false)
               {
                  neededValue = ParameterAccessor.Instance.GuideExtensionSpeed.OperationalValue * -1;
               }
               else
               {
                  status.direction = GuideDirections.off;
                  neededValue = 0;
               }
            }
            else
            {
               neededValue = 0;
            }

            if (status.requestedVelocity != neededValue)
            {
               int velocityRpm = (int)(neededValue);
               motor.SetVelocity(velocityRpm);
               status.requestedVelocity = neededValue;
               Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} velocity {1}", motor.Name, neededValue);
            }
         }
      }
コード例 #7
0
      private void StartGuideMotor(ElmoWhistleMotor motor)
      {
         if (null == motor.FaultReason)
         {
            motor.OnInputChange = new ElmoWhistleMotor.InputChangeHandler(this.ElmoMotorInputChangeHandler);

            motor.SetConsumerHeartbeat((UInt16)ParameterAccessor.Instance.TruckBus.ConsumerHeartbeatRate, (byte)ParameterAccessor.Instance.TruckBus.ControllerBusId);
            motor.SetProducerHeartbeat((UInt16)ParameterAccessor.Instance.TruckBus.ProducerHeartbeatRate);
            motor.Start();

            motor.SetMode(ElmoWhistleMotor.Modes.velocity);

            Tracer.WriteMedium(TraceGroup.TBUS, null, "{0} started", motor.Name);
         }
      }
コード例 #8
0
 private void EvaluateFeederMotorLockCurrent(ElmoWhistleMotor motor, FeederMotorStatus status, ref double total, ref int count)
 {
    if ((null == motor.FaultReason) &&
        (ElmoWhistleMotor.ControlModes.microStepper == status.requestedControlMode))
    {
       total += motor.Torque;
       count++;
    }
 }
コード例 #9
0
      private void EvaluateFeederMotorVelocity(ElmoWhistleMotor motor, FeederMotorStatus status, FeederMotorParameters parameters, ref double total, ref int count)
      {
         if ((null == motor.FaultReason) &&
             (MotorStates.Enabled == parameters.State) &&
             (ElmoWhistleMotor.ControlModes.singleLoopPosition == status.requestedControlMode))
         {
            double motorContribution = motor.RPM;

            if (status.requestedMode == ElmoWhistleMotor.Modes.current)
            {
               motorContribution = motor.Torque * 1000 / ParameterAccessor.Instance.FeederCurrentPer1kRPM.OperationalValue;
            }

            int settingInversionValue = (MotorDirections.Normal == parameters.Direction) ? 1 : -1;
            int positionInversionValue = (false == parameters.PositionInversion) ? 1 : -1;
            total += (motorContribution * settingInversionValue * positionInversionValue) / ParameterAccessor.Instance.FeederVelocityToRpm;

            count++;
         }
      }