CSCI 3081 - Drone Delivery System
Public Member Functions | List of all members
csci3081::DeliverySimulation Class Reference

This is the facade for the delivery system. More...

#include <delivery_simulation.h>

Inheritance diagram for csci3081::DeliverySimulation:
Inheritance graph

Public Member Functions

 DeliverySimulation ()
 Constructor: this can do any setup your system necessitates.
 
 ~DeliverySimulation ()
 Desconstructor: This should free any memory that your program uses.
 
IEntityCreateEntity (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...
 
CarrierAvailableCarrier (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.
 

Detailed Description

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.

Member Function Documentation

◆ AddEntity()

void csci3081::DeliverySimulation::AddEntity ( IEntity entity)
virtual

This function should add an entity to the simulation

Implements csci3081::IDeliverySystem.

◆ AddFactory()

void csci3081::DeliverySimulation::AddFactory ( IEntityFactory factory)
virtual

This function should add a factory to the composite factory pattern

Implements csci3081::IDeliverySystem.

◆ AddObserver()

void csci3081::DeliverySimulation::AddObserver ( IEntityObserver observer)
virtual

Observer functions will not be used in iteration1

Implements csci3081::IDeliverySystem.

◆ CreateEntity()

IEntity * csci3081::DeliverySimulation::CreateEntity ( const picojson::object &  val)
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.

◆ GetEntities()

const std::vector< IEntity * > & csci3081::DeliverySimulation::GetEntities ( ) const
virtual

GetEntities should return all entities that have been ADDED to the system

Implements csci3081::IDeliverySystem.

◆ RemoveObserver()

void csci3081::DeliverySimulation::RemoveObserver ( IEntityObserver observer)
virtual

Observer functions will not be used in iteration1

Implements csci3081::IDeliverySystem.

◆ RunScript()

void csci3081::DeliverySimulation::RunScript ( const picojson::array &  script,
IEntitySystem system 
) const
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.

◆ ScheduleDelivery()

void csci3081::DeliverySimulation::ScheduleDelivery ( IEntity package,
IEntity dest 
)
virtual

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.

◆ SetGraph()

void csci3081::DeliverySimulation::SetGraph ( const IGraph graph)
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.

◆ Update()

void csci3081::DeliverySimulation::Update ( float  dt)
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.


The documentation for this class was generated from the following files: