0
$\begingroup$

I'm using Webots R2022b and I would like to have a supervisor controller that applies an algorithm on the camera data recorded by the Mavic2Pro drone on an another robot. But, when calling the getDevice function in the supervisor controller, the device is not found.

Is there any way to get the Mavic2Pro camera device from the supervisor controller?

Disclaimer: I am a Webots developer working at Cyberbotics. This is a question we get very often and I hope the answer can help other users.

$\endgroup$

1 Answer 1

1
$\begingroup$

In Webots, there is only one controller program per Robot node. The controller program can access only the devices (sensors and actuators) listed in its children field. Therefore it is not possible for a robot controller to access the device of another robot. So, if you would like that a supervisor robot controller processes the images taken by the Mavic2Pro robot, you should get the images in the Mavic2Pro controller and send them to the supervisor robot controller using for example an Emitter/Receiver system.

Alternatively, you may want to change the default content of the cameraSlot of the Mavic2Pro proto and insert a supervisor Robot node that would have its own controller and contain a Camera node in its children list:

Mavic2Pro {
  controller "mavic_controller"
  cameraSlot Robot {
    supervisor TRUE
    controller "supervisor_controller"
    children Camera {
      width 400
      height 240
    }
  }
}

In that case however, the mavic_controller won't be able to access the camera device as it will be the exclusive property of the supervisor Robot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.