File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ void AggregationSingleSpot::Reset() {
64
64
CoreLoopFunctions::Reset ();
65
65
}
66
66
67
+
67
68
/* ***************************************/
68
69
/* ***************************************/
69
70
Original file line number Diff line number Diff line change 14
14
#include < argos3/plugins/robots/e-puck/simulator/epuck_entity.h>
15
15
16
16
#include " ../../src/CoreLoopFunctions.h"
17
+ // #include "/home/aligot/Desktop/Arena/NEAT-private/src/controllers/NeuralNetworkRM1Dot2Binary.h"
17
18
18
19
using namespace argos ;
19
20
Original file line number Diff line number Diff line change @@ -104,7 +104,13 @@ void ForagingTwoSpotsLoopFunction::PostStep() {
104
104
UInt32 unId;
105
105
for (CSpace::TMapPerType::iterator it = tEpuckMap.begin (); it != tEpuckMap.end (); ++it) {
106
106
CEPuckEntity* pcEpuck = any_cast<CEPuckEntity*>(it->second );
107
- unId = atoi (pcEpuck->GetId ().substr (5 , 2 ).c_str ());
107
+ // unId = atoi(pcEpuck->GetId().substr(5, 2).c_str());
108
+ // expects the id to be in the following form: epuck_{unId}_{robotId}
109
+ std::string robot_id = pcEpuck->GetId ();
110
+ UInt8 first_underscore = robot_id.find (" _" );
111
+ UInt8 second_underscore = robot_id.find (" _" , first_underscore+1 );
112
+ robot_id = robot_id.substr (first_underscore, second_underscore-first_underscore);
113
+ unId = atoi (robot_id.c_str ());
108
114
cEpuckPosition.Set (pcEpuck->GetEmbodiedEntity ().GetOriginAnchor ().Position .GetX (),
109
115
pcEpuck->GetEmbodiedEntity ().GetOriginAnchor ().Position .GetY ());
110
116
@@ -117,8 +123,10 @@ void ForagingTwoSpotsLoopFunction::PostStep() {
117
123
} else if (cEpuckPosition.GetY () <= m_fNestLimit) {
118
124
m_fObjectiveFunction = m_fObjectiveFunction + m_punFoodData[unId];
119
125
m_punFoodData[unId] = 0 ;
126
+ // LOG << "Obj " << m_fObjectiveFunction << std::endl;
120
127
}
121
128
}
129
+
122
130
if (score_temp != m_fObjectiveFunction) {
123
131
LOGERR << " Obj " << m_fObjectiveFunction << std::endl;
124
132
}
You can’t perform that action at this time.
0 commit comments