Skip to content

Commit 15b142a

Browse files
committed
stop
1 parent 0022d5f commit 15b142a

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

loop-functions/gianduja/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ target_link_libraries(gianduja_aggregation_loopfunc argos3_demiurge_loop_functio
1616
add_library(gianduja_stop_loopfunc SHARED GiandujaStopLoopFunc.h GiandujaStopLoopFunc.cpp )
1717
target_link_libraries(gianduja_aggregation_loopfunc argos3_demiurge_loop_functions)
1818

19-
add_library(gianduja_beacon_aggregation_loopfunc SHARED GiandujaBeaconAggregationLoopFunc.h GiandujaBeaconAggregationLoopFunc.cpp )
20-
target_link_libraries(gianduja_beacon_aggregation_loopfunc argos3_demiurge_loop_functions)
19+
add_library(gianduja_beacon_aggregation_loopfunc SHARED GiandujaBeaconAggregationLoopFunc.h GiandujaBeaconAggregationLoopFunc.cpp ../../../robots-thesis/src/beacon_epuck/epuck_beacon.h ../../../robots-thesis/src/beacon_epuck/epuck_beacon.cpp)
20+
target_link_libraries(gianduja_beacon_aggregation_loopfunc argos3_demiurge_loop_functions )
2121

22+
add_library(gianduja_beacon_stop_loopfunc SHARED GiandujaBeaconStopLoopFunc.h GiandujaBeaconStopLoopFunc.cpp )
23+
target_link_libraries(gianduja_beacon_stop_loopfunc argos3_demiurge_loop_functions)

loop-functions/gianduja/GiandujaBeaconAggregationLoopFunc.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ void GiandujaBeaconAggregationLoopFunction::SetMessageBeacon() {
103103
CEPuckEntity& cEntity = dynamic_cast<CEPuckEntity&>(GetSpace().GetEntity("beacon0"));
104104
CEPuckBeacon& cController = dynamic_cast<CEPuckBeacon&>(cEntity.GetControllableEntity().GetController());
105105
cController.setMessage(m_unMes);
106-
//LOG << "Time=" << m_Tbar << std::endl;
106+
if (m_unMes==0) {
107+
LOG << "Message=" << m_unMes << "blanc" << std::endl;
108+
}
109+
else if (m_unMes==1) {
110+
LOG << "Message=" << m_unMes << "noir"<< std::endl;
111+
}
107112
} catch (std::exception& ex) {
108113
LOGERR << "Error while casting SetMessageBeacon: " << ex.what() << std::endl;
109114
}
@@ -154,11 +159,11 @@ void GiandujaBeaconAggregationLoopFunction::PostStep() {
154159
/****************************************/
155160

156161
void GiandujaBeaconAggregationLoopFunction::PostExperiment() {
157-
LOG<< "fit: " << 24000-m_fObjectiveFunction << std::endl;
162+
LOG<< "fit: " << 25200-m_fObjectiveFunction << std::endl;
158163
}
159164

160165
Real GiandujaBeaconAggregationLoopFunction::GetObjectiveFunction() {
161-
SInt32 score = 24000-m_fObjectiveFunction;
166+
SInt32 score = 25200-m_fObjectiveFunction;
162167
return (score);
163168
}
164169

loop-functions/gianduja/GiandujaBeaconStopLoopFunc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GiandujaBeaconStopLoopFunction::GiandujaBeaconStopLoopFunction() {
1010
m_CCoordRect1 = CVector2(1.25,-0.5);
1111

1212
m_CCoordRect2Pos = CVector2(-0.8,-1);
13-
//m_CCoordRect2 = CVector2(-1.25,-1.25);
13+
m_CCoordRect2 = CVector2(-1.25,-1.25);
1414

1515
m_unCostI = 0;
1616
m_unCostO = 0;
@@ -87,11 +87,11 @@ argos::CColor GiandujaBeaconStopLoopFunction::GetFloorColor(const argos::CVector
8787
}
8888

8989

90-
void GiandujaBeaconAggregationLoopFunction::ExtractTime() {
90+
void GiandujaBeaconStopLoopFunction::ExtractTime() {
9191
try {
9292
CEPuckEntity& cEntity = dynamic_cast<CEPuckEntity&>(GetSpace().GetEntity("beacon0"));
9393
CEPuckBeacon& cController = dynamic_cast<CEPuckBeacon&>(cEntity.GetControllableEntity().GetController());
94-
m_Tbar = cController.getTBar();
94+
m_unTbar = cController.getTBar();
9595
//LOG << "Time=" << m_Tbar << std::endl;
9696
} catch (std::exception& ex) {
9797
LOGERR << "Error while casting ExtractTime: " << ex.what() << std::endl;
@@ -159,7 +159,7 @@ void GiandujaBeaconStopLoopFunction::PostStep() {
159159
}
160160
else {
161161
if ( (cEpuckPosition.GetX()<=m_CCoordRect1.GetX()) && (cEpuckPosition.GetX()>=m_CCoordRect2.GetX()) && (cEpuckPosition.GetY()>=m_CCoordRect2.GetY()) && (cEpuckPosition.GetY()<=m_CCoordRect1.GetY()) ) {
162-
m_unCostI+=1
162+
m_unCostI+=1;
163163
}
164164
}
165165
}
@@ -185,4 +185,4 @@ Real GiandujaBeaconStopLoopFunction::GetObjectiveFunction() {
185185
return (m_fObjectiveFunction);
186186
}
187187

188-
REGISTER_LOOP_FUNCTIONS(GiandujaBeaconStopLoopFunction, "gianduja_stop_loop_functions");
188+
REGISTER_LOOP_FUNCTIONS(GiandujaBeaconStopLoopFunction, "gianduja_beacon_stop_loop_functions");

loop-functions/gianduja/GiandujaBeaconStopLoopFunc.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
#include <argos3/core/simulator/space/space.h>
66
#include <argos3/plugins/robots/e-puck/simulator/epuck_entity.h>
77

8+
9+
#include "../../../robots-thesis/src/beacon_epuck/epuck_beacon.h"
10+
811
using namespace argos;
912

1013
class GiandujaBeaconStopLoopFunction: public CoreLoopFunctions {
1114
public:
12-
GiandujaStopLoopFunction();
13-
GiandujaStopLoopFunction(const GiandujaStopLoopFunction& orig);
14-
virtual ~GiandujaStopLoopFunction();
15+
GiandujaBeaconStopLoopFunction();
16+
GiandujaBeaconStopLoopFunction(const GiandujaBeaconStopLoopFunction& orig);
17+
virtual ~GiandujaBeaconStopLoopFunction();
1518

1619
virtual void Destroy();
1720

@@ -23,12 +26,14 @@ class GiandujaBeaconStopLoopFunction: public CoreLoopFunctions {
2326
virtual CVector3 GetRandomPosition();
2427

2528
Real GetObjectiveFunction();
29+
void PlaceBeacon();
30+
void ExtractTime();
2631

2732
private:
2833
Real m_fRadius;
2934
CVector2 m_cCoordSpot1;
3035
CVector2 m_CCoordRect1;
31-
//CVector2 m_CCoordRect2;
36+
CVector2 m_CCoordRect2;
3237
CVector2 m_CCoordRect2Pos;
3338
CVector2 m_CCoordRect1Pos;
3439

0 commit comments

Comments
 (0)