Jump to content

[1.0.4] (2015-07-04) Telemachus – Telemetry and Flight Control in the Web Browser


Rich

Recommended Posts

There no method by default to export data to a CSV file in Telemachus, as the focus of this project is the API itself. However, there are several options:

1. I believe you can use Kerminal to log the data provided by Telemachus to a CSV file.

2. The VOID plugin does allow you to log a limited subset of data from KSP.

3. A logger could be thrown together fairly quickly in any programming language which supports web sockets and file I/O.

Link to comment
Share on other sites

Hi there!

I've downloaded and installed this great mod. However, my phone can't connect to the Telemachus "server". Both devices are on the same Wi-Fi network. Also, there is no IP addresses written by Telemachus in debug. I have tried to connect to various IP addresses (like my pc's IP), but Chrome returns "connection refused" message.

Do I need to mess with port forwarding? Is there something trivial tht I've overlooked?

Thanks in advance!

Link to comment
Share on other sites

  • 3 weeks later...

When I try to get a websocket response, nothing is happening. At first I thought it was my code, but then I tried using this chrome extension called simple websockets (https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo/related?hl=en) and found that it also did not give any response, although it was showing a connection to the server. I sent the message


{
"+":["v.altitude", "v.name"],
"rate": 500
}

any ideas?

Link to comment
Share on other sites

Ok. Last question, I promise. do you have any idea why this code isn't working? controller.connected returns true, but controller.recv() does not print anything, not even the {} response or any errors.


from websocket import create_connection

controller = create_connection("ws://localhost:8085/datalink")
print controller.connected
controller.send('{"rate":500}')
while 1:
print controller.recv()

Edited by peachoftree
Link to comment
Share on other sites

Ok. Last question, I promise. do you have any idea why this code isn't working? controller.connected returns true, but controller.recv() does not print anything, not even the {} response or any errors.

For what it is worth, I find connecting via websocket pretty hit-and-miss - sometimes it will just connect, and refuse to respond, sometimes it will all go through perfectly, and sometimes it will just sit there and hang before connecting. I haven't yet tracked the cause down, but restarting the program connecting several times usually works.

I have had some errors popping up in the log to do with connections, possibly when disconnected just by shutting the client down, but am still experimenting.

Link to comment
Share on other sites

I have had some errors popping up in the log to do with connections, possibly when disconnected just by shutting the client down, but am still experimenting.

We share the same suspicion, as I am pretty sure the socket is only shutdown correctly when a close message is sent. I've been meaning to debug this and put in a timeout of sorts to nuke the connection.

Link to comment
Share on other sites

We share the same suspicion, as I am pretty sure the socket is only shutdown correctly when a close message is sent. I've been meaning to debug this and put in a timeout of sorts to nuke the connection.

This is the error that seems to spam the log files after a disconnect:

System.Net.Sockets.Socket.BeginSend (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags socket_flags, System.AsyncCallback callback, System.Object state)

Servers.AsynchronousServer.ClientConnection.Send (System.Byte[] byteData)

[EXC 23:26:56.311] SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.

Link to comment
Share on other sites

So, I wanted to get access to more variables that do not exist/a pain to calculate from the existing ones (mainly stuff like the FAR-related variables, and my inability to understand the Telemachus rotation), so I whipped together a quick bridge to RasterPropMonitor - https://github.com/ndevenish/Telemachus/commit/a4b0dc0f9629dbcc9c635182465540ff1a11ce8e

Features:

- Doesn't add a dependency, still works without RPM

- Query access to RPM with "rpm.available"

- Query RPM variables with "rpm.VARIABLE"

Caveats:

- It probably breaks in ways that I have not tested with the slightest breeze

- It will break when they update RPM next, as they have changed where they calculate variables in the current github master

- I haven't studied Telemachus enough to understand the caching system, so it's probably really inefficient in querying for the existence of RPM

Link to comment
Share on other sites

This is the error that seems to spam the log files after a disconnect:

Thanks, this is really helpful! Looks like I need to do something useful when that error is thrown - I'm sure I did sort this out but the evidence would suggest that I didn't

- It probably breaks in ways that I have not tested with the slightest breeze

Good, it will fit in nicely with the rest of Telemachus then :P

do we need internet for this mod ? like if i disconnect the cable it will work?

The stock Telemachus graphs should work without an internet connection, but I can't say anything about the other interfaces.

Link to comment
Share on other sites

okay, apologies for being slightly off-topic but I'm wondering if you can spot anything wrong with this code:


<!DOCTYPE html>

<!-- code/comments not formatted for word wrap -->

<html>
<head>

<!-- Display the KSA favicon -->
<link rel="shortcut icon" href="/images/KSA/favicon.ico" type="image/x-icon" />

<title>KSA Flight Tracker</title>

<!-- use this image link to force reddit to use a certain image for its thumbnail -->
<meta property="og:image" content="http://i.imgur.com/2IH1UpQ.png" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<!-- ensure proper scale of page -->
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- CSS stylesheets -->
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900" />
<link rel="stylesheet" type="text/css" href="http://static.kerbalmaps.com/leaflet.css" />

<!-- JS libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="leaflet.js"></script>
<script type="text/javascript" src="leafletembed.js"></script>

</head>
<body style="padding: 0; margin: 0;">

<div id='map' class='map' style='padding: 0; margin: 0; height: 548px; width: 1044px;'></div>

<script>
// create the map with some custom options
// details on Leaflet API can be found here - http://leafletjs.com/reference.html
var map = new L.KSP.Map('map', {
layers: [L.KSP.CelestialBody.KERBIN],
center: [0,0],
bodyControl: false,
layersControl: false,
scaleControl: true,
});
</script>

</body>
</html>

I basically took the code from my Flight Tracker page and whittled it down to what I thought was the bare-bones needed to display a Leaflet map, but all I get is a grey map. Not sure what I'm missing

Link to comment
Share on other sites

Rich The Doomed Moderator -

First of all - thanks for the work on telemachus - great plugin.

For my own amusement, I am in the process of extending it's functionality by adding onto some of the MechJeb2 capabilities. Specifically I wanted to add the Ascent, Rendezvous, and Docking autopilots along with some of the maneuver planner commands. I have most of it working, except I haven't done any of the web interface part yet. I wrote a small c# app that tests out the interface. (I'm more of a desktop coder). Is this something that you might be interested in including? If so, I could send you the code. If not, I won't be offended, and I'll continue to play around with it. Let me know what you think.

Again thanks for the work.

Allen Carson

Link to comment
Share on other sites

How do I view the data from my iPad?

You've gotta access your PC's local IP address, with :8085 at the end.

To check your local IP if you're on windows, open your command prompt (Press the "windows" key, type CMD and hit enter) and run: ipconfig

Link to comment
Share on other sites

So, this is what I've been working on, with my RPM access extension; an iOS-based (so, runs on iPad) remote HUD, based (obviously, if you know it) on the RasterPropMonitor airplane HUD. It's suprisingly responsive, and I just perch my iPad right in front of the monitor.

It's only the plane HUD at the moment, and the start of an implementation of NavUtilities HSI, because I don't really use the other RPM pages enough, and don't know what other people tend to use. Perhaps the orbital display might be useful; I can envision using several phones/ipads layed out around the monitor with various data screens, but it's probably best to think of things that wouldn't work so well on a web browser.

Source is at https://github.com/ndevenish/KerbalHUD.

qenswqzl.png

Link to comment
Share on other sites

@Rich - you may have heard about the KSPtoMars project (www.ksptomars.org). We would like to use Telemachus, but we are kind-off dependent on being able to stream telemetry from multiple vehicles. Is that something, that is realistic in the near future (< 4 weeks). Oh and having RemoteTech signal delay on Telemachus data when both are installed would be so delicious!

Link to comment
Share on other sites

Oh and having RemoteTech signal delay on Telemachus data when both are installed would be so delicious!

I can see this being partially implemented e.g. when sending commands via telemachus, but the other way around would probably involve too much storage requirement to be able to run in the game proper. I can easily see though, some external proxy server that pulls the data out (and a variable for signal delay) and buffers it until the time has elapsed (in-game, it could read the game time also).

I wonder what multiple vehicle telemetry would look like? At least in stock kerbal, other vehicles are unloaded so only orbital positioning information would be deriveable. This might be enough....

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...