Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

GyroSensor文档

版本:V0.0.8
描述:获取电子陀螺仪数据,支持VTZN的WIFI版本、蓝牙5.0版本

  • 提供加速度接口
  • 提供角速度接口
  • 提供角度接口
  • 提供四元数接口
  • 提供电量接口
  • 提供设备运行状态接口
  • 提供主动控制骑马机接口

使用文档

  1. TestGame 是示例场景,场景中挂在TestGame.cs脚本

  2. 在TestGame.cs脚本中注意添加以下部分
    this.SendEvent(new DeviceManagerEvent() { deviceType = _deviceType });
    语句中,deviceType为输入的硬件类型

  3. 发送事件后,获取设备管理器,此时分为两种情况:
    3.1 主动控制骑马机,即_deviceType = DeviceType.HorseControl时,使用
    horseControlManager = this.GetUtility<IHorseControlManager>();
    horseControlManager.Init(HorseIP);
    HorseIP:主动控制骑马机的IP地址
    3.2 其他设备,即非主动控制骑马机时,使用
    deviceManager = this.GetUtility<IDeviceManager>();
    deviceManager.Init(GyroSensorType.BLE);
    GyroSensorType.BLE:蓝牙传感器

  4. 使用方式
    4.1 主动控制骑马机使用时,需要连接WiFi
    WiFi名:Horse230725
    WiFi密码:0123456789

    • 在需要加档的位置调用horseControlManager.AddSpeed();
    • 在需要减档的位置调用horseControlManager.SubSpeed();
    • 在需要停止的位置调用horseControlManager.Stop();

    4.2 非主动控制骑马机设备使用时

    • 注册事件调用:deviceManager.logState += DeviceManager_LogState;
    • 通过deviceManager.GetKWH 和 deviceManager.GetSpeed()获取传感器电量和传感器使用数据
    • 注册连接状态的事件调用:
    • deviceManager.connectedState += DeviceManager_ConnectedState;
      当连接成功时connectedStateType = ConnectedStateType.BluetoothConnectSuccess

留下评论

您的电子邮箱地址不会被公开。 必填项已用*标注