Creating a custom widget / ui window

Requests regarding how to set up experiments in ARGoS.
Elendurwen
Posts: 32
Joined: Sat Aug 24, 2013 5:08 pm
Contact:

Creating a custom widget / ui window

Postby Elendurwen » Wed Apr 11, 2018 3:57 pm

Hi,

I would like to add a window with some qt elements, like circles, text, etc. to the argos window. Ideally, this window would show up when a robot is clicked, and let user know which robot has been clicked (display a robot id or similar). How could I achieve this?

I have started with putting the following into the Pre-step function of my custom loop function code:

Code: Select all

CQTOpenGLRender& render = dynamic_cast<CQTOpenGLRender&>(GetSimulator().GetVisualization()); render.GetMainWindow()...
however, the main window doesn't allow to add anything to it.

The end purpose of this is to show a popup window with a dynamic diagram of a neural network once a robot is clicked.

pincy
Site Admin
Posts: 267
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Creating a custom widget / ui window

Postby pincy » Wed Apr 11, 2018 4:41 pm

For this you don't use the loop functions (they know nothing about visualization), but the Qt user functions: https://github.com/ilpincy/argos3/blob/ ... unctions.h.

The method you want to use, in particular, is GetMainWindow() as a parent of new widgets. More methods to know what was selected are available. Check the Lua editor in the same directory, and the Buzz editor for more information on how to get internal state of the robots. I suggest you to look into Buzz if you want to visualize the internal state of a robot. BTW, I am working on a "swarm debugger" based on Buzz - if you're interested, we could have a chat about that.

Also check the trajectory example and the foraging example for a way to mix data received from the simulation (you collect it in the loop functions) and then displayed in a Qt widget.
I made ARGoS.


Return to “How to... ?”



cron