예제 #1
0
        void rqQueryAnalogInputs_onValueReceived(object sender, MeasuredValuesEventArgs ev)
        {
            RQQueryAnalogInputs query = (RQQueryAnalogInputs)sender;
            double Analog_Input_1     = query.doubleValues[0];                                                                                               // "Analog_Input_1"
            double Analog_Input_2     = query.doubleValues[1];                                                                                               // "Analog_Input_2"

            if (Analog_Input_1 != prev_Analog_Input_1 || Analog_Input_2 != prev_Analog_Input_2 || (DateTime.Now - lastSentAnalog_Input).TotalSeconds > 5.0d) // force send every 5 sec
            {
                //Tracer.Trace("Analog Inputs=" + Analog_Input_1 + "   " + Analog_Input_2);
                prev_Analog_Input_1 = Analog_Input_1;
                prev_Analog_Input_2 = Analog_Input_2;

                if (onValueReceived_AnalogInputs != null)
                {
                    ev.timestamp = query.whenReceivedTicks;
                    ev.value1    = Analog_Input_1;
                    ev.value2    = Analog_Input_2;
                    onValueReceived_AnalogInputs(this, ev);
                }
            }
        }
예제 #2
0
        private DateTime querySetLastSent = DateTime.MinValue; // when we last sent from m_querySet

        #endregion Fields

        #region Constructors

        public ControllerRQAX2850(string portName)
        {
            Tracer.Trace("ControllerRQAX2850(" + portName + ")");

            m_portName = portName;

            m_queues[0] = m_commandQueue = new RQInteractionQueue("command", 3);    // highest priority factor
            m_queues[1] = m_commandPowerLeftQueue = new RQMotorCommandQueue("commandPowerLeft");    // one-slot queue; must be "equalized" with the m_commandPowerRightQueue in terms of processing order. PriorityFactor = 2;
            m_queues[2] = m_commandPowerRightQueue = new RQMotorCommandQueue("commandPowerRight");
            m_queues[3] = m_queryQueue = new RQInteractionQueue("query", 1);        // lowest priority factor

            RQQuery rqQueryEncoderSpeed = new RQQueryEncoderSpeed(m_measuredValues);
            rqQueryEncoderSpeed.onValueReceived += new OnValueReceived(rqQueryEncoderSpeed_onValueReceived);
            m_querySet.Add(rqQueryEncoderSpeed);
            m_querySetShort.Add(rqQueryEncoderSpeed);

            RQQuery rqQueryEncoderLeftAbsolute = new RQQueryEncoderLeftAbsolute(m_measuredValues);
            rqQueryEncoderLeftAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderLeftAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderLeftAbsolute);
            m_querySetShort.Add(rqQueryEncoderLeftAbsolute);

            RQQuery rqQueryEncoderRightAbsolute = new RQQueryEncoderRightAbsolute(m_measuredValues);
            rqQueryEncoderRightAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderRightAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderRightAbsolute);
            m_querySetShort.Add(rqQueryEncoderRightAbsolute);

            RQQuery rqQueryAnalogInputs = new RQQueryAnalogInputs(m_measuredValues);
            rqQueryAnalogInputs.onValueReceived += new OnValueReceived(rqQueryAnalogInputs_onValueReceived);
            m_querySet.Add(rqQueryAnalogInputs);

            RQQuery rqQueryDigitalInputs = new RQQueryDigitalInputs(m_measuredValues);
            rqQueryDigitalInputs.onValueReceived += new OnValueReceived(rqQueryDigitalInputs_onValueReceived);
            m_querySet.Add(rqQueryDigitalInputs);
            m_querySetShort.Add(rqQueryDigitalInputs);  // whiskers are in priority queue

            RQQuery rqQueryHeatsinkTemperature = new RQQueryHeatsinkTemperature(m_measuredValues);
            rqQueryHeatsinkTemperature.onValueReceived += new OnValueReceived(rqQueryHeatsinkTemperature_onValueReceived);
            m_querySet.Add(rqQueryHeatsinkTemperature);

            RQQuery rqQueryMotorAmps = new RQQueryMotorAmps(m_measuredValues);
            rqQueryMotorAmps.onValueReceived += new OnValueReceived(rqQueryMotorAmps_onValueReceived);
            m_querySet.Add(rqQueryMotorAmps);

            RQQuery rqueryMotorPower = new RQQueryMotorPower(m_measuredValues);
            rqueryMotorPower.onValueReceived += new OnValueReceived(rqueryMotorPower_onValueReceived);
            m_querySet.Add(rqueryMotorPower);

            RQQuery rqQueryVoltage = new RQQueryVoltage(m_measuredValues);
            rqQueryVoltage.onValueReceived += new OnValueReceived(rqQueryVoltage_onValueReceived);
            m_querySet.Add(rqQueryVoltage);

            foreach (RQQuery query in m_querySet)
            {
                foreach(string vName in query.ValueNames)
                {
                    m_loggedValueNames.Add(vName);
                }
            }

            isUnknownState = true;
            isInError = false;

            //startMonitoringThread();
        }
예제 #3
0
        public ControllerRQAX2850(string portName)
        {
            Tracer.Trace("ControllerRQAX2850(" + portName + ")");

            m_portName = portName;

            m_queues[0] = m_commandQueue = new RQInteractionQueue("command", 3);                 // highest priority factor
            m_queues[1] = m_commandPowerLeftQueue = new RQMotorCommandQueue("commandPowerLeft"); // one-slot queue; must be "equalized" with the m_commandPowerRightQueue in terms of processing order. PriorityFactor = 2;
            m_queues[2] = m_commandPowerRightQueue = new RQMotorCommandQueue("commandPowerRight");
            m_queues[3] = m_queryQueue = new RQInteractionQueue("query", 1);                     // lowest priority factor

            RQQuery rqQueryEncoderSpeed = new RQQueryEncoderSpeed(m_measuredValues);

            rqQueryEncoderSpeed.onValueReceived += new OnValueReceived(rqQueryEncoderSpeed_onValueReceived);
            m_querySet.Add(rqQueryEncoderSpeed);
            m_querySetShort.Add(rqQueryEncoderSpeed);

            RQQuery rqQueryEncoderLeftAbsolute = new RQQueryEncoderLeftAbsolute(m_measuredValues);

            rqQueryEncoderLeftAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderLeftAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderLeftAbsolute);
            m_querySetShort.Add(rqQueryEncoderLeftAbsolute);

            RQQuery rqQueryEncoderRightAbsolute = new RQQueryEncoderRightAbsolute(m_measuredValues);

            rqQueryEncoderRightAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderRightAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderRightAbsolute);
            m_querySetShort.Add(rqQueryEncoderRightAbsolute);

            RQQuery rqQueryAnalogInputs = new RQQueryAnalogInputs(m_measuredValues);

            rqQueryAnalogInputs.onValueReceived += new OnValueReceived(rqQueryAnalogInputs_onValueReceived);
            m_querySet.Add(rqQueryAnalogInputs);

            RQQuery rqQueryDigitalInputs = new RQQueryDigitalInputs(m_measuredValues);

            rqQueryDigitalInputs.onValueReceived += new OnValueReceived(rqQueryDigitalInputs_onValueReceived);
            m_querySet.Add(rqQueryDigitalInputs);
            m_querySetShort.Add(rqQueryDigitalInputs);  // whiskers are in priority queue

            RQQuery rqQueryHeatsinkTemperature = new RQQueryHeatsinkTemperature(m_measuredValues);

            rqQueryHeatsinkTemperature.onValueReceived += new OnValueReceived(rqQueryHeatsinkTemperature_onValueReceived);
            m_querySet.Add(rqQueryHeatsinkTemperature);

            RQQuery rqQueryMotorAmps = new RQQueryMotorAmps(m_measuredValues);

            rqQueryMotorAmps.onValueReceived += new OnValueReceived(rqQueryMotorAmps_onValueReceived);
            m_querySet.Add(rqQueryMotorAmps);

            RQQuery rqueryMotorPower = new RQQueryMotorPower(m_measuredValues);

            rqueryMotorPower.onValueReceived += new OnValueReceived(rqueryMotorPower_onValueReceived);
            m_querySet.Add(rqueryMotorPower);

            RQQuery rqQueryVoltage = new RQQueryVoltage(m_measuredValues);

            rqQueryVoltage.onValueReceived += new OnValueReceived(rqQueryVoltage_onValueReceived);
            m_querySet.Add(rqQueryVoltage);

            foreach (RQQuery query in m_querySet)
            {
                foreach (string vName in query.ValueNames)
                {
                    m_loggedValueNames.Add(vName);
                }
            }

            isUnknownState = true;
            isInError      = false;

            //startMonitoringThread();
        }