CSCI 3081 - Drone Delivery System
|
This is the facade for the delivery system. More...
#include <delivery_simulation.h>
Public Member Functions | |
DeliverySimulation () | |
Constructor: this can do any setup your system necessitates. | |
~DeliverySimulation () | |
Desconstructor: This should free any memory that your program uses. | |
IEntity * | CreateEntity (const picojson::object &val) |
void | AddFactory (IEntityFactory *factory) |
void | AddEntity (IEntity *entity) |
void | SetGraph (const IGraph *graph) |
void | ScheduleDelivery (IEntity *package, IEntity *dest) |
void | AddObserver (IEntityObserver *observer) |
void | RemoveObserver (IEntityObserver *observer) |
const std::vector< IEntity * > & | GetEntities () const |
void | Update (float dt) |
void | RunScript (const picojson::array &script, IEntitySystem *system) const |
You do not need to worry about this function. More... | |
Carrier * | AvailableCarrier (IEntity *package) |
Return pointer to the most suitable available carrier (e.g. drone, robot, etc) to deliver a package. Choose the one available, not out of battery, closest to the package. | |
Public Member Functions inherited from csci3081::IDeliverySystem | |
virtual | ~IDeliverySystem () |
Destructor. | |
Public Member Functions inherited from entity_project::IEntitySystem | |
virtual | ~IEntitySystem () |
Destructor. | |
This is the facade for the delivery system.
This class will delegate operations for the whole delivery system. See the documentation for IDeliverySystem for more information.
|
virtual |
This function should add an entity to the simulation
Implements csci3081::IDeliverySystem.
|
virtual |
This function should add a factory to the composite factory pattern
Implements csci3081::IDeliverySystem.
|
virtual |
Observer functions will not be used in iteration1
Implements csci3081::IDeliverySystem.
|
virtual |
Given the picojson::object val, this should create an entity. Based on the type of entity, there may be different fields. You can see the vals that will be passed in the project/web/scenes directory. Some of the fields are for our backend system and you don't need to worry about them. (for instance, mesh, rotation, offset, etc.)
Some fields in val that you will need to create the entity correctly:
type: string (could be "drone/customer/package")
name: string
position: array (contains [x_position, y_position, z_position])
direction: array (contains [x, y, z])
speed: float
battery_capacity: float
Don't add the entity to the simulation until it is passed in via AddEntity
Implements csci3081::IDeliverySystem.
|
virtual |
GetEntities should return all entities that have been ADDED to the system
Implements csci3081::IDeliverySystem.
|
virtual |
Observer functions will not be used in iteration1
Implements csci3081::IDeliverySystem.
|
virtual |
You do not need to worry about this function.
This function takes care of turning json into function calls of your system. YOU DO NOT NEED TO IMPLEMENT THIS it is already implemented in the delivery_simulation.cc we have provided.
Implements csci3081::IDeliverySystem.
This function tells the simulation that the IEntity* package should be delivered to the IEntity* dest (which is likely a customer). How the delivery takes place is entirely dependent on how you design your code, but it should involve a drone navigating to the package, picking it up, and then moving to the customer and dropping the package.
Implements csci3081::IDeliverySystem.
|
virtual |
This function should simply store a reference to the IGraph* somewhere. The IGraph contains useful functions such as the GetPath function which can be used to get a path from one position to another.
Implements csci3081::IDeliverySystem.
|
virtual |
This function is used to advance time in the simulation. float dt refers to the amount of time the update call should advance the simulation by. For instance if a drone moves 1 unit of distance per unit of time, and Update is called with dt=.05, then the drone should move 1 * .05 = .05 units of distance.
Some things that should happen in the Update function: move drones, check if packages have been delivered to customers, move recharge drone & fill up battery to dead carriers, ect...
Implements csci3081::IDeliverySystem.