CSCI 3081 - Drone Delivery System
recharge_drone.h
Go to the documentation of this file.
1 
7 #ifndef INC_RCGDRONE_H_
8 #define INC_RCGDRONE_H_
9 
10 /*******************************************************************************
11  * Includes
12  ******************************************************************************/
13 #include "entity_base.h"
14 //#include <vector> // Used for vector like vector3D and vector2D
15 #include <iostream>
16 #include <string>
17 #include <vector> // Used for vector like vector3D and vector2D
18 
19 #include "battery.h"
20 #include "carrier.h"
21 #include "entity_base.h"
22 #include "package.h"
23 #include "vector.h"
24 // #include "route_strategy.h"
25 #include "beeline_route.h"
26 #include "parabolic_route.h"
27 #include "smart_route.h"
28 
29 namespace csci3081 {
30 /*******************************************************************************
31  * Class Definitions
32  ******************************************************************************/
39  public:
46  RechargeDrone(const picojson::object& val);
47 
61  bool IsCurrentlyCharging();
68  void ChargeFromStation(float dt);
69 
77  bool IsChargingCarrierFull(float dt);
78 
84  bool BatteryDead();
85 
89  float GetBattery();
90 
91 
95  float GetBatteryMaxCharge();
96 
104  bool Charging(float);
105 
111  void SetSpeed(float);
112 
116  float GetSpeed();
117 
123  void SetPosition(std::vector<float> v);
124 
131  void SetDynamic(bool dynamic_);
132 
138  void SetRoute(std::vector<vector<float>>);
139 
144  std::vector<float> NextPosition();
145 
150  void PopPosition();
151 
159  void Update(float dt);
160 
168  void GetStatus();
169 
174  void SetDeadCarrier(Carrier* carrier);
185  void SetPositionOfStation(vector<float> station);
190  vector<float> GetPositionOfStation();
197  bool IsChargingACarrier();
198 
210  bool BatteryFull();
211  private:
212  Battery battery;
213  float speed;
214  bool alreadyNotified = false;
215  bool isCurrentlyCharging = false;
216  std::vector<std::vector<float>> route;
217  RouteStrategy* routeStrategy = NULL;
218  std::vector<float> PositionOfStation;
219  Carrier* DeadCarrier = NULL;
220 
221 };
222 
223 } // namespace csci3081
224 
225 #endif /* INC_RCGDRONE_H_ */
RechargeDrone(const picojson::object &val)
Definition: recharge_drone.cc:10
float GetBatteryMaxCharge()
This returns the max charge of the recharge drone&#39;s battery.
Definition: recharge_drone.cc:105
void GetStatus()
Overwritten GetStatus from ASubject. This function creates the arguments required by Notify function ...
Definition: recharge_drone.cc:162
vector< float > GetPositionOfStation()
This function Get the position of the station(SetPositionOfStation)
Definition: recharge_drone.cc:195
bool IsCurrentlyCharging()
This function will charge the recharging drone at the station when there is no DeadCarrier.
Definition: recharge_drone.cc:60
void SetRoute(std::vector< vector< float >>)
This function adds a full route to route attribute of the carrier This is useful when use for the Get...
Definition: recharge_drone.cc:132
bool BatteryFull()
This function checks the battery Capacity to see if it&#39;s full or not. This function should be called ...
Definition: recharge_drone.cc:97
bool IsChargingACarrier()
This function should check the DeadCarrier pointer if its null or not and check if the DeadCarrier is...
Definition: recharge_drone.cc:178
void SetDeadCarrier(Carrier *carrier)
This function set the DeadCarrier Pointer to a new carrier.
Definition: recharge_drone.cc:182
Definition: battery.h:26
std::vector< float > NextPosition()
This function returns the next position in std::vector<float> in the queue that the carrier needs to ...
Definition: recharge_drone.cc:137
Definition: asubject.cc:3
void PopPosition()
This function pops the first element/position in the position queue of the carrier.
Definition: recharge_drone.cc:148
float GetSpeed()
return the current speed of the carrier
Definition: recharge_drone.cc:128
void ChargeFromStation(float dt)
This function will charge the recharging drone at the station when there is no DeadCarrier.
Definition: recharge_drone.cc:64
Carrier * GetDeadCarrier()
This function set the DeadCarrier Pointer to a new carrier.
Definition: recharge_drone.cc:187
bool BatteryDead()
This checks if the recharging drone is out of battery.
Definition: recharge_drone.cc:93
A representation of a drone It stores the drone&#39;s name, ID, version, position, direction, speed, and dynamic mode.
Definition: recharge_drone.h:38
void Update(float dt)
This is an inherited method from EntityBase to use for DeliverySimulation. This updates the position ...
Definition: recharge_drone.cc:199
bool Charging(float)
This function is used to charge the battery of the carrier for a certain amount of time in seconds...
Definition: recharge_drone.cc:109
bool IsChargingCarrierFull(float dt)
This function will charge the DeadCarrier if the DeadCarrier is not charged to full. After the DeadCarrier get charged to full it will set the DeadCarrier Charging Status to false so the simulation will know the DeadCarrier is ready to be schduled.
Definition: recharge_drone.cc:77
void SetPositionOfStation(vector< float > station)
This function set the position of the station(SetPositionOfStation) to a new position.
Definition: recharge_drone.cc:191
RouteStrategy * GetRouteStrategy()
return the Route Strategy that the carrier uses, such as Smart Route, Beeline, or Parabolic Route ...
Definition: recharge_drone.cc:174
float GetBattery()
This returns the time in secs left in the carrier&#39;s battery.
Definition: recharge_drone.cc:101
The base class for creating entities.
Definition: entity_base.h:27
void SetSpeed(float)
This sets the speed of the carrier. Change the speed of the carrier if the argument is a non-negative...
Definition: recharge_drone.cc:122
A representation of a carrier An abstract base class for delivery transportation clases like Drone or...
Definition: carrier.h:31
void SetPosition(std::vector< float > v)
This function uses to set the new position of the carrier. However, carrier only moves in simulation ...
Definition: recharge_drone.cc:113
This is the Route Strategy class where we can use the interface to decide which type of route behavio...
Definition: route_strategy.h:24
This is the Abstract Subject class from which our subjects will inherit Implements the Observer/subje...
Definition: asubject.h:22
void SetDynamic(bool dynamic_)
This changes the dynamic of the recharge drone. Note that for the recharge drone to move on the simul...
Definition: recharge_drone.cc:118