コード例 #1
0
bool homeostaticModule::addNewDrive(string driveName)
{

    cout << "adding a default drive..." << endl;
    Drive* drv = new Drive(driveName);


    drv->setHomeostasisMin(drv->homeostasisMin);
    drv->setHomeostasisMax(drv->homeostasisMax);
    drv->setDecay(drv->decay);
    drv->setValue((drv->homeostasisMax + drv->homeostasisMin) / 2.);
    drv->setGradient(false);
    
    manager.addDrive(drv);
    
    cout << "default drive added. Opening ports..."<<endl;
    openPorts(driveName);
    cout << "new drive created successfully!"<<endl;

    return true;
}
コード例 #2
0
bool homeostaticModule::addNewDrive(string driveName, yarp::os::Bottle& grpHomeostatic)
{

    
    Drive* drv = new Drive(driveName);


    drv->setHomeostasisMin(grpHomeostatic.check((driveName + "-homeostasisMin"), Value(drv->homeostasisMin)).asDouble());
    drv->setHomeostasisMax(grpHomeostatic.check((driveName + "-homeostasisMax"), Value(drv->homeostasisMax)).asDouble());
    cout << "H1 " << grpHomeostatic.check((driveName + "-decay"), Value(drv->decay)).asDouble() <<endl; 
    drv->setDecay(grpHomeostatic.check((driveName + "-decay"), Value(drv->decay)).asDouble());
    drv->setValue((drv->homeostasisMax + drv->homeostasisMin) / 2.);
    drv->setGradient(grpHomeostatic.check((driveName + "-gradient"), Value(drv->gradient)).asBool());
    cout << "h2 " << drv->decay << endl;
    //cout << drv->name << " " << drv->homeostasisMin << " " << drv->homeostasisMax << " " << drv->decay << " " <<drv->gradient << endl;
    //cout << d << endl;
    //cout << grpHomeostatic.toString()<<endl;
    manager.addDrive(drv);
     cout << "h2 " << manager.drives[0]->decay << endl;
   
    openPorts(driveName);

    return true;
}