GithubHelp home page GithubHelp logo

Comments (6)

tmori avatar tmori commented on September 24, 2024

前提

以下の2つの関数をそのまま利用する。

  • drone_physics::acceleration_in_body_frame()
  • drone_physics::angular_acceleration_in_body_frame()

from hakoniwa-px4sim.

tmori avatar tmori commented on September 24, 2024

コード設計

上記どちらの関数も3次元のベクトルなので、3次元ベクトル変換関数(f_vec)と思うことにする。

変数定義

  • c_vec:現在の状態
  • k1_vec:k2を求めるための状態
  • k2_vec:k3を求めるための状態
  • k3_vec:k4を求めるための状態
  • delta_time:シミュレーション時間精度
  • n_vec:次の時間の状態

from hakoniwa-px4sim.

tmori avatar tmori commented on September 24, 2024

k1

k1 = f_vec(c_vec);

k2

k2_vec = {c_vec.x + 0.5 * k1.x * delta_time, c_vec.y + 0.5 * k1.y * delta_time, c_vec.z + 0.5 * k1.z * delta_time};
k2 = f_vec(k2_vec);

k3

k3_vec = {c_vec.x + 0.5 * k2.x * delta_time, c_vec.y + 0.5 * k2.y * delta_time, c_vec.z + 0.5 * k2.z * delta_time};
k3 = f_vec(k3_vec);

k4

k4_vec = {c_vec.x + k3.x * delta_time, c_vec.y + k3.y * delta_time, c_vec.z + k3.z * delta_time};
k4 = f_vec(k4_vec);

from hakoniwa-px4sim.

tmori avatar tmori commented on September 24, 2024

次の状態

n_vec = {
c_vec.x + (delta_time / 6.0) * (k1.x + 2 * k2.x + 2 * k3.x + k4.x),
c_vec.y + (delta_time / 6.0) * (k1.y + 2 * k2.y + 2 * k3.y + k4.y),
c_vec.z + (delta_time / 6.0) * (k1.z + 2 * k2.z + 2 * k3.z + k4.z)
};

from hakoniwa-px4sim.

tmori avatar tmori commented on September 24, 2024

というわけで修正してみます。

from hakoniwa-px4sim.

tmori avatar tmori commented on September 24, 2024

めちゃくちゃ冗長だけど、やってみた。

1e8b264

from hakoniwa-px4sim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.