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
9c24154d
ctrl
k
Sign In
fixed: not sending msg to front end
Browse Code
main
backend-fix
Integration-v2
Hongzheng Li
committed
1 year ago
9c24154d
1 parent
eb5307ec
service/src/simulationmodel/SimulationModel.cc
■ ■ ■ ■
■
■
skipped 5 lines
6
6
#include "PackageFactory.h"
7
7
#include "RobotFactory.h"
8
8
#include "RechargeStationFactory.h"
9
+
#include "DroneBatteryDecorator.h"
9
10
10
11
SimulationModel::SimulationModel(IController& controller)
11
12
: controller(controller) {
skipped 30 lines
42
43
std::string type = entity["type"];
43
44
if (type == "recharge_station") {
44
45
rechargeStations.push_back(myNewEntity->getPosition());
45
-
std::cout << "Position: " << myNewEntity->getPosition()[0] << ", " << myNewEntity->getPosition()[1] << ", " << myNewEntity->getPosition()[2] << std::endl;
46
+
} else if (type == "drone") {
47
+
myNewEntity = new DroneBatteryDecorator(dynamic_cast<Drone*>(myNewEntity), 100, 100, 20, 4.0);
48
+
// myNewEntity->addObserver(this); // sending low battery notifications
46
49
}
47
50
}
48
51
skipped 94 lines
All occurrences
service/src/simulationmodel/entity/decorator/DroneBatteryDecorator.cc
■
■
■ ■ ■ ■
skipped 102 lines
103
103
toRechargeStation = nullptr;
104
104
}
105
105
} else if (droneReady) {
106
-
DroneDecorator
:
:
update(dt);
106
+
sub
-
>
update(dt);
107
107
}
108
108
109
109
if (isAtRechargeStation() && notCharging == false) {
skipped 15 lines
All occurrences
service/src/simulationmodel/factory/DroneFactory.cc
■
■
■ ■ ■ ■
skipped 3 lines
4
4
std::string type = entity["type"];
5
5
if (type.compare("drone") == 0) {
6
6
std::cout << "Drone Created" << std::endl;
7
-
return new
DroneBatteryDecorator
(
new
Drone(entity
)
,
100
,
100
,
20
,
5
.
0
);
7
+
return new Drone(entity);
8
8
}
9
9
return nullptr;
10
10
}
skipped 1 lines
All occurrences
service/src/simulationmodel
SimulationModel.cc
entity/decorator/DroneBatteryDecorator.cc
factory/DroneFactory.cc
Please wait...
Page is in error, reload to recover