|
Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
|
Function that performs the connections between the different connectors of the different modules. These connections are based on the configuration from the ConfigParser.
{
//-- Attach the modules to the other modules
for(int i = 0; i < (int) modules.size(); i++)
{
std::vector< std::vector<int> > connectorConfig = configParser.getConnectorInfo(i);
if (connectorConfig.size() == 0)
{
std::cerr << "[ModularRobot] Error: no connector info was found!" << std::endl;
return false;
}
for (int j = 0; j < (int) connectorConfig.size(); j++)
{
if ( connectorConfig[j].size() != 0 )
{
int moduleConnectedTo = connectorConfig[j][0];
int connectorConnectedTo = connectorConfig[j][1];
int orientation = connectorConfig[j][2];
modules[i]->attach( j,
modules[moduleConnectedTo]->getConnector(connectorConnectedTo),
orientation);
}
else
modules[i]->attach(j, NULL);
}
}
return true;
}
|
1.7.4