What it does when you execute the supervisor:
Essentially the first few calls are:
in supervisor.cc:
SUPERVISOR_MAIN(Demo_Supervisor);
which calls, in
SupervisorBase.hh:
int main(int argc, char** argv) {\
bool safety; safety=(argc<2 || !((argv[1][0] == '-' && argv[1][1] == 'd')));\
SupervisorClass* super = new SupervisorClass(); \
if (super->configure()) \
{ super->run(safety);}\
delete super; \
}
When you pass in -d to the supervisor it sets 'safety' to 0 in the call to run(safety). The first thing it does is super->configure() which is in SupervisorBase.cc:
bool SupervisorBase::configure() {
MMReadConfigFile( "list.rc" );
MMReadConfigFile( "versionlist.rc" );
MMReadConfigFile( "robotlist.rc" );
return true;
}
(MMReadConfigFile() is in ModuleManager.cc in /RoboDevel/Libraries/RHexLib/base/ )
When it loads versionlist.rc, one of the sub-files it loads is rise_arachi.rc which sets the .cdl file and integration times. SettingArachiIntegrationTimes gives more detail about this.
This prints out:
Loading configuration file list.rc...done.
Loading configuration file versionlist.rc...done.
Loading configuration file robotlist.rc...done.
Then, it executes the 'super->run(safety)' call, which is void SupervisorBase::run(bool safety)
in SupervisorBase.cc line 90.
This does a lot of things like loading up modules. However, the first thing it
executes is:
// Initialize hardware interface layer
initHardware(); // line 94
which calls function initHardware( void ) in RiSESimHW.cc in
/RoboDevel/RiSE/RobotCode/Hardware/RiSESimHW/
This prints out:
Initializing low level hardware interface ( RiSESim )...
<and a bunch of other stuff>
Then it does all the module-loading stuff.
On line 104,
addModule( _logserv, LOGSERVER_PERIOD, LOGSERVER_OFFSET,
LOGSERVER_ORDER, true );
causes it to print out:
LogServer::LogPool allocated 19MB
On line 112,
if (!initialize())
causes it to call
virtual bool initialize() {
in supervisor.cc line 134. This does quite a bit of additional module loading,
including loading up all the gaits and gait-modules and stuff like that. It prints
out all the stuff it is loading up--it is calling the initialize() method
in each of the modules, I believe. Of note, included in these modules it loads are
RiSECalibMachine, HitDetector, and StateProxy, in that order. Look at the actual file
to see everything it loads.
Finally, the main loop it executes is:
if (finalize())
MMMainLoop();
which is line 130 in SupervisorBase.cc. Note that the finalize() function it calls
is in supervisor.cc line 212.
Other Notes:
CVS in the users directory:
cvs co users/jkarpick/BatchSim
File of interest is:
/home/aasbeck/RoboDevel/Libraries/SimLib/src/libcdl/CDLInterface.cc
<verbatim>
(gdb) break CDLInterface::readCreature
(gdb) bt
#0 sim::CDLInterface::readCreature(char const*, bool, char const*) (this=0x8123f0c,
filename=0xbfffe320 "simplerise.ocdl", sr_switch=192, binfilename=0x0)
at CDLInterface.cc:133
#1 0x080a6ccd in sim::CDLInterface::readCreature(char const*) (this=0x82978b8,
filename=0xbfffe320 "simplerise.ocdl") at CDLInterface.cc:124
#2 0x08081821 in initHardware() () at RiSESimHW.cc:416
#3 0x0804b9a0 in main (argc=1, argv=0xbfffe4b4) at BatchSim.cc:414
#4 0x40390ab7 in __libc_start_main () from /lib/libc.so.6
</verbatim>
Also of interest:
/home/aasbeck/RoboDevel/RiSE/RobotCode/Hardware/RiSESimHW/RiSESimHW.cc
==> this contains initHardware() which is what causes the program to fail.
rise.ocdl, etc. are in
/RoboDevel/RiSE/Demo/Config/models
ModuleManager.cc is in /RoboDevel/Libraries/RHexLib/base/
ModuleManager.hh is in /RoboDevel/Libraries/RHexLib/include/
/home/aasbeck/RoboDevel/RiSE/Demo/Config/robots/arachi/ contains a number of
configuration files including the important rise_arachi.rc which contains the
simulation parameters and other info.
!!!!!!!!! Note that the code in BatchSim is quite similar to the code in
supervisor.cc in /RoboDevel/RiSE/Demo/Supervisor/ !
I think you need to start the modules in a certain order or it won't work correctly..
!!! Note that on the real RiSE simulation (if you're running the simulation),
you have to start the supervisor from the
/RoboDevel/RiSE/Supervisor directory which contains links to all the .ocdl files and to
the Config directory and stuff. If you try to start it from the
/RoboDevel/RiSE/Demo/Supervisor directory which ACTUALLY contains the supervisor,
it won't work because it doesn't have the .ocdl files in the directory with it!
See also SupervisorBase.hh in
/home/aasbeck/RoboDevel/RiSE/RobotCode/Behaviors/include/modules !!!
and SupervisorBase.cc !
-- AlanAsbeck - 07 Dec 2006