Giter Club home page Giter Club logo

orbiter-rs's Introduction

orbiter-rs โ€” Rust Bindings for the Orbiter SDK

Crates.io MIT licensed Docs.rs

This library was created to develop addons for the Orbiter spaceflight simulator in Rust. It uses the cxx crate for creating Rust bindings for the Orbiter SDK. A fairly complicated addon complete with a landing guidance system built using these bindings can be found at: https://github.com/thomasantony/surveyor

Implementation

The crate can now be imported and used like a library. A demo implementation can be found in examples/Surveyor/surveyor.rs. An addon module must include a struct implementing the OrbiterVessel trait. Then it must use the init_vessel! macro to generate the code that links it to Orbiter SDK. For example:

init_vessel!(
    fn init(vessel) {
        Surveyor::new(vessel)
    }
    fn exit() {}
);

Lifecycle of an Orbiter Rust Addon

TODO

Building

  1. Download/Install Orbiter
  2. Install Visual Studio 2019
  3. Install Rust using rustup (https://rustup.rs)
  4. Install the win32 target by running rustup target add i686-pc-windows-msvc

This addon has been tested with Rust 1.57.0 and Visual Studio 2019 Commuity Edition on Windows 10. Running cargo build should build the project generate a DLL file.

Installing and Testing the Addon

Once you build the addon, you should have a file called Surveyor.dll in target/i686-pc-windows-msvc/debug/examples/. Copy this file to the Modules folder in your Orbiter installation. Also copy over the files in the Config, Meshes and Scenarios folders into the corresponding folders in your Orbiter installation. Launch the SurveyorInOrbit scenario in Orbiter and make sure that the spacecraft shows up. Pressing "L" should activate the retro thruster firing sequence.

Future

Only a limited number of Orbiter functions are now available to Rust bindings. This list will expand in the future to hopefully include all of Orbiter SDK. Pull requests are welcome!

Meshes

The meshes in the demo addon were adapted from the Surveyor 1.0 Orbiter Addon. These were updated based on the tutorial at https://www.orbiterwiki.org/wiki/Vessel_Tutorial_1.

MFDs

An older proof-of-concept for building MFDs can be found at https://github.com/thomasantony/RustMFD. However, this uses an outdated and modified version of cxx and may not build at this time and exists just as a reference. The code in that repo will be moved over to this one at some point in the future.

Notes

  • Uses .cargo/config to force i686 as target

orbiter-rs's People

Contributors

thomasantony avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

riojax

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.