Exemplo n.º 1
0
        void rqueryMotorPower_onValueReceived(object sender, MeasuredValuesEventArgs ev)
        {
            RQQueryMotorPower query             = (RQQueryMotorPower)sender;
            double            Motor_Power_Left  = query.doubleValues[0];                                                                                              // "Motor_Power_Left"
            double            Motor_Power_Right = query.doubleValues[1];                                                                                              // "Motor_Power_Right"

            if (Motor_Power_Left != prev_Motor_Power_Left || Motor_Power_Right != prev_Motor_Power_Right || (DateTime.Now - lastSentMotor_Power).TotalSeconds > 5.0d) // force send every 5 sec
            {
                //Tracer.Trace("MotorPower=" + Motor_Power_Left + "   " + Motor_Power_Right);
                prev_Motor_Power_Left  = Motor_Power_Left;
                prev_Motor_Power_Right = Motor_Power_Right;

                if (onValueReceived_MotorPower != null)
                {
                    ev.timestamp = query.whenReceivedTicks;
                    ev.value1    = Motor_Power_Left;
                    ev.value2    = Motor_Power_Right;
                    onValueReceived_MotorPower(this, ev);
                }
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }