idsc-frazzoli / dg-commons

Driving games common tools
GNU General Public License v3.0
24 stars 6 forks source link

added dynamics and visualization to spaceship #132

Closed zipping-suger closed 4 weeks ago

zipping-suger commented 1 month ago

Added dynamic model for the spaceship with a single thruster at the back that can rotate within defined limits. The new dynamics are defined by the following equations:

dx = vx dy = vy dm = -C_T thrust dvx = (1 / m) cos(delta + psi) thrust dvy = (1 / m) sin(delta + psi) thrust dvpsi = -(1 / Iz) lr sin(delta) thrust ddelta = ddelta

Where:

Added a visualization for spaceship, which is similar to the rocket model.

The dynamic model and visualization can be tested by running test_spaceship.py

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 86.56250% with 43 lines in your changes missing coverage. Please review.

Project coverage is 78.37%. Comparing base (3357f74) to head (69eeab6). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/dg_commons/sim/models/spaceship.py 78.88% 35 Missing and 3 partials :warning:
src/dg_commons/sim/models/spaceship_structures.py 96.80% 3 Missing :warning:
src/dg_commons/sim/simulator_visualisation.py 92.30% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #132 +/- ## ========================================== + Coverage 77.82% 78.37% +0.55% ========================================== Files 70 72 +2 Lines 4640 4943 +303 Branches 322 331 +9 ========================================== + Hits 3611 3874 +263 - Misses 952 989 +37 - Partials 77 80 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

alezana commented 1 month ago

@zipping-suger could we make it with the velocities in body frame? It should be costh = cos(x0.psi) sinth = sin(x0.psi) dx = vx costh - vy sinth dy = 0 ???? dm = -C_T thrust dvx = (1 / m) cos(delta) thrust dvy = dvpsi = -(1 / Iz) lr sin(delta) thrust ddelta = ddelta

could you please double check "dy".... not 100% sure

I already push a commit containing this minor things, please double check

zipping-suger commented 1 month ago

Dynamics:

Where:

zipping-suger commented 1 month ago

spaceship