Ejemplo n.º 1
0
 public ButtonPressed(SensorInformation details, ButtonType buttonType) : this(EfficioRuntimePINVOKE.new_ButtonPressed(SensorInformation.getCPtr(details), (int)buttonType), true)
 {
     if (EfficioRuntimePINVOKE.SWIGPendingException.Pending)
     {
         throw EfficioRuntimePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 2
0
 public Faulted(SensorInformation details) : this(EfficioRuntimePINVOKE.new_Faulted(SensorInformation.getCPtr(details)), true)
 {
     if (EfficioRuntimePINVOKE.SWIGPendingException.Pending)
     {
         throw EfficioRuntimePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
 private void OnInfoUpdate(SensorInformation newInformation)
 {
     text.text = "Motor Information:\n" +
                 "\n" +
                 "Motor1: " + newInformation.motor1 + "\n" +
                 "Motor2: " + newInformation.motor2 + "\n" +
                 "Motor3: " + newInformation.motor3 + "\n" +
                 "Motor4: " + newInformation.motor4;
 }
Ejemplo n.º 4
0
        public virtual SensorInformation GetSensorInformation()
        {
            SensorInformation ret = new SensorInformation(EfficioRuntimePINVOKE.Sensor_GetSensorInformation(swigCPtr), true);

            if (EfficioRuntimePINVOKE.SWIGPendingException.Pending)
            {
                throw EfficioRuntimePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 5
0
    protected override void onHandlePacket(IClient client)
    {
        int robotLength = consume(4).asInt();

        string robot = consume(robotLength).asString();

        int jsonLength = consume(4).asInt();

        string json = consume(jsonLength).asString();

        SensorInformation info = JsonUtility.FromJson <SensorInformation>(json);

        ModuleClient.Instance.NewInfoFor(robot, info);
    }
Ejemplo n.º 6
0
        public DeviceSensorDetailPage(SensorInformation dataSensor)
        {
            switch (dataSensor)
            {
            case SensorInformation.Acelerometer:
                activeReader = new DeviceSensorDetailViewModel <VectorReading>(CrossDeviceSensors.Current.Accelerometer, (data) =>
                {
                    Reading.Text = $" X -> {data.X} - Y -> {data.Y} - Z ->  {data.Z}";
                });
                break;

            case SensorInformation.Magnetometer:
                activeReader = new DeviceSensorDetailViewModel <VectorReading>(CrossDeviceSensors.Current.Magnetometer, (data) =>
                {
                    Reading.Text = $" X -> {data.X} - Y -> {data.Y} - Z ->  {data.Z}";
                });
                break;

            case SensorInformation.Gyroscope:
                activeReader = new DeviceSensorDetailViewModel <VectorReading>(CrossDeviceSensors.Current.Gyroscope, (data) =>
                {
                    Reading.Text = $" X -> {data.X} - Y -> {data.Y} - Z ->  {data.Z}";
                });
                break;

            case SensorInformation.Barometer:
                activeReader = new DeviceSensorDetailViewModel <double>(CrossDeviceSensors.Current.Barometer, (data) =>
                {
                    Reading.Text = $"{data}";
                });
                break;

            case SensorInformation.Pedometer:
                activeReader = new DeviceSensorDetailViewModel <int>(CrossDeviceSensors.Current.Pedometer, (data) =>
                {
                    Reading.Text = $"{data}";
                });
                break;
            }
            InitializeComponent();
            BindingContext = activeReader;
        }
Ejemplo n.º 7
0
    private void OnInfoUpdate(SensorInformation info)
    {
        motor1 = info.motor1;
        motor2 = info.motor2;
        motor3 = info.motor3;
        motor4 = info.motor4;

        //we are only interested in the left and right rotations of the robot (Y axis)
        info.orientation.x = 0;
        info.orientation.z = 0;
        if (!got_first)
        {
            //obtain initial rotation of the robot using the gyroscope
            inital    = info.orientation;
            got_first = true;
        }

        //from the initial rotation, any changes in rotation will kept in check
        var newRotation = new Quaternion(transform.rotation.x, info.orientation.y - inital.y, transform.rotation.z, info.orientation.w);

        //All changes in rotation is also applied to the virtual robot
        gameObject.transform.rotation = newRotation;
    }
Ejemplo n.º 8
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SensorInformation obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Check if a sensor is registered in this registry or not.
 /// </summary>
 /// <param name="target"></param>
 /// <returns></returns>
 public bool IsRegistered(SensorInformation target)
 {
     return this.sensors.Any(sensor => sensor.Id == target.Id || (sensor.LogicalDeviceId == target.LogicalDeviceId && sensor.PhysicalDeviceId == target.PhysicalDeviceId));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Unregister a sensor to this registry.
 /// </summary>
 /// <param name="sensor"></param>
 /// <returns></returns>
 public Task UnregisterSensor(SensorInformation sensor)
 {
     this.classifiedSensors[sensor.Kind].Remove(sensor);
     this.sensors.Remove(sensor);
     return Task.FromResult(0);
 }
Ejemplo n.º 11
0
 private void OnInfoUpdate(SensorInformation info)
 {
     info.orientation.x            = 0;
     info.orientation.z            = 0;
     gameObject.transform.rotation = info.orientation;
 }
Ejemplo n.º 12
0
 public void NewInfoFor(string robot, SensorInformation info)
 {
     _actions.Enqueue(delegate { sensorCallbacks[robot](info); });
 }