Giter Club home page Giter Club logo

are-we-flying's People

Contributors

pomax avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

are-we-flying's Issues

Create a list of planes that are known to work.

Excluding "point and fly" (e.g. jet fighters) and jet liners. The former because even if takeoff works, the AP won't, and the latter because turning off their inbuilt AP is a job in and of itself. There's also a few planes that just refuse to throttle (see #14) so those obviously won't work.

Add some vtrim dampening at speed

Playing a recording back at 4x or higher shows that we're basically overtrimming at cruise speed, oscillating more than we need to.

improve elevator-based trimming

elevator-based "trim" can't autoland as well (or at all) as real trim, suggesting we can probably refine the numbers to get it to perform at least better than it does now.

extend ATT

add a speed input for ATT so we can set a specific speed we want to maintain

Error when Running API Server with MSFS: Illegal Offset RangeError

Hi. I have problem running the code. Below is the API server log when i run it while MSFS is up:

No ALOS data folder specified, elevation service will not be available.
Server listening on http://localhost:8080
Connected to MSFS
Registering API server to PAUSE, UNPAUSED, CRASH, and SIM events.
new flight started, resetting autopilot
Server to server socket established
sending MSFS event
sending MSFS event
adding event listener for SIM
registering event listener with the simconnect wrapper
adding event listener for PAUSED
registering event listener with the simconnect wrapper
adding event listener for UNPAUSED
registering event listener with the simconnect wrapper
adding event listener for VIEW
registering event listener with the simconnect wrapper
RecvException { exception: 7, sendId: 21, index: 2 }
RecvException { exception: 7, sendId: 22, index: 2 }
RecvException { exception: 7, sendId: 26, index: 2 }
D:\Programming\Javascript\are-we-flying\node_modules\bytebuffer\dist\bytebuffer-node.js:1403
                throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.length);
                ^

RangeError: Illegal offset: 0 <= 616 (+8) <= 620
    at module.exports.ByteBufferPrototype.readFloat64 (D:\Programming\Javascript\are-we-flying\node_modules\bytebuffer\dist\bytebuffer-node.js:1403:23)
    at RawBuffer.readFloat64 (D:\Programming\Javascript\are-we-flying\node_modules\node-simconnect\dist\RawBuffer.js:75:28)
    at Object.read (file:///D:/Programming/Javascript/are-we-flying/node_modules/msfs-simconnect-api-wrapper/simvars/simvar-utils.js:8:44)
    at file:///D:/Programming/Javascript/are-we-flying/node_modules/msfs-simconnect-api-wrapper/msfs-api.js:257:52
    at Array.forEach (<anonymous>)
    at SimConnectConnection.handleDataRequest (file:///D:/Programming/Javascript/are-we-flying/node_modules/msfs-simconnect-api-wrapper/msfs-api.js:256:21)
    at SimConnectConnection.emit (node:events:524:35)
    at SimConnectConnection.emit (D:\Programming\Javascript\are-we-flying\node_modules\node-simconnect\dist\SimConnectConnection.js:89:22)
    at SimConnectConnection._handleMessage (D:\Programming\Javascript\are-we-flying\node_modules\node-simconnect\dist\SimConnectConnection.js:1042:22)
    at SimConnectSocket.emit (node:events:512:28)

Node.js v19.5.0

And the web server log:

Server listening on http://localhost:3000
no API server (yet), retrying in 5 seconds
Client socket established.
API Server socket established
going back into wait mode
no API server (yet), retrying in 5 seconds

I don't get this error when I run API server before MSFS. But in that case nothing works. (when i click on take-off nothing happens and I can't put waypoints on map).

Node version: 19.5.0
.env file:

export DATA_FOLDER=
export ALOS_PORT=9000
export WEB_PORT=3000
export API_PORT=8080
export FLIGHT_OWNER_KEY=FOK-12345

Is there anything that I'm missing?

determine the best approach path based on where the plane/last waypoint is

// quarter turn
double Q4 = PI/2;

// some random airport orientation
double randomAngle = random(0, TAU);

// distance from approach point to offset point
double R = 50;

// distance from offset point to secondary offset
// (to force the plane to fly towards the offset)
double R2 = R + 10;

Point end, start, M = new Point(0,0), anchor, o1, o2;

void determineCriticalPoints(int x, int y) {
  Point cursor = new Point(x, y);

  double ca = cos(randomAngle);
  double sa = sin(randomAngle);

  // even though M is (0,0), it won't be in the game.
  double mx = M.x;
  double my = M.y;

  start = new Point(mx - 150 * ca, my - 150 * sa);
  end = new Point(mx - 200 * ca, my - 200 * sa);
  anchor = new Point(mx + 150 * ca, my + 150 * sa);
  o1 = null;
  o2 = null;

  double ax = anchor.x;
  double ay = anchor.y;

  double v1 = M.x - ax;
  double v2 = M.y - ay;

  double w1 = cursor.x - ax;
  double w2 = cursor.y - ay;

  double r = randomAngle;
  double a = atan2(w2*v1 - w1*v2, w1*v1 + w2*v2);

  Point p = cursor.project(M, anchor);
  double d = dist(p, cursor);

  if (a > Q4 || a < -Q4) {
    o1 = new Point(ax + R * cos(r), ay + R * sin(r));
  } else {
    if (a > 0) {
      r -= Q4;
      double cr = cos(r);
      double sr = sin(r);
      o1 = new Point(ax + R * cr, ay + R * sr);
      if (d < 50) o2 = new Point(ax + R2 * cr, ay + R2 * sr);
    } else {
      r += Q4;
      double cr = cos(r);
      double sr = sin(r);
      o1 = new Point(ax + R * cr, ay + R * sr);
      if (d < 50) o2 = new Point(ax + R2 * cr, ay + R2 * sr);
    }
  }
}

track autoflight time

somewhere on the webpage, and in the server code, we should have a timer running that tells us how long we've been flying, as well as how long each leg took (and how long we therefore expect the rest of the flight to still take)

run ALOS as XYZ tile server

It has all the elevation information already anyway, should be able to make this an XYZ tile source for Leaflet to tap into.

  • add xyz tile route to server
  • convert xyz coordinates to GPS corner coordinates
  • turn GPS corner coordinates into an n-tileset that covers the area between them
    • make sure to do this with a small, scale-appropriate padding so that we don't end up with tiling seams
  • convert n-tileset to single pixel array
  • false-color the elevation data as map
    • water color
    • terrain color
    • iso lines (depending on scale?)
    • hill shading
  • crop pixel array to only the requested GPS coordinates
  • write pixel array into 8 bit PNG (without alpha or GeoJSON)
    • possibly use a palette (color:3) rather than RGB (color:6)?
  • [ ]

Optimizations:

  • cache xyz tiles to disk
  • preempt scrolls and zooms by generating the full xyz set around requested GPS coordinates
  • [ ]

color ALT, ATT, TER, HDG inputs to show whether they're controlled or not

auto-takeoff, waypoint flight, and autolanding can all control and override the altitude, throttle, and heading, and it would be nice to show that to the user by coloring the number inputs somehow.

  • no color: not being use
  • green: this value
  • blue: this value but it's controlled automatically?

allow dual-plotting to one graph

specifically, plot ground altitude to its own graph, as well as being a dual input for the plane altitude graph, where the plane's plot is green, and the ground (unfilled) plot is the same color as plot limits.

Add ETA times to waypoints

We know our speed, we should be able to work out ETA for unflown waypoints and show that (so you can go make a coffee and maybe mow the lawn while your plane flies on its own for a few hours)

change takeoff procedure to trim-only?

We're currently performing an elevator takeoff, but we could also just use the elevator trim instead, using a small positive VS target, so that we wouldn't need to progressive ease back on the elevator and then guess a magic trim value at the time of AP handoff.

This would probably both simplify the code and smooth out the takeoff/AP transition.

save a landing to a flight path

But then also record "which plane" that was for, because a landing that works for a Beaver won't work for a DC-3, for instance?

Maybe only save which airport the landing was for, so that the code can recalculate an approach.

add mouse-hover to graphs

hover mouse, highlight data vertical, update "current value" label with that vertical's value instead.

Improved ALT HOLD

We "bounce" way too much, so we may need some kind of PID controller anyway.

api crashses on non-existent vars

I thought I fixed this, but the API server crashes on unknown vars, which it should never do.

  • get should not show an api wrapper stack trace?
  • set should silently ignore bad var exceptions

Update auto-rudder

It should be taking "is our drifting across the runway increasing, despite active rudder? If so, increase drift correction" into account.

add stick-based level flight fallback

Some planes refuse to aileron-trim. It might be nice to have code in place that detects "this is doing nothing" and switches to using the stick/yoke instead.

update flight path intercept code

Stagger points along the flight path, past a transition, and (lerp-)target those (moving to next point(s) as we pass them), so that we get (back) on the flight path earlier.

show nearby airports on the map

Simple circle with runway lines

  • click airport -> "land here?"
  • if yes, add autolanding points to the current flight path

if already scheduled to land somewhere else, remove old landing points first.

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.