Пример #1
0
        /// <summary>
        /// preferred method for Head pan/tilt control
        /// </summary>
        /// <param name="panDegreesFromCenter"></param>
        /// <param name="tiltDegreesFromCenter"></param>
        public void setPanTilt(double panDegreesFromCenter, double tiltDegreesFromCenter)
        {
            currentPan = panDegreesFromCenter;

            double mksPan = PanTiltAlignment.getInstance().mksPan(panDegreesFromCenter);

            int panMks = (int)mksPan;


            currentTilt = tiltDegreesFromCenter;

            double mksTilt = PanTiltAlignment.getInstance().mksTilt(tiltDegreesFromCenter);

            int tiltMks = (int)mksTilt;


            if (panMks != panMksLast || tiltMks != tiltMksLast)
            {
                panMksLast  = panMks;
                tiltMksLast = tiltMks;

                Debug.WriteLine("setPanTilt: panMks=" + panMks + "  tiltMks=" + tiltMks);

                ToArduino toArduino1 = new ToArduino {
                    channel = (int)AnimationChannels.PAN, command = (int)AnimationCommands.SET_VALUE, commandValues = new int[] { panMks }
                };
                ToArduino toArduino2 = new ToArduino {
                    channel = (int)AnimationChannels.TILT, command = (int)AnimationCommands.SET_VALUE, commandValues = new int[] { tiltMks }
                };

                SendToArduino2(toArduino1, toArduino2);
            }
        }
Пример #2
0
        /// <summary>
        /// Jaw open angle
        /// </summary>
        /// <param name="degreesFromCenter"></param>
        public void setJaw(double degreesFromCenter)
        {
            currentJaw = degreesFromCenter;

            double mks = PanTiltAlignment.getInstance().mksTilt(degreesFromCenter);

            setJawMks((int)mks);
        }
Пример #3
0
        /// <summary>
        /// Head pan
        /// </summary>
        /// <param name="degreesFromCenter"></param>
        public void setPan(double degreesFromCenter)
        {
            currentPan = degreesFromCenter;

            double mks = PanTiltAlignment.getInstance().mksPan(degreesFromCenter);

            setPanMks((int)mks);
        }