About Download Manual API MATLAB Python C# Unity Java Demo tasks (MATLAB) Finding the Way in Maze Aiming the camera at an object Control the Chassis

Aiming the camera at an object (MATLAB task)

In this mission, the rover is tasked with finding the correct object and aiming its Mast navigation camera at the center of that object. In the laboratory environment, a space is prepared with different objects and with different colors. The preparation of the task is therefore very easy. Just move the rover to the right position using the teleport function and then save the task for future use. The mission will proceed by extending the rover's camera and rotating it while taking images. Subsequently, the images are processed and the position of the object is evaluated. A final command will then be sent to the rover to position the camera in the correct location. The key command created to make this task work is the "GetPicture" command, which when called along with the requested camera, returns an image written in a byte array. Another command is "engine MastTop number", which rotates with the camera. To take the necessary pictures, you need to know the field of view of the camera. For the Mast camera, the horizontal field of view is 105°. So the camera has to rotate by an angle of the field of view and then take a new picture and continue until the whole range is covered, i.e. 360°.

RoverPreservence

After obtaining the necessary images, it is time to recognize the correct object. Since the created objects are of a different color, it is convenient to use color-based recognition. For the red cube, a comparison mask is used that has RGB values (255, 0, 0). The images will then be compared and the one on which the red cube is captured will be found. Using the thresholding function, the center of the red cube is found, and the distance between the center of the object and the center of the captured image is determined by a simple calculation. This distance is then converted into an angle. The resulting camera rotation angle is therefore found at the value given by the order of the image, plus the calculated angle of the center of the object from the center of the given image.

RoverPreservence

RoverPreservence