Esempio n. 1
0
    void CheckForArmUpdate()
    {
        while (this.subSocket.TryReceiveFrameString(out this.msgString))
        {   // messages will come in pairs, with the first being the topic "ArmUpdate" and second being the arm update payload
            if (this.msgString == "ArmUpdate")
            {
                string    msg = this.subSocket.ReceiveFrameString();
                ArmUpdate u   = JsonUtility.FromJson <ArmUpdate>(msg);
                ProcessArmUpdate(u);
            }
        }

        // now schedule the next check (otherwise we would stop checking)
        Invoke("CheckForArmUpdate", this.armCheckFrequency);
    }
Esempio n. 2
0
    void ProcessArmUpdate(ArmUpdate u)
    {
        if (this.debugMode || u.Buttons == 2) // green button only
        {
            Debug.Log($"ArmJointController :: Arm update #{u.TimeStamp} received");
        }

        this.axis1Xform.localEulerAngles       = new Vector3(0, u.Angle1 + this.axis1RotAdj, 0);
        this.axis2Xform.localEulerAngles       = new Vector3(u.Angle2 + this.axis2RotAdj, 0, 0);
        this.axis3Xform.localEulerAngles       = new Vector3(0, u.Angle3 + this.axis3RotAdj, 0);
        this.axis4Xform.localEulerAngles       = new Vector3(0, 0, u.Angle4 + this.axis4RotAdj);
        this.axis5Xform.localEulerAngles       = new Vector3(0, u.Angle5 + this.axis5RotAdj, 0);
        this.axis6Xform.localEulerAngles       = new Vector3(0, 0, u.Angle6 + this.axis6RotAdj);
        this.axis7Xform.localEulerAngles       = new Vector3(0, u.Angle7 + this.axis7RotAdj, 0);
        this.driverReportedProbePoint.position = new Vector3(u.X, u.Y, u.Z) + this.driverReportedProbePointAdj;

        if (this.laserBeam && u.Buttons == 1) // red button only
        {
            EmitDevastation();
        }
    }