rob3110 Posted September 6, 2014 Share Posted September 6, 2014 (edited) Hello,maybe someone can help me with my problem.I try to create a Primary Flight Display with an artificial horizon, altitude, speed and some more indicators as a html5 page that is supposed to run on a different computer (in Chrome).I try to access the telemachus data via websocket, but it doesn't seem to work.my code in javascript I use for testing: var connection = new WebSocket('ws://192.168.1.130:8085/datalink'); connection.onopen = function () { console.log('Connected'); connection.send('{"+": ["v.altitude"]}'); }; connection.onmessage = function (evt) { console.log('Server: ' + evt.data); }; connection.onerror = function (error) { console.log('WebSocket Error ' + error.data); }; connection.onclose = function () { console.log('Disconnected'); };So from my understanding it should connect to the websocket, when connected subscribe to the altitude value, and when receiving data print it in the browsers log. Because of the subscription telemachus should send a constant stream of altitude data that gets printed in the log. Right?What happens:When I open the page on a different computer in the local network: nothing happens(I can open the telemachus page in my browser via http://192.168.1.130:8085/telemachus/information.html from this computer and I can open specific date via http://192.168.1.130:8085/telemachus/datalink?a=v.altitude and it gives me the JSON-data)When I open the page on the same computer that runs KSP with the localhost IP (127.0.0.1): nothing happensWhen I open the page on the same computer that runs KSP with the actual local IP (192.168.1.130):The browser log shows: Connected Server: {} Disconnected(so apparently it connects, fails to subscribe, returns a null message and closes the connection)Anyone knows what I'm doing wrong here?Thanks for the help. Edited September 6, 2014 by rob3110 formatting Link to comment Share on other sites More sharing options...
Rich Posted September 6, 2014 Author Share Posted September 6, 2014 Due to poor coding on my part, the JSON parser is funny about white space - try this. I have updated the wiki to reflect this issue. Link to comment Share on other sites More sharing options...
rob3110 Posted September 6, 2014 Share Posted September 6, 2014 (edited) Ah, ok. Now I can read the data from the same computer KSP is running on.Edit: I feel stupid, I thought I allowed incomming connections through the firewall for KSP, but I didn't. Now I can connect from other computers as well.Thanks a lot Edited September 6, 2014 by rob3110 Stupidity Link to comment Share on other sites More sharing options...
rob3110 Posted September 11, 2014 Share Posted September 11, 2014 I finished my first version for the PFD, it looks like this:It also has its own small settings menu to change the IP, the Data-Rate and the colors! I'm quite happy for my very first html5 project Thanks for your help!By the way Rich, it seems there is some kind of gimbal lock issue with the way you calculate pitch, heading and roll. When the pitch gets larger than ~87° (or smaller than ~-87°) the pitch suddenly is set to 90° (or -90°) and the roll is set to 0°. The same with rawpitch and rawroll.It's not important when flying a spaceplane, but really obvious when flying a rocket. Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 17, 2014 Share Posted September 17, 2014 (edited) Community :The Telemachus function looks fantastic. As it happens I have two computers, one desktop and one laptop, the desktop is windows 8.1, the laptop windows 7.Naturally, following all instructions to the letter resulted in not being able to access the Telemachus console from the other PC (the laptop). Both PCs are connected via a linksys router, and there is peer to peer connection (I think, I can move files back and forth). On the other PC from which I try to bring up the Telemachus console, I simply get 'page not found'. Here are some things I've noticed. Every screenshot I've seen using this the telemachus console is at 198.168.xxx.xxx:port - on my machine Telemachus is attempting to go through 127.0.0.1:8085. I can't understand why my environment is different, and doesn't work. I don't know how to change the address Telemachus is using. I don't see any instructions on how to do that in the documentation. I don't know anything about port forwarding which I've seen some people mention. In the instructions there are instructions to bring up the KSP output log in game by pressing control-f12, and when that's done there is supposed to be information in that area which tells you what ports Telemachus is listening to. My output log in game doesn't show any of this Telemachus information. I open the KSP console and click on debug - and there are a bunch of entries but not one of them shows anything about ips, ports, or telemachus as illustrated in the documentation. Can someone please, please help?Edit 1: changed the Telemachus config from default to this :<?xml version="1.0" encoding="utf-8"?><config> <int name="PORT">8085</int> <string name="198.168.2.101">-1</string></config>==== This is an address I know exists . . . but Telemachus is still using the http://127.0.0.1:8085 address. Really need help I guess.Edit 2 : Changed Telemachus config file to this :<?xml version="1.0" encoding="utf-8"?><config> <int name="PORT">8085</int> <string name="IPADDRESS">198.168.2.101</string></config>Telemachus still has the console at http://127.0.0.1:8085/telemachus/console.html. I can access the console from my own computer, but again the issue initially is why isn't Telemachus using the address specified in the config file. Probably a syntax error. I still cannot access the Telemachus consol from the other computer. Instructions somewhere would probably help. Edit 3 : I confirm again that the telemachus config file is as above, in the second example, and the telemachus data is propagated to the 127.x.x.x address as that is the tab brought up on the local machine when I "open link". This doesn't make any sense, and I am completely stuck.Edit 4 : okay got it to work see below. Edited September 17, 2014 by KerTrotsky information Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 17, 2014 Share Posted September 17, 2014 Okay I got it to work. It took the whole day. Basically I had to go into my router manually and do port forwarding, as well as get my windows network straightened out. After loading the log file into an editor and doing a search, it turned out that Telemachus was listening for requests on three ports, including 2 in the 198.168.2.x range. All I had to do was plug that IP and port into the remote computer, and click on the index page, and Telemachus popped up, fully functional. Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 18, 2014 Share Posted September 18, 2014 I think it should be noted also that the Telemachus Add-On was just updated to 0.24.2 on September 14th, and is available here http://www.curse.com/ksp-mods/kerbal/220210-telemachusPerhaps the thread title should be updated to reflect the new release compatibility? Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 18, 2014 Share Posted September 18, 2014 Okay does anyone using this know how to get the temperature readout in Telemachus to acquire and transmit temperature data? My temp readout in Telemachus is always blank, I have a 2HOT thermometer on the craft to which the Telemachus antenna is attached. Link to comment Share on other sites More sharing options...
Rich Posted September 18, 2014 Author Share Posted September 18, 2014 Is the temperature sensor on and powered? If it still doesn't work then I will checkout it out when I am back at my dev box. Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 19, 2014 Share Posted September 19, 2014 (edited) Is the temperature sensor on and powered? If it still doesn't work then I will checkout it out when I am back at my dev box.Yes I turned it on, there was plenty of power and in the KSP display for that device it reported a temperature. I am running with Deadly Re-Entry - not sure if TM is compatible with that because Deadly Re-Entry also adds temp lines for almost everything. I should post a screen, because one of the lines in the temp display box for the 2HOT read zero consistently, even though the other two reported something. But Im super tired right now - I'll get a screen up first thing tomorrow. Edit : I made sure also that the 2HOT therm was attached to the same part as the telemachus antenna, in this case the MK2 command module. In fact, they were almost on top of each other. Edited September 19, 2014 by KerTrotsky Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 19, 2014 Share Posted September 19, 2014 Is the temperature sensor on and powered? If it still doesn't work then I will checkout it out when I am back at my dev box.Okay here is the issue, not sure it's an 'issue.' There are 2 thermometers on the craft - 1 is on a probe which was added to the craft early in the construction, the other is on the command pod, and was added once I discovered the temp data in Telemachus wasn't being displayed when I turned on the pod thermometer. However, today I turned on the probe thermometer, and the temp data started showing in Telemachus. I used alt-select to open up both temp displays - and sure enough when I toggled the display on the probe temperature, that's when the data in Telemachus stopped. Toggling the thermometer on the command pod had no effect. It appears therefore that when there is more than 1 thermometer on the craft, telemachus is linked to only one of them - and most likely (just guessing) which one it selects is based on the internal part ID assigned to the craft by KSP. Not sure what this means or if any change is necessary. I guess the question is whether or not Telemachus will report temperature if the part which holds the first thermometer is detached (assuming there is a second thermometer elsewhere on the vehicle with a higher ordinal part number)? Going to test that. Link to comment Share on other sites More sharing options...
Rich Posted September 19, 2014 Author Share Posted September 19, 2014 Are you using the Telemachus console to view the data? While the Telemachus API does export the temperature from all temperature sensors on a craft, the Telemachus console only has the ability to display the temperature from the sensor nearest the vessel's root part. This is a missing feature I have been meaning to add to the console for months, but have not got round to it (that along with converting it to rely on web sockets to improve telemetry uptime). Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 19, 2014 Share Posted September 19, 2014 Are you using the Telemachus console to view the data? While the Telemachus API does export the temperature from all temperature sensors on a craft, the Telemachus console only has the ability to display the temperature from the sensor nearest the vessel's root part. This is a missing feature I have been meaning to add to the console for months, but have not got round to it (that along with converting it to rely on web sockets to improve telemetry uptime).Yes of course I am using Telemachus and specifically the console page - not sure about this question. That was the whole point of what I was doing. The command pod is the root part here, and both the telemachus antenna and the thermometer on the command pod are attached to this part. And as I said above, it was pretty clear to me that Telemachus was reporting temp telemetry only from the probe thermometer, which is in the middle of the vessel. Okay when the probe is detached, Telemachus will begin reporting the thermometer data on the command pod thermometer (2nd in line probably on the numeric part id), but it appears to require a toggle display cycle. I don't have any suggestions here - probably including an option to select which device telemachus is using to acquire and transmit data is too much work for too little return to functionality. However, it may be good information to include in some kind of user manual or guide that the part used is the first part attached to the vehicle during assembly. When I detached the probe thermometer and saved the ship, and then re-attached the probe thermometer and saved in the same build session, and then launched and monitored with Telemachus, Telemachus appeared to report temp data from the thermometer on the command pod - because that part was now a lower # part ID than the probe part ID (guess).Side Note : I noticed in all of this that Telemachus telemetry appeared to hang only to refresh on some kind of mouse activity in the browser (just a slight move or tap). Looking at the browser on the remote computer (next to my main desk) while KSP was running full screen, the Telemachus page in the browser completely hung if there was no mouse activity. (Firewalls on both machines were completely turned off). Any ideas on this one? Probably has nothing to do with TM itself but any suggestion here would be boss. Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 19, 2014 Share Posted September 19, 2014 (edited) In the above post in which I said "Telemachus telemetry appeared to hang only to refresh on some kind of mouse activity . . . " was true in the case of where rather than closing and opening a new browser session when I had closed KSP and re-opened the application, I had simply "refreshed" the browser on the remote computer. When this isn't the case, and the browser session is opened after KSP is opened, telemachus did *not* hang as described. Just FYI. This is a full hang, everything stops being updated, the clock, the graphs, the values, telemetry, everything - and a different case than what I describe two posts down in which the graph color lines (only) stop being drawn. Again not sure this is an issue, simply a requirement that the user open up a new browser session and not use an old one. Edited September 19, 2014 by KerTrotsky Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 19, 2014 Share Posted September 19, 2014 Additional Note : I can't be completely certain that the command pod is the root part. I don't remember the specific way in which I constructed the craft in this context, and it is possible that the root part of the fully assembled vehicle is the probe - but when on the launch pad the vector control is on the command pod, not the probe. Probably a way to tell this by looking at the craft file to be sure, but I don't know what to look for. Link to comment Share on other sites More sharing options...
KerTrotsky Posted September 19, 2014 Share Posted September 19, 2014 (edited) Also just ran another test and have noticed that the graph lines in the console display are drawn for a few seconds and then stop being drawn. The graph values (x-y) are being updated, just the color lines on the graph itself stop getting updated. "refresh" results in the graphical lines being drawn again for a few seconds, and then stop. This seems wierd. I am tasking out from KSP and tasking back in - and KSP is set to not run in the background when tasked out to desktop. Edited September 19, 2014 by KerTrotsky Link to comment Share on other sites More sharing options...
SiliconPyro Posted September 22, 2014 Share Posted September 22, 2014 I finished my first version for the PFD, it looks like this:http://i.imgur.com/Pup2yjg.jpgIt also has its own small settings menu to change the IP, the Data-Rate and the colors! I'm quite happy for my very first html5 project Thanks for your help!This is awesome. Link to comment Share on other sites More sharing options...
rob3110 Posted September 24, 2014 Share Posted September 24, 2014 (edited) This is awesome.Thanks, I have to do some finishing touches, then I plan to release it here in the forums. I just have to find the right place because it is more like a mod of a mod...As it is my first programming in years and my very first in html5/javascript, I'm a bit hesitant because I know my coding is bad...I've released a first version of it in the "Tools and Applications" Forumhttp://forum.kerbalspaceprogram.com/threads/94850-Multiplattform-Primary-Flight-Display-an-alternative-Interface-for-TelemachusHave a look if you're interested.And sorry Rich for Highjacking your thread. Many thanks for your amazing plugin and your help! Edited September 27, 2014 by rob3110 Release Link to comment Share on other sites More sharing options...
SSTL_Pete Posted October 9, 2014 Share Posted October 9, 2014 Any Update on the MKON mod? I'm running an outreach project with some School kids and would love to have this mod with throttle control, so children can do a 'Mission Control' Scenario? Link to comment Share on other sites More sharing options...
Coffeeman Posted October 11, 2014 Share Posted October 11, 2014 Hey! I'm trying to write an autopilot, and I am having some trouble understanding how to get/set Yaw, Pitch and Roll. Want to get 3 numbers representing the current values, but there are only pitch, roll, and heading, all of which seem funky when trying to pull the data. It seems like they are Euler Angles, but I want to know how n.heading, n.roll, and n.yaw are actually processed (checked the code but looks like some kinda lambda-y gobbledygook.) Basically, I want to get the x,y, and z rotation, not the euler angles representing them. Any insight? Link to comment Share on other sites More sharing options...
Rich Posted October 12, 2014 Author Share Posted October 12, 2014 Hey! I'm trying to write an autopilot, and I am having some trouble understanding how to get/set Yaw, Pitch and Roll. Want to get 3 numbers representing the current values, but there are only pitch, roll, and heading, all of which seem funky when trying to pull the data. It seems like they are Euler Angles, but I want to know how n.heading, n.roll, and n.yaw are actually processed (checked the code but looks like some kinda lambda-y gobbledygook.) Basically, I want to get the x,y, and z rotation, not the euler angles representing them. Any insight?The heading, yaw and roll output are calculated using the same code which Mechjeb2 uses.The setYaw, setPitch and setRoll API calls are used to push course changes to your craft in the same way as the arrow keys do. To actually set a craft's yaw, pitch and roll you will need to use the Mechjeb2 API (mj.*) Link to comment Share on other sites More sharing options...
DanLarn Posted November 4, 2014 Share Posted November 4, 2014 Is it possible to send data items back to MechJeb via Telemachus? For example could you create a physical control panel to program the attributes of a maneuver, whilst displaying current values for said attributes, and then use it to execute that maneuver when desired. Not sure this will make sense to anyone but me, I'm very tired at the time of writing. Link to comment Share on other sites More sharing options...
Rich Posted November 4, 2014 Author Share Posted November 4, 2014 Is it possible to send data items back to MechJeb via Telemachus? For example could you create a physical control panel to program the attributes of a maneuver, whilst displaying current values for said attributes, and then use it to execute that maneuver when desired. Not sure this will make sense to anyone but me, I'm very tired at the time of writing.You will need to define what data items and attributes you mean for me to be able to answer your question Link to comment Share on other sites More sharing options...
fullje Posted November 4, 2014 Share Posted November 4, 2014 Hi, veryyy goooood mod ! But i have a question, does the camera work? Link to comment Share on other sites More sharing options...
DanLarn Posted November 4, 2014 Share Posted November 4, 2014 (edited) You will need to define what data items and attributes you mean for me to be able to answer your question Yeah, I suppose I could do that.I'd like to be able to orientate the vessel, so inclination and heading mostly, and then select when to execute this maneuver. and then a separate control to initialise a burn. What I am in a sense wanting to do is create a controller to allow me to have more control over MechJeb's autopilot. it would be steering Manually, but with all of the precision afforded by MechJeb.One other thing, would you be able to set a traget from this said magical controller? I appreciate there is no way to selct this from a drop down list in game so you will have to take the list of bodies from a user created table. Ultimately this will lead to being able to use the rendezvous planner to calculate values for input above. Or would you have to create a standalone trajectory calculator? Edited November 4, 2014 by DanLarn Link to comment Share on other sites More sharing options...
Recommended Posts