Exemplo n.º 1
0
 /// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="_robot"></param>
 public Camera(Robot _robot)
     : base(_robot)
 {
     head_position = Rovio.API.Camera.HeadPosition.DOWN;
     resolution = Rovio.API.Camera.ImageResolution.CGA;
     image_compression = Rovio.API.Camera.ImageCompression.LOW;
     flicker_frequency = Rovio.API.Camera.CameraFlickerFrequency.AUTO;
     brightness = 0;
     framerate = 0;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Update all camera parameters excluding the image.
        /// </summary>
        public override void Update()
        {
            robot.API.Movement.Report.Update();

            //store the current AutoUpdate value of the Report and switch it off when accessing multiple values
            bool auto_update = robot.API.Movement.Report.AutoUpdate;
            robot.API.Movement.Report.AutoUpdate = false;

            int hp = robot.API.Movement.Report.HeadPosition;
            if (hp <= 100)
                head_position = API.Camera.HeadPosition.UP;
            else if (hp <= 170)
                head_position = API.Camera.HeadPosition.MIDDLE;
            else
                head_position = API.Camera.HeadPosition.DOWN;

            resolution = robot.API.Movement.Report.Resolution;

            //restore the AutoUpdate value of the Report
            robot.API.Movement.Report.AutoUpdate = auto_update;
        }