Esempio n. 1
0
        void SendZMQUpdate(FaroArm.Interfaces.IFaroArmUpdate u)
        {
            // serialize this IFaroArmUpdate object to JSON
            string msg = JsonSerializer.Serialize(u);

            // and send it out (topic first as plain string, then JSON payload)
            this.publisherSocket.SendMoreFrame("ArmUpdate").SendFrame(msg);
        }
Esempio n. 2
0
        void PrintUpdate(FaroArm.Interfaces.IFaroArmUpdate u)
        {
            // remember: all positional units are in millimeters, divide by 25.4 to get inches
            double dX = this.lastX - u.X; double dY = this.lastY - u.Y; double dZ = this.lastZ - u.Z;

            Debug.WriteLine($"===== Arm Event #{this.msgCount} ======");
            Debug.WriteLine($"   X: {u.X:F3}mm, Y: {u.Y:F3}mm, Z: {u.Z:F3}mm    A: {u.A:F3}, B: {u.B:F3}, C: {u.C:F3} ");
            Debug.WriteLine($"   Delta: {dX:F3}, {dY:F3}, {dZ:F3}");
            Debug.WriteLine($"   Angles: 1:{u.Angle1:F3}, 2:{u.Angle2:F3}, 3:{u.Angle3:F3}, 4:{u.Angle4:F3}, 5:{u.Angle5:F3}, 6:{u.Angle6:F3}, 7:{u.Angle7:F3}");
            Debug.WriteLine($"   Buttons: {u.Buttons}, At Rest: {u.ArmAtRest}, Enc Ref'd: {u.EncodersReferenced}, End Stops: {u.EndStops}");
        }
Esempio n. 3
0
        void HandleFaroArmUpdate(object sender, FaroArm.Interfaces.FaroArmUpdateEventArgs e)
        {
            FaroArm.Interfaces.IFaroArmUpdate u = e.FaroArmUpdate;

            // NOTE: intentionally overriding the Faro timestamp with the msg #
            // TODO: create a class which implements IFaroArmUpdate and provides both
            //       faro timestamp and msg number.
            this.msgCount += 1;
            u.TimeStamp    = this.msgCount;

            this.SendZMQUpdate(u);

            // if user has pressed the arm trigger button, print details for that update
            // (instead of printing every message and overwhelming the logs)
            if (u.Buttons > 0)
            {
                this.PrintUpdate(u);
            }

            this.lastX = u.X; this.lastY = u.Y; this.lastZ = u.Z;
        }