示例#1
0
        /// <summary>
        /// Update this NaoState with new values retrieved from the Nao. This includes battery charge, robot position,
        /// robot rotation, et cetera.
        /// </summary>
        /// <exception cref="UnavailableConnectionException">NaoState is not connected to a Nao.</exception>
        public void Update()
        {
            try
            {
                List <float> vector = motion.getRobotPosition(true);
                Location = new PointF(vector[0], vector[1]);
                Rotation = vector[2];
                BatteryPercentageLeft = battery.getBatteryCharge();
                Temperature           = (float)memory.getData("Device/SubDeviceList/Battery/Temperature/Sensor/Value");

                // update idle
                Idle = EventQueue.Nao.Current == null;
            }
            catch (Exception e)
            {
                Logger.Log(this, "Failed Update(). Unknown exception occurred: " + e.ToString());
            }

            // Count the time between this update and the next.
            Stopwatch.Restart();
        }