Giter Club home page Giter Club logo

orbitx's Introduction

OrbitX

The Jupiter system, showing Io, Europa, Ganymede, and Callisto orbiting Jupiter

This project re-implements the central server and astronaut flight software for Dr. Magwood's 'Orbit' suite of software written for OCESS.

For a guide on if and how you should contribute, read CONTRIBUTING.md
For a guide on how to set up your text editor to edit code, read DEVELOPING.md
For a guide on how the actual OrbitX codebase is structured, read ARCHITECTURE.md

This project is maintained by

  • Patrick
  • Gavin McDowell

Furthermore, OCESS and UWaterloo CS494 members have contribued:

  • Ye Qin
  • Sean
  • Cesare Corazza
  • Jamie Tait
  • Jonah Hamer-Wilson
  • Calum Wheaton
  • Stefan DeYoung
  • Nicholas Fry
  • Blakely Haughton

First Time Contributors

If you're a first-time contributor to OrbitX, take a look at CONTRIBUTING.md, especially if you don't recognize the git clone command in the Project Setup section. The CONTRIBUTING.md has helpful tips for first-time contributors.

Project Setup

If you run into any issues during setup, feel free to email me, patrick.melanstone on gmail. For step-by-step explanations of these instructions, read CONTRIBUTING.md.

It's recommended you develop and run in a virtualenv. Setup is as follows:

First, fork your own copy of orbitx on GitHub (you'll need a GitHub account for this). See below for windows-specific changes. Then,

git clone https://github.com/your-github-username/orbitx
cd orbitx
python3 -m venv venv  # or however you can create a python3 virtualenv
source venv/bin/activate
python -m pip install --upgrade pip  # not required, but a good idea
./generate-protobufs.sh  # use ./generate-protobufs.ps1 on windows

And when you want to restart development, just do:

cd orbitx
source venv/bin/activate

Note: Development On Windows

If you get an error referencing "Microsoft Visual C++ Build Tools", especially when installing yappi, install the build tools (choose Windows 10 SDK and C++ x64/x86 build tools in the installer).

Building

This project is mostly python, which does not require you to build a new binary after making changes to .py files. However, making changes to the orbitx.proto file requires building your changes.

If you change orbitx.proto, you will have to run the following command from your topmost orbitx directory:

./generate-protobufs.sh  # on linux
./generate-protobufs.ps1  # on windows

Running

orbitx.py Is an executable python script. Run python orbitx.py --help for the CLI args, or just run python orbitx.py for a graphical launcher.

If you get errors, make sure you have the pip packages in requirements.txt installed. If the setup instructions completed without errors, this is as easy as running source bin/activate.

Project Structure

- orbitx   # Root project directory
 \- data   # This contains savefiles and binary data
 \- doc    # This contains various text files and documentation
 \- logs   # This contains logs generated during orbitx runtime
 \- orbitx # The most important directory! Contains basically all orbitx code
 \- orbitx.py  # The 'main' function of orbitx, this script can be executed
 \- test.py    # The orbitx test suite, run this to run all orbitx tests

Screens

The most recent iteration of the OrbitX GUI

The entire solar system, with circle segments showing the paths of planets

The Jupiter system, with sinusoidal paths of Jovian moons around Jupiter

The Jupiter system, showing Io, Europa, Ganymede, and Callisto orbiting Jupiter

A representation of the new habitat design

orbitx's People

Contributors

arcayik avatar goodday0404 avatar goombag avatar jonahhw avatar pmelanson avatar pugzilla88 avatar sh32kim avatar silverscience avatar spoopidy avatar stefandeyoung avatar xxxyyyqqq12345 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orbitx's Issues

approximately-pixel-perfect graphics

For use in landing (#34), we'll need to refine the graphics (#6) and make sure that when the underlying physics entities are touching, the graphics show no gap between two spheres.

Implement destructive collisions

If man-made objects collide too fast, what happens?

  • there should be some visual feedback that you've crashed
  • sound? optional
  • the compatibility layer would tell engineering that we've crashed
  • stop the simulation (and maybe re-centre on the crashed object)

Related to #37

Integrate physics engine

Commit a067f2 adds Ye Qin's standalone physics engine prototype. I'll try to get it integrated.

Acceptable performance

Using orbitx shouldn't be molasses-like.

Our GUI (vpython) should stay at about 20 or 30 fps consistently, even after long runtimes on spacesim's setup.

As well, we should be able to do max time acceleration and push updates several times a second.

N-body collision detection

Collision detection probably doesn't work when there are multiple objects. Guess I'll have to fix that.

Feature list

It seems spacesim members just want a list of features. This makes sense because there are lots of features in legacy orbit that are undocumented. For example, even when I was demoing the legacy flight software to CS493 team members, I accidentally pressed a button and like five more lines of text were displayed.

Hopefully the issues list on this repo will help make this feature list.

Fill in placeholder gui fields

The periapsis, apoapsis, horizontal speed, and vertical speeds in the GUI are just placeholder "100" values right now. Someone who knows physics n stuff should change the relevant functions in flight_gui.py (like _periapsis, _h_speed) so that they give correct information.

Graphics

For now, just a simple circle to represent a planet is good enough for the prototype.

  • circle representation of planets, when zoomed very in and very out
  • basic GUI (information like engine thrust)

These can be split into their own issues

Saving/loading of files

Given .json files, we should be able to load these files and deterministically get the same physical state. Likewise, we should be able to save and create these files.

Colour blind-compatible GUI

There are colour blind spacesimmers, which doesn't work well with legacy orbit when the only way of differentiating different planets is the colour of them.

When developing our GUI, we should read up on some colour-blindness accessibility guides. In January, there's a talk at StarCon there's a talk about just this topic! I'll be there and see what we can learn.

Feedback from spacesim demo

First off, the help text was well-appreciated (although the html table of the digits needs to be fixed, otherwise the table 'wobbles' when numbers change a lot)

  • spacesim members noted that the numbers in the text display have too many significant digits, although they also noted that they would sometimes need a bit more accuracy. But most of the time, lots of wildly-changing numbers is a readability issue. Maybe bigger numbers? We'll have to investigate what legacy orbit/KSP do.
  • spacesim members noted that there was a lot of whitespace. Once we fill in more text fields, we should check the general clutter and figure out how to sectionize the GUI text fields.
  • Spacesim members were confused that headings are taken relative to Solar west, instead of e.g. pitch above the reference object.
  • Heading can't get higher than 360 (well only for a frame or two) but it might be able to get very negative
  • Spacesim members at this specific demo expressed that they found legacy orbit's text readouts are familiar and should be preferred when designing the new GUI (although for example, the vectors display in legacy orbit's sidebar aren't used, instead people just zoom in to see where the habitat is pointing. So not all text fields are mandatory)
  • A possible solution to an confusingly-rotated viewpoint could be a "revert to default top-down view"
  • Spacesim members (and also honestly sometimes us) were confused that player input sets the warp to 1x. We should either make it obvious that it does this, or remove this behaviour. I think a feature toggle is too much, we should have it or we should not have it.
  • The test pilot kept on changing time warp, and requested a keyboard shortcut to change timewarp
  • specific text fields that were requested were Vcen, Vtan, Apoapsis, and Periapsis
  • it was noted that the current landing graphic does not make it obvious that you're moving tangentially to the surface of the earth
  • also it's confusing that a landing graphic has the same texture as the planet
  • orbit projects were requested, but we know this is something we need to do
  • It was requested that engines be in the range of [-100%, 100%]
  • it was pointed out that trails are not important
  • we should check that ref Vo changes with altitude
  • for AYSE, try to represent the painting in MC, although we should also make it obvious from the top-down view where you can dock with AYSE
  • the test pilot pointed out that labels are covered up by planets. We shouldn't put essential information in these labels

Solar system fully implemented

See OCESS.json

All planets in the solar system should be able to be loaded at once. For feature parity with legacy orbit, we should be able to simulate at 60x time acceleration for at least one orbit of Mercury and all subsystems of the solar system should be stable (especially Mars-Phobos, Mars-Deimos, Jovian moons, and habitat-Earth if we implement that).

Also, everything should orbit in the same way the solar system orbits.

Testing framework

We should be able to test our code easily and with one command. Our test code doesn't need to test the GUI, but it should test the most important testable for the prototype demo: the physics engine.

For each important aspect of the physics engine, there should be a corresponding test case.

Beginner-friendly UI

Legacy orbit is notoriously hard to learn. Perhaps a bit more intuitiveness in the new UI will go a long way. Something to keep in mind when developing the GUI. See #6 for any other GUI things.

A working, polished demo

Tracking issue for any work done just for improving the demo.

The demo should:

  • recover from recoverable errors
  • noisily fail from unrecoverable errors
  • show off all features
  • be easy to run

Physics engine refinement

This is an ongoing issue, related to #8 for the stability of the solar system, and keeping the goals of #4 and #16 in mind.

I'm not sure how stable legacy orbit is, although I'm pretty sure that the orbit of at least the ISS and maybe Phobos needs to be corrected after large timewarps.

However, for every physics feature we add, we have to make sure that it does not impact:

  • being able to simulate at 100,000x time acceleration
  • being able to gravitate
  • being able to detect collisions properly (i.e. moons in a stable orbit should not collide)

Self-destruct button

This is maybe not a serious request, but technically it's part of the legacy orbit.

Optional.

UML and architecture

We should have a high-level idea of how to architect this project, and make sure all three of us have this plan in our heads.

3D space!

lol we already got this. Way to go Sean.

NAV modes

These can also be thought of autopilot modes. Examples are

  • prograde in orbit
  • retrograde in orbit
  • away from target
  • towards target

etc

A clean codebase

An ongoing issue. When developing, we should make sure our code adheres to PEP8 style guide, Has public APIs and any important internal helpers well-documented, and our code is generally readable.

Launch tower

If we ever do rough terrain on planets, this might be relevant.
In legacy orbit, there is a rectangular-ish launch tower. It's definitely optional to implement that in our new physics engine, but technically that's part of feature parity.

fix those trails yo

Oops we broke trails. Trails are now drawn relative to the camera centre instead of the reference, which is bad because we are usually controlling the habitat while it's the camera centre, and we want to see how its moved.

Trails should:

show how the habitat moves relative to the reference object (usually Earth) even when the habitat is the centre.

Non-elastic non-spherical stable collisions

Related to #34

  • bouncy collisions: when natural objects go too fast, they bounce
  • not-bouncy collisions: when two objects go slowly, they stick to each other
  • destructive collisions: when man-made objects go too fast, they explode (consider: if the habitat is going too fast, display a warning? TODO in the future)

Habitat implemented

The habitat is a special entity. Will need some special extra fields, like engine thrust and remaining fuel. These could be added to the proto definition as optional fields, and whatever internal representation is most convenient is also good.

Feedback from mentor meeting

  • technical ideas (physics not on main thread, 'framerate' is what will get an impressive demo)
  • they're going to be doing a code review, so make sure code is readable!! Thanks Sean for adding docstrings to functions
  • we should be able to show our process (feature ideation -> actual code)
  • the three Ps: Product, Process, Presentation
  • start associating commits with issues, making sure that our meeting notes reference features
  • for the presentation: we should convince viewers that our project was a good project (show features, don't tell), make sure that our demo is stable

GUI info readouts

To complete #6, we need a sidebar that has information on the habitat (e.g. the centripetal velocity and tangential velocity of the habitat). Hopefully most of the same info as legacy orbit, but we'll do the simpler ones for the demo.

LastEndRate issue


AttributeError Traceback (most recent call last)
~/projects/orbitx/flight.py in
250 warnings.filterwarnings('once', category=DeprecationWarning)
251 warnings.filterwarnings('once', category=ResourceWarning)
--> 252 main()

~/projects/orbitx/flight.py in main()
231 try:
232 if args.data_location.scheme == 'file':
--> 233 lead_server_loop(args)
234 else:
235 assert args.data_location.scheme == 'mirror'

~/projects/orbitx/flight.py in lead_server_loop(args)
184 if not args.no_gui:
185 gui.draw(state)
--> 186 gui.rate(common.FRAMERATE)
187 else:
188 time.sleep(common.TICK_TIME)

~/projects/orbitx/orbitx/flight_gui.py in rate(self, framerate)
265
266 def rate(self, framerate):
--> 267 self._vpython.rate(framerate)

~/projects/orbitx/venv/lib/python3.6/site-packages/vpython/vpython.py in call(self, N)
214 self.rval = N
215 if self.rval < 1: raise ValueError("rate value must be greater than or equal to 1")
--> 216 super(_RateKeeper2, self).call(self.rval) ## calls call in rate_control.py
217
218 if sys.version > '3':

~/projects/orbitx/venv/lib/python3.6/site-packages/vpython/rate_control.py in call(self, maxRate)
171 return
172
--> 173 dt = calledTime - self.lastEndRate # time spent in user code
174 nr = self.whenToRender[self.renderIndex]
175 if self.count == 2 or (self.count == self.lastCount + self.rateCalls):

AttributeError: '_RateKeeper2' object has no attribute 'lastEndRate'

Switching to high warp values freezes the program

As in title, this is not a good UX. Switching to a lower warp value does not fix the problem.

We should either stop high warp values from freezing (optimizing at high warp values) or allow users to recover, ideally both.

Compatibility layer with legacy orbit

Before we implement engineering and eecom etc., we should have OrbitX be able to communicate to legacy programs, so that we can act as a drop-in replacement.

Clean up trails

for #6.

Currently, trails are long, left by not just planets but also moons (which is a confusing sinusoidal wave), and have no way to disappear or be cleared.

either have a max length for trails, or clear them completely

Atmospheric drag physics model

Legacy orbit simulates atmospheric drag around certain planets (Earth, Sun, gas giants, etc). We should simulate this somehow.

Implement AYSE

For AYSE to be implemented, we'll need:

  • it needs to be dockable (mechanism for gluing habitat and AYSE together?)
  • it should be able to communicate to legacy ENGINEERING when AYSE is docked and whatever
  • legacy ENGINEERING will tell us when the docking arm is engaged
  • if AYSE crashes, it might explode or something (see issue #40)
  • when the habitat and AYSE are docked, they should be merged (which means this is blocked on #34)
  • sound effects? wow, optional for sure. We'll do that in April if at all. We might not do that.
  • AYSE should be able to provide thrust and use fuel. This happens when we are docked with AYSE, and we start to control AYSE. That is its whole own can of worms. AYSE and the habitat should move together when this happens.

Features needed in the GUI:

  • model for AYSE (simpler is better, maybe a custom texture? physics-wise we'll not be able to model the habitat entering AYSE, and something as simple as a cone is fine)
  • once AYSE docking is implemented, some mechanism for docking/undocking (a GUI button? keyboard shortcut?)

List of inputs that we should have in the GUI

  • engines provide thrust
  • different graphics for spacecraft?
  • user able to rotate spacecraft
  • user able to adjust engine thrust
  • able to change time acceleration during runtime
  • able to change center, target, ref, NAVmode (and have an effect in the physics engine)

Stable landing

Legacy orbit allows you to land on a planet, and stick there. We should implement something like this, specifically:

  • In the GUI, it should look like you're on the surface of a planet when you're landed on it
  • When you're landed, you shouldn't bounce or jitter

(vpython issue) compound objects crash vpython

We got the following error when making a list of triangles, then making a compound object of them:

Exception ignored in: <function standardAttributes.__del__ at 0x00000279BFAD1730>
Traceback (most recent call last):
  File "C:\Users\Patrick\orbit\orbitx\venv\lib\site-packages\vpython\vpython.py", line 1135, in __del__
    super(standardAttributes, self).__del__()
  File "C:\Users\Patrick\orbit\orbitx\venv\lib\site-packages\vpython\vpython.py", line 354, in __del__
    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'compound' object has no attribute 'idx'

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.