Added ConstantGravityModel. Always -9.8 m/s**2 in the z-direction
This commit is contained in:
parent
a6845d4552
commit
f172e26d01
@ -7,6 +7,9 @@
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "sim/USStandardAtmosphere.h"
|
||||
#include "sim/ConstantGravityModel.h"
|
||||
|
||||
|
||||
// Initialize static member data
|
||||
QtRocket* QtRocket::instance = nullptr;
|
||||
@ -64,6 +67,12 @@ QtRocket::QtRocket()
|
||||
{
|
||||
logger = utils::Logger::getInstance();
|
||||
running = false;
|
||||
|
||||
atmosphere =
|
||||
std::make_shared<sim::USStandardAtmosphere>();
|
||||
|
||||
gravity =
|
||||
std::make_shared<sim::ConstantGravityModel>();
|
||||
}
|
||||
|
||||
int QtRocket::run(int argc, char* argv[])
|
||||
|
12
QtRocket.h
12
QtRocket.h
@ -6,6 +6,10 @@
|
||||
#include <atomic>
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "model/Rocket.h"
|
||||
|
||||
#include "sim/AtmosphericModel.h"
|
||||
#include "sim/GravityModel.h"
|
||||
|
||||
/**
|
||||
* @brief The QtRocket class is the master controller for the QtRocket application.
|
||||
@ -23,6 +27,9 @@ public:
|
||||
// If called multiple times, subsequent calls, will simply
|
||||
// immediately return with value 0
|
||||
int run(int argc, char* argv[]);
|
||||
|
||||
void runSim();
|
||||
|
||||
private:
|
||||
QtRocket();
|
||||
|
||||
@ -35,6 +42,11 @@ private:
|
||||
|
||||
utils::Logger* logger;
|
||||
|
||||
std::shared_ptr<Rocket> rocket;
|
||||
std::shared_ptr<sim::AtmosphericModel> atmosphere;
|
||||
std::shared_ptr<sim::GravityModel> gravity;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // QTROCKET_H
|
||||
|
5
qmake_qmake_qm_files.qrc
Normal file
5
qmake_qmake_qm_files.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="i18n">
|
||||
<file alias="qtrocket_en_US.qm">/home/travis/qtrocket/master/.qm/qtrocket_en_US.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -20,6 +20,7 @@ SOURCES += \
|
||||
model/Rocket.cpp \
|
||||
model/Thrustcurve.cpp \
|
||||
sim/AtmosphericModel.cpp \
|
||||
sim/ConstantGravityModel.cpp \
|
||||
sim/GravityModel.cpp \
|
||||
sim/Propagator.cpp \
|
||||
sim/SphericalGeoidModel.cpp \
|
||||
@ -46,6 +47,7 @@ HEADERS += \
|
||||
model/Rocket.h \
|
||||
model/Thrustcurve.h \
|
||||
sim/AtmosphericModel.h \
|
||||
sim/ConstantGravityModel.h \
|
||||
sim/DESolver.h \
|
||||
sim/GeoidModel.h \
|
||||
sim/GravityModel.h \
|
||||
|
10
sim/ConstantGravityModel.cpp
Normal file
10
sim/ConstantGravityModel.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "ConstantGravityModel.h"
|
||||
|
||||
namespace sim {
|
||||
|
||||
ConstantGravityModel::ConstantGravityModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // namespace sim
|
20
sim/ConstantGravityModel.h
Normal file
20
sim/ConstantGravityModel.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef SIM_CONSTANTGRAVITYMODEL_H
|
||||
#define SIM_CONSTANTGRAVITYMODEL_H
|
||||
|
||||
#include "GravityModel.h"
|
||||
|
||||
namespace sim {
|
||||
|
||||
class ConstantGravityModel : public GravityModel
|
||||
{
|
||||
public:
|
||||
ConstantGravityModel();
|
||||
|
||||
virtual ~ConstantGravityModel() {}
|
||||
|
||||
std::tuple<double, double, double> getAccel(double, double, double) override { return std::make_tuple(0.0, 0.0, 9.8); }
|
||||
};
|
||||
|
||||
} // namespace sim
|
||||
|
||||
#endif // SIM_CONSTANTGRAVITYMODEL_H
|
Loading…
x
Reference in New Issue
Block a user