Change SimulationOptions to Environment
This commit is contained in:
parent
697ef8d643
commit
cea4d13e6c
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,7 +38,6 @@ build/
|
|||||||
docs/doxygen/*
|
docs/doxygen/*
|
||||||
|
|
||||||
# IDE
|
# IDE
|
||||||
.vscode/
|
|
||||||
qtrocket.pro.user
|
qtrocket.pro.user
|
||||||
.qmake.stash
|
.qmake.stash
|
||||||
|
|
||||||
|
17
.vscode/c_cpp_properties.json
vendored
Normal file
17
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/g++",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64",
|
||||||
|
"configurationProvider": "ms-vscode.cmake-tools"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
|
||||||
|
}
|
@ -56,13 +56,13 @@ set(PROJECT_SOURCES
|
|||||||
sim/ConstantGravityModel.cpp
|
sim/ConstantGravityModel.cpp
|
||||||
sim/ConstantGravityModel.h
|
sim/ConstantGravityModel.h
|
||||||
sim/DESolver.h
|
sim/DESolver.h
|
||||||
|
sim/Environment.h
|
||||||
sim/GeoidModel.h
|
sim/GeoidModel.h
|
||||||
sim/GravityModel.cpp
|
sim/GravityModel.cpp
|
||||||
sim/GravityModel.h
|
sim/GravityModel.h
|
||||||
sim/Propagator.cpp
|
sim/Propagator.cpp
|
||||||
sim/Propagator.h
|
sim/Propagator.h
|
||||||
sim/RK4Solver.h
|
sim/RK4Solver.h
|
||||||
sim/SimulationOptions.h
|
|
||||||
sim/SphericalGeoidModel.cpp
|
sim/SphericalGeoidModel.cpp
|
||||||
sim/SphericalGeoidModel.h
|
sim/SphericalGeoidModel.h
|
||||||
sim/SphericalGravityModel.cpp
|
sim/SphericalGravityModel.cpp
|
||||||
@ -79,6 +79,8 @@ set(PROJECT_SOURCES
|
|||||||
utils/CurlConnection.h
|
utils/CurlConnection.h
|
||||||
utils/Logger.cpp
|
utils/Logger.cpp
|
||||||
utils/Logger.h
|
utils/Logger.h
|
||||||
|
utils/MotorModelDatabase.cpp
|
||||||
|
utils/MotorModelDatabase.h
|
||||||
utils/RSEDatabaseLoader.cpp
|
utils/RSEDatabaseLoader.cpp
|
||||||
utils/RSEDatabaseLoader.h
|
utils/RSEDatabaseLoader.h
|
||||||
utils/ThreadPool.cpp
|
utils/ThreadPool.cpp
|
||||||
|
@ -71,11 +71,11 @@ QtRocket::QtRocket()
|
|||||||
logger = utils::Logger::getInstance();
|
logger = utils::Logger::getInstance();
|
||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
// Need to set some sane defaults for Simulation Options
|
// Need to set some sane defaults for the Environment
|
||||||
// The default constructor for SimulationOptions will do that for us, so just use that
|
// The default constructor for Environment will do that for us, so just use that
|
||||||
setSimulationOptions(std::make_shared<sim::SimulationOptions>());
|
setEnvironment(std::make_shared<sim::Environment>());
|
||||||
|
|
||||||
rocket =
|
rocket.first =
|
||||||
std::make_shared<Rocket>();
|
std::make_shared<Rocket>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
24
QtRocket.h
24
QtRocket.h
@ -7,6 +7,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
@ -16,8 +17,10 @@
|
|||||||
#include "model/Rocket.h"
|
#include "model/Rocket.h"
|
||||||
#include "sim/AtmosphericModel.h"
|
#include "sim/AtmosphericModel.h"
|
||||||
#include "sim/GravityModel.h"
|
#include "sim/GravityModel.h"
|
||||||
#include "sim/SimulationOptions.h"
|
#include "sim/Environment.h"
|
||||||
|
#include "sim/Propagator.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/MotorModelDatabase.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QtRocket class is the master controller for the QtRocket application.
|
* @brief The QtRocket class is the master controller for the QtRocket application.
|
||||||
@ -38,18 +41,20 @@ public:
|
|||||||
|
|
||||||
void runSim();
|
void runSim();
|
||||||
|
|
||||||
std::shared_ptr<sim::GravityModel> getGravityModel() { return simOptions->getGravityModel(); }
|
|
||||||
std::shared_ptr<sim::AtmosphericModel> getAtmosphereModel() { return simOptions->getAtmosphericModel(); }
|
std::shared_ptr<sim::Environment> getEnvironment() { return environment; }
|
||||||
double getTimeStep() { return simOptions->getTimeStep(); }
|
void setTimeStep(double t) { rocket.second->setTimeStep(t); }
|
||||||
std::shared_ptr<Rocket> getRocket() { return rocket; }
|
std::shared_ptr<Rocket> getRocket() { return rocket.first; }
|
||||||
|
|
||||||
|
std::shared_ptr<utils::MotorModelDatabase> getMotorDatabase() { return motorDatabase; }
|
||||||
|
|
||||||
void addMotorModels(std::vector<model::MotorModel>& m);
|
void addMotorModels(std::vector<model::MotorModel>& m);
|
||||||
|
|
||||||
const std::vector<model::MotorModel>& getMotorModels() const { return motorModels; }
|
const std::vector<model::MotorModel>& getMotorModels() const { return motorModels; }
|
||||||
|
|
||||||
void addRocket(std::shared_ptr<Rocket> r) { rocket = r; }
|
void addRocket(std::shared_ptr<Rocket> r) { rocket.first = r; }
|
||||||
|
|
||||||
void setSimulationOptions(std::shared_ptr<sim::SimulationOptions> options) { simOptions = options; }
|
void setEnvironment(std::shared_ptr<sim::Environment> e) { environment = e; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtRocket();
|
QtRocket();
|
||||||
@ -66,9 +71,10 @@ private:
|
|||||||
|
|
||||||
utils::Logger* logger;
|
utils::Logger* logger;
|
||||||
|
|
||||||
std::shared_ptr<Rocket> rocket;
|
std::pair<std::shared_ptr<Rocket>, std::shared_ptr<sim::Propagator>> rocket;
|
||||||
|
|
||||||
std::shared_ptr<sim::SimulationOptions> simOptions;
|
std::shared_ptr<sim::Environment> environment;
|
||||||
|
std::shared_ptr<utils::MotorModelDatabase> motorDatabase;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
1416
docs/qtrocketUML.xmi
1416
docs/qtrocketUML.xmi
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
|||||||
#include "SimOptionsWindow.h"
|
#include "SimOptionsWindow.h"
|
||||||
#include "ui_SimOptionsWindow.h"
|
#include "ui_SimOptionsWindow.h"
|
||||||
|
|
||||||
#include "sim/SimulationOptions.h"
|
#include "sim/Environment.h"
|
||||||
|
|
||||||
SimOptionsWindow::SimOptionsWindow(QWidget *parent) :
|
SimOptionsWindow::SimOptionsWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@ -31,7 +31,7 @@ SimOptionsWindow::SimOptionsWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// populate the combo boxes
|
// populate the combo boxes
|
||||||
|
|
||||||
std::shared_ptr<sim::SimulationOptions> options(new sim::SimulationOptions);
|
std::shared_ptr<sim::Environment> options(new sim::Environment);
|
||||||
std::vector<std::string> atmosphereModels = options->getAvailableAtmosphereModels();
|
std::vector<std::string> atmosphereModels = options->getAvailableAtmosphereModels();
|
||||||
std::vector<std::string> gravityModels = options->getAvailableGravityModels();
|
std::vector<std::string> gravityModels = options->getAvailableGravityModels();
|
||||||
|
|
||||||
@ -60,12 +60,12 @@ void SimOptionsWindow::on_buttonBox_accepted()
|
|||||||
{
|
{
|
||||||
QtRocket* qtrocket = QtRocket::getInstance();
|
QtRocket* qtrocket = QtRocket::getInstance();
|
||||||
|
|
||||||
std::shared_ptr<sim::SimulationOptions> options(new sim::SimulationOptions);
|
std::shared_ptr<sim::Environment> environment(new sim::Environment);
|
||||||
|
|
||||||
options->setTimeStep(ui->timeStep->text().toDouble());
|
qtrocket->setTimeStep(ui->timeStep->text().toDouble());
|
||||||
options->setGravityModel(ui->gravityModelCombo->currentText().toStdString());
|
environment->setGravityModel(ui->gravityModelCombo->currentText().toStdString());
|
||||||
options->setAtmosphereModel(ui->atmosphereModelCombo->currentText().toStdString());
|
environment->setAtmosphereModel(ui->atmosphereModelCombo->currentText().toStdString());
|
||||||
qtrocket->setSimulationOptions(options);
|
qtrocket->setEnvironment(environment);
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ Rocket::Rocket() : propagator(this)
|
|||||||
|
|
||||||
void Rocket::launch()
|
void Rocket::launch()
|
||||||
{
|
{
|
||||||
propagator.setTimeStep(QtRocket::getInstance()->getTimeStep());
|
|
||||||
propagator.clearStates();
|
propagator.clearStates();
|
||||||
propagator.setCurrentTime(0.0);
|
propagator.setCurrentTime(0.0);
|
||||||
mm.startMotor(0.0);
|
mm.startMotor(0.0);
|
||||||
|
@ -1,47 +1,44 @@
|
|||||||
#ifndef SIMULATIONOPTIONS_H
|
#ifndef SIM_ENVIRONMENT_H
|
||||||
#define SIMULATIONOPTIONS_H
|
#define SIM_ENVIRONMENT_H
|
||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "sim/GravityModel.h"
|
|
||||||
#include "sim/SphericalGravityModel.h"
|
|
||||||
#include "sim/ConstantGravityModel.h"
|
#include "sim/ConstantGravityModel.h"
|
||||||
|
#include "sim/SphericalGravityModel.h"
|
||||||
|
|
||||||
#include "sim/AtmosphericModel.h"
|
|
||||||
#include "sim/ConstantAtmosphere.h"
|
#include "sim/ConstantAtmosphere.h"
|
||||||
#include "sim/USStandardAtmosphere.h"
|
#include "sim/USStandardAtmosphere.h"
|
||||||
|
#include "sim/GeoidModel.h"
|
||||||
|
|
||||||
namespace sim
|
namespace sim
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The SimulationOptions class holds the available simulation options and environmental models
|
* @brief Holds simulation environment information, such as the gravity model, atmosphere model,
|
||||||
|
* Geoid model
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class SimulationOptions
|
class Environment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SimulationOptions()
|
Environment()
|
||||||
{
|
{
|
||||||
setTimeStep(0.01);
|
|
||||||
setGravityModel("Constant Gravity");
|
setGravityModel("Constant Gravity");
|
||||||
setAtmosphereModel("Constant Atmosphere");
|
setAtmosphereModel("Constant Atmosphere");
|
||||||
}
|
}
|
||||||
~SimulationOptions() = default;
|
~Environment() = default;
|
||||||
SimulationOptions(const SimulationOptions&) = delete;
|
Environment(const Environment&) = delete;
|
||||||
SimulationOptions(SimulationOptions&&) = delete;
|
Environment(Environment&&) = delete;
|
||||||
SimulationOptions& operator=(const SimulationOptions&) = delete;
|
Environment& operator=(const Environment&) = delete;
|
||||||
SimulationOptions& operator=(SimulationOptions&&) = delete;
|
Environment& operator=(Environment&&) = delete;
|
||||||
|
|
||||||
std::vector<std::string> getAvailableGravityModels()
|
std::vector<std::string> getAvailableGravityModels()
|
||||||
{
|
{
|
||||||
@ -59,7 +56,6 @@ public:
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTimeStep(double t) { timeStep = t; }
|
|
||||||
void setGravityModel(const std::string& model)
|
void setGravityModel(const std::string& model)
|
||||||
{
|
{
|
||||||
if(model == "Constant Gravity")
|
if(model == "Constant Gravity")
|
||||||
@ -94,7 +90,6 @@ public:
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
std::shared_ptr<sim::GravityModel> getGravityModel() { return gravityModels[gravityModel]; }
|
std::shared_ptr<sim::GravityModel> getGravityModel() { return gravityModels[gravityModel]; }
|
||||||
double getTimeStep() { return timeStep; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -106,12 +101,11 @@ private:
|
|||||||
{"Constant Gravity", std::shared_ptr<sim::GravityModel>()},
|
{"Constant Gravity", std::shared_ptr<sim::GravityModel>()},
|
||||||
{"Spherical Gravity", std::shared_ptr<sim::GravityModel>()}};
|
{"Spherical Gravity", std::shared_ptr<sim::GravityModel>()}};
|
||||||
|
|
||||||
double timeStep{0.01};
|
|
||||||
|
|
||||||
std::string gravityModel{"Constant Gravity"}; /// Constant Gravity Model is the default
|
std::string gravityModel{"Constant Gravity"}; /// Constant Gravity Model is the default
|
||||||
std::string atmosphereModel{"Constant Atmosphere"}; /// Constant Atmosphere Model is the default
|
std::string atmosphereModel{"Constant Atmosphere"}; /// Constant Atmosphere Model is the default
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace sim
|
||||||
|
|
||||||
#endif // SIMULATIONOPTIONS_H
|
|
||||||
|
#endif // SIM_ENVIRONMENT_H
|
@ -98,20 +98,20 @@ double Propagator::getMass()
|
|||||||
double Propagator::getForceX()
|
double Propagator::getForceX()
|
||||||
{
|
{
|
||||||
QtRocket* qtrocket = QtRocket::getInstance();
|
QtRocket* qtrocket = QtRocket::getInstance();
|
||||||
return (currentState[3] >= 0 ? -1.0 : 1.0) * qtrocket->getAtmosphereModel()->getDensity(currentState[2])/ 2.0 * 0.008107 * rocket->getDragCoefficient() * currentState[3]* currentState[3];
|
return (currentState[3] >= 0 ? -1.0 : 1.0) * qtrocket->getEnvironment()->getAtmosphericModel()->getDensity(currentState[2])/ 2.0 * 0.008107 * rocket->getDragCoefficient() * currentState[3]* currentState[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
double Propagator::getForceY()
|
double Propagator::getForceY()
|
||||||
{
|
{
|
||||||
QtRocket* qtrocket = QtRocket::getInstance();
|
QtRocket* qtrocket = QtRocket::getInstance();
|
||||||
return (currentState[4] >= 0 ? -1.0 : 1.0) * qtrocket->getAtmosphereModel()->getDensity(currentState[2]) / 2.0 * 0.008107 * rocket->getDragCoefficient() * currentState[4]* currentState[4];
|
return (currentState[4] >= 0 ? -1.0 : 1.0) * qtrocket->getEnvironment()->getAtmosphericModel()->getDensity(currentState[2]) / 2.0 * 0.008107 * rocket->getDragCoefficient() * currentState[4]* currentState[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
double Propagator::getForceZ()
|
double Propagator::getForceZ()
|
||||||
{
|
{
|
||||||
QtRocket* qtrocket = QtRocket::getInstance();
|
QtRocket* qtrocket = QtRocket::getInstance();
|
||||||
double gravity = (qtrocket->getGravityModel()->getAccel(currentState[0], currentState[1], currentState[2])).x3;
|
double gravity = (qtrocket->getEnvironment()->getGravityModel()->getAccel(currentState[0], currentState[1], currentState[2])).x3;
|
||||||
double airDrag = (currentState[5] >= 0 ? -1.0 : 1.0) * qtrocket->getAtmosphereModel()->getDensity(currentState[2]) / 2.0 * 0.008107 * rocket->getDragCoefficient() * currentState[5]* currentState[5];
|
double airDrag = (currentState[5] >= 0 ? -1.0 : 1.0) * qtrocket->getEnvironment()->getAtmosphericModel()->getDensity(currentState[2]) / 2.0 * 0.008107 * rocket->getDragCoefficient() * currentState[5]* currentState[5];
|
||||||
double thrust = rocket->getThrust(currentTime);
|
double thrust = rocket->getThrust(currentTime);
|
||||||
return gravity + airDrag + thrust;
|
return gravity + airDrag + thrust;
|
||||||
}
|
}
|
||||||
|
66
utils/MotorModelDatabase.cpp
Normal file
66
utils/MotorModelDatabase.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// class header
|
||||||
|
#include "utils/MotorModelDatabase.h"
|
||||||
|
|
||||||
|
/// \cond
|
||||||
|
// C headers
|
||||||
|
// C++ headers
|
||||||
|
// 3rd party headers
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
|
// qtrocket project headers
|
||||||
|
#include "QtRocket.h"
|
||||||
|
|
||||||
|
namespace utils
|
||||||
|
{
|
||||||
|
|
||||||
|
MotorModelDatabase::MotorModelDatabase()
|
||||||
|
: motorModelMap()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MotorModelDatabase::~MotorModelDatabase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MotorModelDatabase::addMotorModel(const model::MotorModel& m)
|
||||||
|
{
|
||||||
|
utils::Logger* logger = QtRocket::getInstance()->getLogger();
|
||||||
|
std::string name = m.data.commonName;
|
||||||
|
if(motorModelMap.find(name) != motorModelMap.end())
|
||||||
|
{
|
||||||
|
logger->debug("Replacing MotorModel " + name + " in MotorModelDatabase");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger->info("Adding MotorModel " + name + " to MotorModelDatabase");
|
||||||
|
}
|
||||||
|
motorModelMap[name] = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MotorModelDatabase::addMotorModels(const std::vector<model::MotorModel>& models)
|
||||||
|
{
|
||||||
|
utils::Logger* logger = QtRocket::getInstance()->getLogger();
|
||||||
|
for(const auto& i : models)
|
||||||
|
{
|
||||||
|
addMotorModel(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<model::MotorModel> MotorModelDatabase::getMotorModel(const std::string& name)
|
||||||
|
{
|
||||||
|
auto mm = motorModelMap.find(name);
|
||||||
|
if(mm == motorModelMap.end())
|
||||||
|
{
|
||||||
|
Logger::getInstance()->debug("Unable to locate " + name + " in MotorModel database");
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::getInstance()->debug("Retrieved " + name + " from MotorModel database");
|
||||||
|
return motorModelMap[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace utils
|
74
utils/MotorModelDatabase.h
Normal file
74
utils/MotorModelDatabase.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#ifndef UTILS_MOTORMODELDATABASE_H
|
||||||
|
#define UTILS_MOTORMODELDATABASE_H
|
||||||
|
|
||||||
|
/// \cond
|
||||||
|
// C headers
|
||||||
|
// C++ headers
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
|
// 3rd party headers
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
|
// qtrocket headers
|
||||||
|
#include "model/MotorModel.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace utils
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief MotorModelDatabase is a simple storage, search, and retrieval mechanism for Model Rocket
|
||||||
|
* motors.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class MotorModelDatabase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MotorModelDatabase();
|
||||||
|
~MotorModelDatabase();
|
||||||
|
|
||||||
|
// No copies
|
||||||
|
MotorModelDatabase(const MotorModelDatabase&) = delete;
|
||||||
|
MotorModelDatabase(MotorModelDatabase&&) = delete;
|
||||||
|
MotorModelDatabase& operator=(const MotorModelDatabase&) = delete;
|
||||||
|
MotorModelDatabase& operator=(MotorModelDatabase&&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a single MotorModel to the database. If that MotorModel already exists, it is
|
||||||
|
* replaced.
|
||||||
|
*
|
||||||
|
* @param model MotorModel to add
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void addMotorModel(const model::MotorModel& m);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds multiple motor models at once. Any duplicates already in the datbase are replaced.
|
||||||
|
*
|
||||||
|
* @param model MotorModels to add
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void addMotorModels(const std::vector<model::MotorModel>& models);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the Motor Model by Common Name
|
||||||
|
*
|
||||||
|
* @param name Motor Common name
|
||||||
|
* @return std::optional<model::MotorModel>
|
||||||
|
*/
|
||||||
|
std::optional<model::MotorModel> getMotorModel(const std::string& name);
|
||||||
|
private:
|
||||||
|
|
||||||
|
// The "database" is really just a map. :)
|
||||||
|
/// motorModelMap is keyed off of the motor commonName
|
||||||
|
std::map<std::string, model::MotorModel> motorModelMap;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace utils
|
||||||
|
|
||||||
|
#endif // UTILS_MOTORMODELDATABASE_H
|
Loading…
x
Reference in New Issue
Block a user