parent
1725e238ae
commit
9da872d928
@ -0,0 +1,9 @@
|
||||
[submodule "third_party/QxOrm"]
|
||||
path = third_party/QxOrm
|
||||
url = https://github.com/QxOrm/QxOrm.git
|
||||
[submodule "third_party/librdkafka"]
|
||||
path = third_party/librdkafka
|
||||
url = https://github.com/confluentinc/librdkafka.git
|
||||
[submodule "third_party/boost"]
|
||||
path = third_party/boost
|
||||
url = https://github.com/boostorg/boost.git
|
@ -0,0 +1,49 @@
|
||||
//
|
||||
//#include "three.h"
|
||||
//
|
||||
//vector<State> Tree::run(const State &init_state, double start, double end, double t) {
|
||||
//// integrate_const(runge_kutta4<State>(), dmove2, init_state, start ,end ,t, write_pendulum);
|
||||
// return _stateList;
|
||||
//}
|
||||
//
|
||||
//void Tree::dmove2(const State &x_input, State &dxdt, const double t) {
|
||||
// double velocity = x_input[0];
|
||||
// double gamma = x_input[1];
|
||||
// double varphi = x_input[2];
|
||||
// double nx = _control[0];
|
||||
// double nz = _control[1];
|
||||
// varphi = _control[2];
|
||||
//// if(varphi == 0){
|
||||
//// varphi = control[2];
|
||||
//// }
|
||||
// double g = 9.81; // 重力加速度
|
||||
// double velocity_ = g * (nx - sin(gamma)); // 米每秒
|
||||
// double gamma_ = (g / velocity) * (nz * cos(varphi) - cos(gamma)); // 米每秒
|
||||
// double varphi_ = g * nz * sin(varphi) / (velocity * cos(gamma));
|
||||
// dxdt[0] = velocity_;
|
||||
// dxdt[1] = gamma_;
|
||||
// dxdt[2] = varphi_;
|
||||
//}
|
||||
//
|
||||
//void Tree::setController(const State &control) {
|
||||
// _k = 1;
|
||||
// _control = control;
|
||||
//}
|
||||
//
|
||||
//void Tree::write_pendulum(const State &x, const double t) {
|
||||
// double velocity = x[0];
|
||||
// double gamma = x[1];
|
||||
// double varphi = x[2];
|
||||
// double dx = velocity * cos(gamma) * sin(varphi);
|
||||
// double dy = velocity * cos(gamma) * cos(varphi);
|
||||
// double dz = velocity * sin(gamma);
|
||||
// State new_state(6);
|
||||
// new_state[0] = _stateList[_k - 1][0] + dx;
|
||||
// new_state[1] = _stateList[_k - 1][1] + dy;
|
||||
// new_state[2] = _stateList[_k - 1][2] + dz;
|
||||
// new_state[3] = velocity;
|
||||
// new_state[4] = gamma;
|
||||
// new_state[5] = varphi;
|
||||
// _k++;
|
||||
// _stateList.push_back(new_state);
|
||||
//}
|
@ -0,0 +1,127 @@
|
||||
//
|
||||
//#ifndef CSCI_THREE_H
|
||||
//#define CSCI_THREE_H
|
||||
//
|
||||
///*
|
||||
//typedef vector<double> State;
|
||||
//typedef vector<double> Control;
|
||||
//double Nx = 3.0;
|
||||
//double Nz = 2.0;
|
||||
//double mu = M_PI / 12.;
|
||||
//Control control = { Nx, Nz, mu };
|
||||
//vector<State> state_list;
|
||||
//// 飞行器的运动学方程
|
||||
//void dmove2(const State& x_input, State& dxdt, const double t) {
|
||||
// double velocity = x_input[0];
|
||||
// double gamma = x_input[1];
|
||||
// double varphi = x_input[2];
|
||||
// double nx = control[0];
|
||||
// double nz = control[1];
|
||||
// varphi = control[2];
|
||||
//// if(varphi == 0){
|
||||
//// varphi = control[2];
|
||||
//// }
|
||||
// double g = 9.81; // 重力加速度
|
||||
// double velocity_ = g * (nx - sin(gamma)); // 米每秒
|
||||
// double gamma_ = (g / velocity) * (nz * cos(varphi) - cos(gamma)); // 米每秒
|
||||
// double varphi_ = g * nz * sin(varphi) / (velocity * cos(gamma));
|
||||
// dxdt[0] = velocity_;
|
||||
// dxdt[1] = gamma_;
|
||||
// dxdt[2] = varphi_;
|
||||
//}
|
||||
//int k = 1;
|
||||
//void write_pendulum(const State &x, const double t)
|
||||
//{
|
||||
// double velocity = x[0];
|
||||
// double gamma = x[1];
|
||||
// double varphi = x[2];
|
||||
// double dx = velocity * cos(gamma) * sin(varphi);
|
||||
// double dy = velocity * cos(gamma) * cos(varphi);
|
||||
// double dz = velocity * sin(gamma);
|
||||
// State new_state(6);
|
||||
// new_state[0] = state_list[k - 1][0] + dx;
|
||||
// new_state[1] = state_list[k - 1][1] + dy;
|
||||
// new_state[2] = state_list[k - 1][2] + dz;
|
||||
// new_state[3] = velocity;
|
||||
// new_state[4] = gamma;
|
||||
// new_state[5] = varphi;
|
||||
// k++;
|
||||
// state_list.push_back(new_state);
|
||||
//}
|
||||
//
|
||||
//void boost_test(){
|
||||
// double init_velocity = 260.0;
|
||||
// double init_gamma = M_PI / 10.0;
|
||||
// double init_varphi = 0.0;
|
||||
// double init_x = 0.0;
|
||||
// double init_y = 0.0;
|
||||
// double init_z = 1000.0;
|
||||
// State int_state(6);
|
||||
// int_state[0] = init_x;
|
||||
// int_state[1] = init_y;
|
||||
// int_state[2] = init_z;
|
||||
// int_state[3] = init_velocity;
|
||||
// int_state[4] = init_gamma;
|
||||
// int_state[5] = init_varphi;
|
||||
// state_list.push_back(int_state);
|
||||
// State init_state = { init_velocity, init_gamma, init_varphi };
|
||||
// integrate_const(runge_kutta4<State>(), dmove2, init_state, 0.0 ,10.0 ,0.1, write_pendulum);
|
||||
// string filename = R"(test.csv)";
|
||||
// ofstream ofs(filename);
|
||||
// if(ofs.is_open()){
|
||||
// ofs << "x,y,z,v,g,f\n";
|
||||
// for (const auto& state : state_list) {
|
||||
// int i = 0;
|
||||
// for (const auto& val : state) {
|
||||
// cout << val << ",";
|
||||
// if(i == 5){
|
||||
// ofs << val;
|
||||
// i = 0;
|
||||
// }else{
|
||||
// ofs << val << ",";
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// cout << "\n";
|
||||
// ofs << "\n";
|
||||
// }
|
||||
// ofs.close();
|
||||
// }
|
||||
//}
|
||||
//
|
||||
// */
|
||||
//
|
||||
//#include <boost/numeric/odeint.hpp>
|
||||
//
|
||||
//using namespace std;
|
||||
//using namespace boost::numeric::odeint;
|
||||
//
|
||||
//typedef vector<double> State;
|
||||
//typedef vector<double> Control;
|
||||
//
|
||||
//class Tree {
|
||||
//
|
||||
//private:
|
||||
// static int _k;
|
||||
//
|
||||
// static Control _control;
|
||||
//
|
||||
// static vector<State> _stateList;
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// static void dmove2(const State& x_input, State& dxdt, const double t);
|
||||
//
|
||||
// static void write_pendulum(const State &x, const double t);
|
||||
//
|
||||
//public:
|
||||
//
|
||||
// static void setController(const State &control);
|
||||
//
|
||||
// static vector<State> run(const State& init_state, double start, double end, double dt);
|
||||
//
|
||||
//
|
||||
//};
|
||||
//
|
||||
//
|
||||
//#endif //CSCI_THREE_H
|
Loading…
Reference in new issue