Beispiel #1
0
        /**
         * <summary>
         *   Retrieves a quaternion component for a given identifier.
         * <para>
         *   The identifier can be specified using several formats:
         * </para>
         * <para>
         * </para>
         * <para>
         *   - FunctionLogicalName
         * </para>
         * <para>
         *   - ModuleSerialNumber.FunctionIdentifier
         * </para>
         * <para>
         *   - ModuleSerialNumber.FunctionLogicalName
         * </para>
         * <para>
         *   - ModuleLogicalName.FunctionIdentifier
         * </para>
         * <para>
         *   - ModuleLogicalName.FunctionLogicalName
         * </para>
         * <para>
         * </para>
         * <para>
         *   This function does not require that the quaternion component is online at the time
         *   it is invoked. The returned object is nevertheless valid.
         *   Use the method <c>YQt.isOnline()</c> to test if the quaternion component is
         *   indeed online at a given time. In case of ambiguity when looking for
         *   a quaternion component by logical name, no error is notified: the first instance
         *   found is returned. The search is performed first by hardware name,
         *   then by logical name.
         * </para>
         * </summary>
         * <param name="func">
         *   a string that uniquely characterizes the quaternion component
         * </param>
         * <returns>
         *   a <c>YQt</c> object allowing you to drive the quaternion component.
         * </returns>
         */
        public static YQt FindQt(string func)
        {
            YQt obj;

            obj = (YQt)YFunction._FindFromCache("Qt", func);
            if (obj == null)
            {
                obj = new YQt(func);
                YFunction._AddToCache("Qt", func, obj);
            }
            return(obj);
        }
Beispiel #2
0
        protected static void yInternalGyroCallback(YQt obj, String value)
        {
            YGyro gyro = (YGyro)obj.get_userData();

            if (gyro == null)
            {
                return;
            }
            string tmp       = obj.get_functionId().Substring(2);
            int    idx       = Convert.ToInt32(tmp);
            double dbl_value = Convert.ToDouble(value);

            gyro._invokeGyroCallbacks(idx, dbl_value);
        }
Beispiel #3
0
        public virtual int _loadQuaternion()
        {
            int now_stamp = 0;
            int age_ms    = 0;

            now_stamp = (int)((YAPI.GetTickCount()) & (0x7FFFFFFF));
            age_ms    = (((now_stamp - this._qt_stamp)) & (0x7FFFFFFF));
            if ((age_ms >= 10) || (this._qt_stamp == 0))
            {
                if (this.load(10) != YAPI.SUCCESS)
                {
                    return(YAPI.DEVICE_NOT_FOUND);
                }
                if (this._qt_stamp == 0)
                {
                    this._qt_w = YQt.FindQt("" + this._serial + ".qt1");
                    this._qt_x = YQt.FindQt("" + this._serial + ".qt2");
                    this._qt_y = YQt.FindQt("" + this._serial + ".qt3");
                    this._qt_z = YQt.FindQt("" + this._serial + ".qt4");
                }
                if (this._qt_w.load(9) != YAPI.SUCCESS)
                {
                    return(YAPI.DEVICE_NOT_FOUND);
                }
                if (this._qt_x.load(9) != YAPI.SUCCESS)
                {
                    return(YAPI.DEVICE_NOT_FOUND);
                }
                if (this._qt_y.load(9) != YAPI.SUCCESS)
                {
                    return(YAPI.DEVICE_NOT_FOUND);
                }
                if (this._qt_z.load(9) != YAPI.SUCCESS)
                {
                    return(YAPI.DEVICE_NOT_FOUND);
                }
                this._w        = this._qt_w.get_currentValue();
                this._x        = this._qt_x.get_currentValue();
                this._y        = this._qt_y.get_currentValue();
                this._z        = this._qt_z.get_currentValue();
                this._qt_stamp = now_stamp;
            }
            return(YAPI.SUCCESS);
        }
    public virtual int _loadQuaternion()
    {
      int now_stamp = 0;
      int age_ms = 0;

      now_stamp = (int)((YAPI.GetTickCount()) & (0x7FFFFFFF));
      age_ms = (((now_stamp - this._qt_stamp)) & (0x7FFFFFFF));
      if ((age_ms >= 10) || (this._qt_stamp == 0))
      {
        if (this.load(10) != YAPI.SUCCESS)
        {
          return YAPI.DEVICE_NOT_FOUND;
        }
        if (this._qt_stamp == 0)
        {
          this._qt_w = YQt.FindQt("" + this._serial + ".qt1");
          this._qt_x = YQt.FindQt("" + this._serial + ".qt2");
          this._qt_y = YQt.FindQt("" + this._serial + ".qt3");
          this._qt_z = YQt.FindQt("" + this._serial + ".qt4");
        }
        if (this._qt_w.load(9) != YAPI.SUCCESS)
        {
          return YAPI.DEVICE_NOT_FOUND;
        }
        if (this._qt_x.load(9) != YAPI.SUCCESS)
        {
          return YAPI.DEVICE_NOT_FOUND;
        }
        if (this._qt_y.load(9) != YAPI.SUCCESS)
        {
          return YAPI.DEVICE_NOT_FOUND;
        }
        if (this._qt_z.load(9) != YAPI.SUCCESS)
        {
          return YAPI.DEVICE_NOT_FOUND;
        }
        this._w = this._qt_w.get_currentValue();
        this._x = this._qt_x.get_currentValue();
        this._y = this._qt_y.get_currentValue();
        this._z = this._qt_z.get_currentValue();
        this._qt_stamp = now_stamp;
      }
      return YAPI.SUCCESS;
    }
 protected static void yInternalGyroCallback(YQt obj, String value)
 {
   YGyro gyro = (YGyro)obj.get_userData();
   if (gyro == null)
   {
     return;
   }
   string tmp = obj.get_functionId().Substring(2);
   int idx = Convert.ToInt32(tmp);
   double dbl_value = Convert.ToDouble(value);
   gyro._invokeGyroCallbacks(idx, dbl_value);
 }
 /**
  * <summary>
  *   Retrieves a quaternion component for a given identifier.
  * <para>
  *   The identifier can be specified using several formats:
  * </para>
  * <para>
  * </para>
  * <para>
  *   - FunctionLogicalName
  * </para>
  * <para>
  *   - ModuleSerialNumber.FunctionIdentifier
  * </para>
  * <para>
  *   - ModuleSerialNumber.FunctionLogicalName
  * </para>
  * <para>
  *   - ModuleLogicalName.FunctionIdentifier
  * </para>
  * <para>
  *   - ModuleLogicalName.FunctionLogicalName
  * </para>
  * <para>
  * </para>
  * <para>
  *   This function does not require that the quaternion component is online at the time
  *   it is invoked. The returned object is nevertheless valid.
  *   Use the method <c>YQt.isOnline()</c> to test if the quaternion component is
  *   indeed online at a given time. In case of ambiguity when looking for
  *   a quaternion component by logical name, no error is notified: the first instance
  *   found is returned. The search is performed first by hardware name,
  *   then by logical name.
  * </para>
  * </summary>
  * <param name="func">
  *   a string that uniquely characterizes the quaternion component
  * </param>
  * <returns>
  *   a <c>YQt</c> object allowing you to drive the quaternion component.
  * </returns>
  */
 public static YQt FindQt(string func)
 {
   YQt obj;
   obj = (YQt)YFunction._FindFromCache("Qt", func);
   if (obj == null)
   {
     obj = new YQt(func);
     YFunction._AddToCache("Qt", func, obj);
   }
   return obj;
 }