User Tools

Site Tools


[[FAQ]] [[Tutorials]] [[Topics]]


The [[class>Configurable]] interface enables inherited objects to expose certain variables to be set externally via a key-value pair. This may be used within the code but also enables the user to change something from the [[Console]] or the [[Configurator]]. By default all robots, controllers and wirings are configurable. There you can simply add the following lines to your constructor or init function: <code c> addParameterDef("gamma", &gamma, .0, .0, 1.0, "harmony factor"); addParameterDef("twostep", &twostep, false, "whether two-step rule is used"); </code> Here gamma is a double with default value 0 and a range of 0 to 1. The twostep member variable is a boolean with default value false. The variables can be of type: int, bool, or double. You can also add a child configurable with ''addConfigurable(...)''. Finally how does the simulation knows which objects are configurable and should be visible on the console? In the [[classlpz>GlobalData]] structure is a list of configurables. In you [[Create a Simulation|main]] you typically add your agent to this list with <code c> global.configs.push_back ( agent ); </code> The agent has the controller the robot and the wiring as a child. You can also add your own objects to this list. A typical case is to derive the ThisSim class from configurable and add it to this list as well (''global.configs.push_back (this)'').

configurable.txt · Last modified: 2013/03/15 10:35 by georg