Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Accessing a robot camera's display add text #6830

lucasl84 started this conversation in General
Accessing a robot camera's display add text #6830
May 12, 2025 * 1 comments * 2 replies
Return to top
Discussion options

lucasl84
May 12, 2025

Hi,

I'm facing an issue and not actually sure how to solve it even though I've read the documentation for the Display API (found here: Display API

I have a Pedestrian robot which has a camera named camera. The display of this camera is shown in the following screenshot:

I would like to add text to this display, but I don't understand how to reference it from my controller. How to I get an instance of that current display so I can call .drawText? I'm trying to add some text to it. I'm using the Python API. My whole controller is subclassing from Supervisor.

Thanks in advance,
Lucas.

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

CoolSpy3
May 12, 2025
Collaborator

Webots allows you to display overlays from either cameras or displays. The camera overlay is not modifiable with the display api.

In order to draw on top of a camera feed, you can link a display to the camera and then draw on the display. To do this, create a Display node inside of your robot. You can then access it in your controller with robot.getDevice(). Then, you can make the display show the camera feed with display.attachCamera(). You should then be able to use the other display API functions to modify the image.

Note that you can toggle each overlay from the Overlays tab. Also check out the display sample world File > Open Sample World > samples > devices > display.wbt

You must be logged in to vote
2 replies
Comment options

lucasl84 May 13, 2025
Author

@CoolSpy3 Thanks for your fast reply and the tips. I will check the example that you are referring to!

Comment options

CoolSpy3 May 14, 2025
Collaborator

You're welcome; Good luck! I hope you get it working :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
General
Labels
None yet
2 participants