Jump to content

[Multiplattform] Primary Flight Display - an alternative Interface for Telemachus


rob3110

Recommended Posts

Hello Everyone,

I would like to present to you a small project I've been working on.

Primary Flight Display

gZmXOz7l.png

My Primary Flight Display for Telemachus. It is a html5-Page that should be usable on everything with a modern webbrowser.

Download:

http://d-h.st/BFe

Some explanation: You need to have the Telemachus Plugin installed!

http://forum.kerbalspaceprogram.com/threads/24594-0-24-2-%282014-9-14%29-Telemachus-%E2%80%93-Telemetry-and-Flight-Control-in-the-Web-Browser

It consists of several subscreens. On first launch it will try to connect to localhost-IP and standard Telemachus port (127.0.0.1:8085), which only works when KSP is running on the same machine. When the connection fails, the settings menu will open:

z1dXyySl.png

Here you can change the IP&Port, the connection rate in milliseconds, and the color scheme. Simply click on the button with the name/value in it. Colors require valid rgb input, something like 255,255,255 (r,g,B). When the input was in a wrong format all colors will be reset to default to prevent the page from braking. Use MS Paint or whatever to get the numbers for your colors. I'm sorry, but I couldn't find a nice way to implement a color-picker. Next to each color button is another button to change back to default color.

Close the settings by clicking the small X-Button on the top right of the settings overlay. You can always access the settings menu by clicking the "CON"-Button on the top left of the Display.

You can change the subscreen by clicking titles with a [+] on the right sidebar and revert to the previous display by clicking the title with [-]

subscreens are:

mixed display

gZmXOz7l.png

attitude control

Hsn2BJEl.png

information

nsAqmV1l.png

orbit display

IUmbPHml.png

and status display

vQsaMrjl.png

attitude control requires Mechjeb 2 installed on KSP. If you don't have Mechjeb, the PFD will still work but all buttons to change the attitude wont do anything. But you can still toggle lights, gear, etc and action groups.

Known issues so far:

if the site can't read any values, you have to allow incoming connections for ksp.exe or ksp_x64.exe on port 8085 on your firewall. It is necessary so that the site can subscribe the the data via Telemachus Websocket.

it is my first html5/javascript project, so there will be bugs. I'm pretty sure my code is not optimized and should not be used as an example on how to make a proper website. I just wanted it to work. The site might be a bit slow on older computers, adjust the connection rate if it seems to be to heavy, because it uses quite a lot of variables and has to draw many things.

Connection Rates lower than 100 or 150ms can result in strange camera shaking in KSP. It is a bug of Telemachus.

the prograde and retrograde markers might be off under circumstances I haven't encountered so far. I use the change in longitude and latitude to calculate the heading and the horizontal and vertical speed to calculate pitch. I haven't found a way to calculate it based on the orbital parameters, which would be better. If anyone can help me I would appreciate it!

I also haven't found a way to calculate target position, so right now I can't show target markers. That would require even more fancy orbital calculations.

Getting the current usage of resources, like liquid fuel and so on seems to be broken as well in Telemachus. So I calculate it on my own. When the game is paused, you don't get usefull readings, same with pro and retrograde markers. Currently it only works when the game is running.

the orbit display might show the wrong orbit, if the orbit is hyperbolic (escape orbit), I'll try to fix it as soon as possible. Elliptic orbits are fine though.

All those are only minor issues (I think), I'll try to fix them when I find a way to do so.

I took my inspiration from the awesome Simian UI Montage from the designer Kristoffer Brady. Check it out:

http://bytheodore.com/projects/simian-ui

I welcome comments, suggestions, bugreports and hints how to optimize my code.

I put the source code up on pastebin (since it is only one html file). You can find it here:

http://pastebin.com/QtmiHBXa

License

88x31.png Creative Commons Attribution-NonCommercial-ShareAlike

Edited by rob3110
added source code (pastebin)
Link to comment
Share on other sites

Oh my gosh! This is legitimatley the best mod I have seen in months and will start using ASAP. One thing that would make it complete, can you please set up github or some kinda VC system, as I would love to help squash those last bugs.

Again, thanks so much!! This made my day :kiss:

Link to comment
Share on other sites

Thanks a lot! I'll soon put it onto curse and the source to github.

One of the next features I'm thinking about is a docking mode, similar to NavyFish's Docking Port Alignment Indicator (http://forum.kerbalspaceprogram.com/threads/43901-0-23-5-Docking-Port-Alignment-Indicator-(Version-4-0-Updated-06-29-14)). I'll have to see if I can get all the data I need from Telemachus...

Link to comment
Share on other sites

I am having a weird issue with using this with telemachus and firefox.

Me and a few friends use telemachus for multiperson controlled flights, the biggest problems I have is over the course of maybe a minute or two this ui causes my firefox to gradually get slower and slower to the point where it will NOT accept ANY input at all and then crash, and if more than one person connects to my telemachus the ui flickers VERY badly.

Any ideas?

Link to comment
Share on other sites

Any ideas?

Sorry for the late reply, I was quite busy. I have no idea so far, I'll run it in Firefox and see, what happens. I've developed it with Chrome, so maybe firefox handles something differently...

As for the flickering, I think the problem is, that every 'client' request the data on its own from Telemachus. I think this chokes up Telemachus/KSP. I'll have to look more into Websockets and maybe talk to the Telemachus dev to see if there is anything I can do. Reducing the refresh rate might help...

I'll soon upload everything to Curse and Git so that it is easier to check the source code.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
Heeeey! Knock Knock!

Can we get an ETA for source code and updates :confused:

It's a javascript interface for the Telemachus data, so the source code is essentially baked in.

This is very well done.

Despite getting inspiration from a clean source, I feel that you took that inspiration and have a good understanding of delivering precisely what is needed in a minimalist sense. If this isn't a piece for a portfolio of work you do, it should be.

Keep up the good work!

Link to comment
Share on other sites

^^Rightly so....I also was in a hurry, and clicked the wrong button...Luckily, i thought it was weird that I ended up with an .exe, instead of a standard .zip...So I virus scanned it before running it, and Avast threw up a BIG red flag that its a virus....

Link to comment
Share on other sites

  • 5 months later...
The red "X" button is not working

Sorry for not posting in a long time, I had quite some stuff going on with my studies. In what situation is the button not working? It should work when a connection was successfully established. Have you allowed incoming connections for KSP on your firewall like I wrote in the first post?

- - - Updated - - -

It's a javascript interface for the Telemachus data, so the source code is essentially baked in.

This is very well done.

Despite getting inspiration from a clean source, I feel that you took that inspiration and have a good understanding of delivering precisely what is needed in a minimalist sense. If this isn't a piece for a portfolio of work you do, it should be.

Keep up the good work!

Thank you very much for the kind words. Unfortunately I was very busy and could not continue refining it. I also don't know where to go with the limits of using Telemachus (don't get me wrong, it is an amazing mod, but it has it's limits and problems). I would be really nice to get all the data directly from KSP, and also stuff like target vector, maneuver vector, time to burn, burn time and deltaV. Unfortunately the dev of Telemachus said he doesn't has time to continue developing it. It is the first thing I ever made in Javascript so I'm surprised that you consider the code being good.

Last edit: I modified the first post to add the source code on pastebin:

http://pastebin.com/QtmiHBXa

Copy it into a new text file, rename it to .html and play around with it.

Edited by rob3110
added quote
Link to comment
Share on other sites

Amazing, I do not know how I will survive without it!

(actually, I can't seem to get it running. I've got telemachus up, but yours does not get past connecting. I get this in the log: SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data (in firefox); and: Uncaught SyntaxError: Unexpected token : (in chrome, pointing to line 215)

Can you add this to CKAN (does it count as a mod?)?

Link to comment
Share on other sites

Amazing, I do not know how I will survive without it!

(actually, I can't seem to get it running. I've got telemachus up, but yours does not get past connecting. I get this in the log: SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data (in firefox); and: Uncaught SyntaxError: Unexpected token : (in chrome, pointing to line 215)

Can you add this to CKAN (does it count as a mod?)?

It's my understanding, generally speaking, that external interfaces such as this one, that do not directly connect to KSP will not be considered a mod and won't be hosted by CKAN. Look at KSPTOT to see what I mean. I personally think you can get no better Trajectory Optimization tool than KSPTOT and it even pulls data from and sends data to MechJeb but CKAN won't host it since it's a MATLAB program techincally. As such, I do not believe this one will get on there either.

To rob3110 - I just recently started using Telemachus since it finally is working properly again and this looks to be a much better interface. Looking forward to trying it out and I hope you will consider continuing development on it despite the limitations of Telemachus.

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

This looks awesome!  If you're interested in continuing this...  I might be of some use!  I've poked around in the telemachus code before (ages ago) and would be happy to see about extending it to add the other variables you want to subscribe to.  That said...  if you're interested enough to consider a big overhaul of the underlying framework, I think you can get around the telemachus limitations... 

Telemachus basically (and ingeniously!) fits a webserver into a KSP plugin, which makes it really easy to write clients for, but puts some extra load into a game that already struggles to keep up with itself sometimes...  There are two other approaches that I've found.  GoAtThrottleUp runs an external webserver and just runs a loop in the ingame plugin that posts data to the external server at regular intervals...  The downside is it's transmitting EVERYTHING an external user might want all the time, with no idea whether the specific user is needing any given bit of data.  I also think that plugin's largely unmaintained now...  but it's an option.  I also think this plugin is one-directional, data-out only, if memory serves?

 

The other option, and the one I'm playing with at the moment, is kRPC which uses google protocol buffers to get data in and out over a local or networked connection.  It seems rock solid and it has the ability both to poll for data or to subscribe to regular data streams...  the downside is that you need an external application that can encode and decode protocol buffers...  the Python client library for kRPC is complete and awesome...  I don't know about the Ruby, Lua, or C++ libraries yet...  I know the C++ one doesn't work with the streaming feature so requires polling.

 

If you've got any python experience at all, you could write a python webserver that basically emulates the Telemachus API...   so your webapp would work unmodified, thinking it had reached Telemachus... but in actuality would be reaching your python app that served up all the telemachus data (and whatever extensions you wanted) and communicated bidirectionally with KSP through the kRPC protocol?

Link to comment
Share on other sites

  • 1 year later...
On 20/08/2017 at 11:53 PM, Ericwi said:

Does any one still have this? The URL at the top is not good.

Use the Pastebin link and create a HTML file manually.

But, it refuses to connect to me game, it's stuck on "connecting, please wait".

Anyone got a fix?

Edited by SupperRobin6394
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...