1Dev
Projects
Global Views
Pull Requests
Issues
Builds
Packages
drone_simulation
Code
Files
Commits
Branches
Tags
Code Comments
Code Compare
Pull Requests
Issues
List
Boards
Iterations
Builds
Packages
Statistics
Code
Child Projects
Projects
drone_simulation
Commits
9d3d81b1
ctrl
k
Sign In
Make comments a bit more clear
Browse Code
main
backend-fix
Integration-v2
Alex Nagel
committed
1 year ago
9d3d81b1
1 parent
582e1dd0
service/src/simulationmodel/SimulationModel.cc
■ ■ ■
■ ■ ■
skipped 41 lines
42
42
43
43
std::string type = entity["type"];
44
44
if (type == "recharge_station") {
45
-
rechargeStations.push_back(myNewEntity->getPosition());
45
+
rechargeStations.push_back(myNewEntity->getPosition());
46
46
} else if (type == "drone") {
47
-
myNewEntity = new DroneBatteryDecorator(
48
-
dynamic_cast<Drone*>(myNewEntity), 100, 100, 20, 4.0);
49
-
entities[myNewEntity->getId()] = myNewEntity;
50
-
// update the entity in the map
51
-
// myNewEntity->addObserver(this)
52
-
// sending low battery notifications
47
+
// Allow drone to send notifications even with decorator
48
+
myNewEntity = new DroneBatteryDecorator(
49
+
dynamic_cast<Drone*>(myNewEntity), 100, 100, 20, 4.0);
50
+
entities[myNewEntity->getId()] = myNewEntity;
53
51
}
54
52
}
55
53
skipped 94 lines
All occurrences
service/src/simulationmodel/entity/decorator/DroneBatteryDecorator.cc
■
■
■ ■ ■ ■
skipped 26 lines
27
27
bool createMessage = currentCharge % 20 == 0;
28
28
29
29
30
+
// Create message to show the drone's charge ever 20%
30
31
if (createMessage) {
31
32
std::string message = getName() + " now at " +
32
33
std::to_string(currentCharge) + "% charge";
skipped 89 lines
122
123
123
124
distanceToDestination =
124
125
strategy->totalPathDistance(currentPosition);
125
-
126
126
127
127
} else if (sub->getToFinalDestinationStrategy()) {
128
128
droneIdleTime = 0;
skipped 82 lines
All occurrences
service/src/simulationmodel
SimulationModel.cc
entity/decorator/DroneBatteryDecorator.cc
Please wait...
Page is in error, reload to recover