Skip to content

Commit

Permalink
--noenergy switch add
Browse files Browse the repository at this point in the history
--found out that rmin_adaptive is the actual radius of the emergant circle!
  • Loading branch information
mani-monaj committed Dec 6, 2011
1 parent dbc15ab commit f5b1e5b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion contribcircle.cc
Expand Up @@ -71,6 +71,7 @@ static int loggerID; // The first robot who become active in Stage, logs everyth
static int NUMBEROFSEARCHINGROBOTS = 0; //For Performance analysis
static double timeOrigin;
static bool bEnabled = true; //Behaviour Enabled
static bool energyEnabled = true; //Enerrgy Consumption
static bool leaderEnabled = false;
static int globalRelayCount = 3;
static long int totalMessageCounterNaive = (NUMBEROFROBOTS * (NUMBEROFROBOTS - 1)) / 2;
Expand Down Expand Up @@ -244,6 +245,16 @@ extern "C" int Init( Model* mod, CtrlArgs* args )
printf("[ARG] Usage of knowledge enabled.\n");
}

if (args->cmdline.find("--noenergy") != std::string::npos)
{
printf("[ARG] Usage of energy disabled.\n");
energyEnabled = false;
}
else
{
printf("[ARG] Usage of energy enabled.\n");
}

if (args->cmdline.find("--leader") != std::string::npos)
{
printf("[ARG] One robot will start as INGROUP.\n");
Expand Down Expand Up @@ -446,7 +457,11 @@ int FiducialUpdate( ModelFiducial* fid, robot_t* robot)
{


robot->energy -= 2.5;
//Naive energy consumption model (note only in INGROUP mode)
if (energyEnabled == true)
{
robot->energy -= 2.5;
}
// Step 1: Look for incomming messages and take appropriate update

list<RobotMessage>::iterator mit;
Expand Down Expand Up @@ -638,6 +653,8 @@ int FiducialUpdate( ModelFiducial* fid, robot_t* robot)
/* This function must be calculated via Computation Geometery Methods*/

double rmin_adaptive = RMIN + ((bEnabled) ? ((double) robot->teammates.size() / 4.0) : 0.0);

rmin_adaptive = 12.0;
if (att_d < rmin_adaptive)
{
att_force = -FATTMAX;
Expand Down

0 comments on commit f5b1e5b

Please sign in to comment.