Darkstar One Posted April 10, 2016 Share Posted April 10, 2016 Tried it today and installed dependecies too but get a lot of linker errors (LNK2019) for non resolved external symbols like this one 1>KSP Status Console.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall krpc::schema::Status::Status(void)" (??0Status@schema@krpc@@QAE@XZ)" in Funktion ""public: class krpc::schema::Status __thiscall krpc::services::KRPC::get_status(void)" (?get_status@KRPC@services@krpc@@QAE?AVStatus@schema@3@XZ)". with the default example from your wiki at http://krpc.github.io/krpc/cpp/client.html#connecting-to-the-server. Any hints for me? Quote Link to comment Share on other sites More sharing options...
Keith Young Posted April 10, 2016 Share Posted April 10, 2016 8 hours ago, PeteWasEre said: So i made some progress on landing guidance. if anyone else would like it here it is. It sets up lines either side of the runway at 4 (red), 5 (white) and 6 (yellow) deg slope for 20km from runway 09 threshold. 3.5 degrees, as per an airliner, did not seem kerbal enough so i went for a military 5. A shuttle 21 deg approach could be interesting too for an unpowered craft. The only shame is that it is hard coded. I cant find a way to calculate them directly, which would be nice so you can tune slope / distance. I used a test rig comprising a Mk1 cockpit on the front of a T frame of girders with some more girders for legs so i know the rig will sit as flat and straight as possible. This was important as it lets me use the vessels reference frame as a runway reference frame. I could then define the start and end position for each line in the 'runway reference frame'. The starts are simply (+/-30,0,0) and the ends are (+/-30, -length, -tan(slope)*length). Each of these points (2 start, 6 end) are transformed into the kerbin reference frame using space_center.transform_position() and pasted into the code. To get the other end you just need to rinse/repeat with a vessel at the other threshold, but make sure it sits dead flat (pitch and roll). import krpc conn = krpc.connect(name='blah') vessel = conn.space_center.active_vessel conn.space_center.clear_drawing() v1_start = (158095.3939033646, -478.99761794020907, -578869.7132278137) v2_start = (158094.96184479096, -538.996063121335, -578869.7134211722) v1l_end = (139184.84695719907, -342.79930986318584, -585527.6834731719) v1m_end = (139278.06869656406, -343.45641409607947, -585866.255670956) v1h_end = (139371.60232570115, -344.14248819162003, -586205.9386240399) v2l_end = (139184.35853335817, -402.79511157271287, -585527.523517651) v2m_end = (139277.66372229127, -403.45750069248425, -585866.328863767) v2h_end = (139371.1656752824, -404.1432818151327, -586205.927123417) l_col = (255,0,0) m_col = (255,255,255) h_col = (255,255,0) conn.space_center.draw_line(v1_start, v1l_end, vessel.orbit.body.reference_frame, l_col) conn.space_center.draw_line(v1_start, v1m_end, vessel.orbit.body.reference_frame, m_col) conn.space_center.draw_line(v1_start, v1h_end, vessel.orbit.body.reference_frame, h_col) conn.space_center.draw_line(v2_start, v2l_end, vessel.orbit.body.reference_frame, l_col) conn.space_center.draw_line(v2_start, v2m_end, vessel.orbit.body.reference_frame, m_col) conn.space_center.draw_line(v2_start, v2h_end, vessel.orbit.body.reference_frame, h_col) Pseudo code: if vessel.name == 'shuttle' slope = 21 elif vessel.name == 'airliner' slope = 3 Then set up vectors. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 10, 2016 Author Share Posted April 10, 2016 1 hour ago, Darkstar One said: Tried it today and installed dependecies too but get a lot of linker errors (LNK2019) for non resolved external symbols like this one 1>KSP Status Console.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall krpc::schema::Status::Status(void)" (??0Status@schema@krpc@@QAE@XZ)" in Funktion ""public: class krpc::schema::Status __thiscall krpc::services::KRPC::get_status(void)" (?get_status@KRPC@services@krpc@@QAE?AVStatus@schema@3@XZ)". with the default example from your wiki at http://krpc.github.io/krpc/cpp/client.html#connecting-to-the-server. Any hints for me? These missing symbols should be defined in libkrpc.so So there is something wrong with the linker flags/config. 10 hours ago, PeteWasEre said: So i made some progress on landing guidance... Very cool! I added that line printing stuff just for debugging of reference frames, direction transformations etc. Nice to see it being "abused" for profit Quote Link to comment Share on other sites More sharing options...
Darkstar One Posted April 10, 2016 Share Posted April 10, 2016 1 hour ago, djungelorm said: These missing symbols should be defined in libkrpc.so So there is something wrong with the linker flags/config. Will try to sort it out. Has anyone used this with MSVC 2015 and has the correct settings at hand? Quote Link to comment Share on other sites More sharing options...
PeteWasEre Posted April 11, 2016 Share Posted April 11, 2016 9 hours ago, Keith Young said: Pseudo code: if vessel.name == 'shuttle' slope = 21 elif vessel.name == 'airliner' slope = 3 Then set up vectors. This wont work simply because the vector in the runway reference frame is calculated offline (excel) and then a transformation is done from the vessel to the body reference frame. To do this the test rig aircraft must be the active vessel on the runway. However I could calculate and store multiple vectors as hard code and switch, which would work but is coding heresy. @djungelorm is it possible to create a reference frame dynamically? i.e a function that takes a point in another reference frame, and 3 direction vectors and returns a new reference frame. Then I could define a reference frame at the threshold and all this would get a lot easier and more dynamic. You can even have the flight path adjust based on your position and guide you right onto finals! Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 11, 2016 Author Share Posted April 11, 2016 It's not possible sounds like a worthy addition though? Quote Link to comment Share on other sites More sharing options...
PeteWasEre Posted April 11, 2016 Share Posted April 11, 2016 I would definitely use it! Not just for this, but I can imagine creating a reference frame on a part, say a cockpit or docking port, as opposed to the vessel CoM. Once its created you don't need to worry about the offset or rotation anymore, just do everything in your new reference frame. Also, while I am busy creating ideas the draw line is great and if it is possible to extend it I would be a happy camper! Line thickness as a simple example but is it possible to draw shapes, planes? Or even be able to draw on the nav ball! now I am getting carried away I know. I know this mod is not meant to be KSPaint but I am seeing lots of opportunity for guidance, targeting etc There are many pushes in real aviation for 3D goggles to overlay information onto real life, well this could provide the same. Quote Link to comment Share on other sites More sharing options...
Keith Young Posted April 11, 2016 Share Posted April 11, 2016 Yeah I was looking in to drawing where the vessel will impact the ground assuming no air resistance and a sub-orbital path. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 14, 2016 Author Share Posted April 14, 2016 I've added more drawing tools (#253) and custom reference frames (#252) to the todo list Quote Link to comment Share on other sites More sharing options...
Kahuette Posted April 16, 2016 Share Posted April 16, 2016 (edited) Hey, I'd like to thank you for this awesome idea. I've been trying to implement a client in Haskell for the past few hours but it seems there's little support for protocol buffers v3 yet in the two dominant Haskell libraries. I've followed your very nice example in python to do a simple GetStatus request. The server seems to understand the request fine (I can see the mod's version in ASCII somewhere in the binary I receive) but I am unable to parse the response for now. I might have to fall back to using the C++ library from Haskell. I've never worked with google's protocol buffers before so the following question might seem dumb : is there any chance you could provide a v2 .proto file ? Edited April 16, 2016 by Kahuette Quote Link to comment Share on other sites More sharing options...
mdfntr Posted April 20, 2016 Share Posted April 20, 2016 Is it possible to collect/transmit science without invoking the stock science pop-ups? Currently I can deploy experiments by firing the events in each experiment part's module, but this brings up the pop-up and requires manual intervention in the game. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 21, 2016 Author Share Posted April 21, 2016 20 hours ago, mdfntr said: Is it possible to collect/transmit science without invoking the stock science pop-ups? Currently I can deploy experiments by firing the events in each experiment part's module, but this brings up the pop-up and requires manual intervention in the game. Unfortunately not. I'll add it to the todo list On 4/16/2016 at 4:57 AM, Kahuette said: I've never worked with google's protocol buffers before so the following question might seem dumb : is there any chance you could provide a v2 .proto file ? I'll see what I can do about a proto2 file. I don't think it uses any of the proto3 only features so this should just be syntax changes at the worst. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 21, 2016 Author Share Posted April 21, 2016 0.3.0 has been released Download links updated in the first post. Here are the highlights: Support for KSP 1.1 Get the MoI and inertia tensors of vessels and individual parts Thruster objects - for the individual nozzels on an engine or in an RCS block. Gives you the thrust positions and directions. Objects for RCS and control surface parts Camera controls - rotate, zoom and switch modes (although rotation and zooming in IVA doesn't work yet) Save and load the game Resource transfers And various bug fixes See the full list of changes for more details Quote Link to comment Share on other sites More sharing options...
Kahuette Posted April 23, 2016 Share Posted April 23, 2016 (edited) On 4/21/2016 at 6:39 AM, djungelorm said: I'll see what I can do about a proto2 file. I don't think it uses any of the proto3 only features so this should just be syntax changes at the worst. Thanks djungelorm but I think I figured out why I wasn't able to parse messages. It seems that, since protocol buffer v3, all fields are optional by default. I assumed the default would be 'required' since some messages in the krpc.proto file would not make sense without some fields (take 'Argument' for example). With proper annotation in krpc.proto, I was able to generate code that could parse replies from KRPC. Now that this is done, the fun part begins. Edited April 23, 2016 by Kahuette Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 23, 2016 Author Share Posted April 23, 2016 Cool! What did you need to change in the .proto, did you just add required to all the fields? Maybe we should merge your changes on github? Quote Link to comment Share on other sites More sharing options...
Kahuette Posted April 23, 2016 Share Posted April 23, 2016 (edited) 4 hours ago, djungelorm said: Cool! What did you need to change in the .proto, did you just add required to all the fields? Maybe we should merge your changes on github? Actually, that was my mistake : I added 'required' to everything that wasn't already annotated but it turns out the correct annotation is in fact 'optional'. If that's ok, I have suggestion about the .proto file : since most fields are 'optional', the generated code checks for the presence of all these fields all the time. I think setting fields that are always present to 'required' will result in simpler code and possibly smaller messages. However, such changes will break compatibility with existing clients. It might also be possible to merge some fields together. For instance, in the 'Response' message, both fields 'error' and 'has_error' are implicitly declared 'optional'. The two could be merged in one single 'optional' field that is present only if there was an error. Let me experiment a little longer with the client I'm writing and, if you'd like, I'll contribute what I have on github. Edited April 23, 2016 by Kahuette Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 26, 2016 Author Share Posted April 26, 2016 On 4/23/2016 at 0:41 PM, Kahuette said: If that's ok, I have suggestion about the .proto file : since most fields are 'optional', the generated code checks for the presence of all these fields all the time. I think setting fields that are always present to 'required' will result in simpler code and possibly smaller messages. However, such changes will break compatibility with existing clients. It might also be possible to merge some fields together. For instance, in the 'Response' message, both fields 'error' and 'has_error' are implicitly declared 'optional'. The two could be merged in one single 'optional' field that is present only if there was an error. By all means! That's actually how it worked before I moved things to proto3. Here's the old proto2 file: https://github.com/krpc/krpc/blob/v0.1.11/src/kRPC/Schema/KRPC.proto I remember there were some issues (although what exactly escapes me...) when moving over to proto3 that meant I avoided using required fields, and added a separate boolean for optional fields. If its beneficial to tweak things I see no reason not to. Updating the clients would be fairly straightforward, and client programs would be unaffected. I'm working on adding more communication protocols (I got a websockets prototype working over the weekend, and am looking into adding gRPC support) so if we want to tweak the protocol we could include it with those updates. Quote Link to comment Share on other sites More sharing options...
ytmytm Posted April 27, 2016 Share Posted April 27, 2016 Thank you for this great mod. It made my custom KSP controller actually possible: https://hackaday.io/project/8891-ksp-gegi This is a bunch of controls and displays connected through two Arduinos (Mini and Micro) to USB. The source code for both controllers and python interface code is here: https://github.com/ytmytm/ksp-gegi Without much thinking I put there a warning light for overheating. Only later I realized that it's not that easy to find out if there is any part of the ship that overheats. Right now I do this: self.temp_pct=max([max(part.temperature/part.max_temperature,part.skin_temperature/part.max_skin_temperature) for part in self.parts]) So I have to go through all parts of a ship to find out what is the maximum of ratio of current temperature of a part to its max temperature. Then if temp_pct is above 60% the warning LED is on and if it is above 80% it blinks to attract attention. It's OK, right now this works. But is there a better way? It takes so much time that I had to move it to a separate thread, otherwise displays and user controls would be blocked. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 29, 2016 Author Share Posted April 29, 2016 I've just released 0.3.1 - no new features, just built against KSP version to 1.1.1 On 4/27/2016 at 5:58 AM, ytmytm said: Thank you for this great mod. It made my custom KSP controller actually possible: https://hackaday.io/project/8891-ksp-gegi This is a bunch of controls and displays connected through two Arduinos (Mini and Micro) to USB. The source code for both controllers and python interface code is here: https://github.com/ytmytm/ksp-gegi Without much thinking I put there a warning light for overheating. Only later I realized that it's not that easy to find out if there is any part of the ship that overheats. Right now I do this: self.temp_pct=max([max(part.temperature/part.max_temperature,part.skin_temperature/part.max_skin_temperature) for part in self.parts]) So I have to go through all parts of a ship to find out what is the maximum of ratio of current temperature of a part to its max temperature. Then if temp_pct is above 60% the warning LED is on and if it is above 80% it blinks to attract attention. It's OK, right now this works. But is there a better way? It takes so much time that I had to move it to a separate thread, otherwise displays and user controls would be blocked. You could add a stream for each temperature on each part? This is probably a lot of streams though so I'm not sure how well the server would handle it. Another option would be to add a new RPC to the server. kRPC is extensible, so you could write add your own if you like. Details are here: http://krpc.github.io/krpc/extending.html#service-api Quote Link to comment Share on other sites More sharing options...
Gouttfi Posted April 29, 2016 Share Posted April 29, 2016 (edited) Hi, I have a little problem, I can not use warp_mode, warp_rate, warp_factor, I have a error print(vessel.warp_mode) I try to investigate, thank you EDIT : Solved Edited April 29, 2016 by Gouttfi solved Quote Link to comment Share on other sites More sharing options...
Kerbart Posted April 30, 2016 Share Posted April 30, 2016 Hi @djungelorm, Amazing quick release of the 1.1.1 compatible version. I get an error when installing the client though: R:\>pip install --upgrade krpc Collecting krpc Downloading krpc-0.3.1.zip (56kB) 100% |################################| 61kB 2.0MB/s Requirement already up-to-date: protobuf==3.0.0b2 in c:\python27\lib\site-packages (from krpc) Collecting enum34>=0.9 (from krpc) Downloading enum34-1.1.4-py2.py3-none-any.whl (61kB) 100% |################################| 61kB 1.9MB/s Collecting setuptools (from protobuf==3.0.0b2->krpc) ... banana banana banana ... File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1848, in zipinfo return self._zip_manifests.load(self.loader.archive) File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1788, in load mtime = os.stat(path).st_mtime WindowsError: [Error 2] The system cannot find the file specified: 'c:\\python27\\lib\\site-packages\\krpc-0.3.0-py2.7.egg' It seems that the setup file is still referring to the 0.3.0 version! No biggie; and I can install the client manually... but I'd figured I just give the feedback. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 30, 2016 Author Share Posted April 30, 2016 That's odd. There is no mention of 0.3.0 in the new source archive, and it worked fine on my windows box. Suggests it must be something wonky with your environment. Quote Link to comment Share on other sites More sharing options...
Gouttfi Posted April 30, 2016 Share Posted April 30, 2016 are you updated your mod for 1.1.2 ? or it's already compatible ? because the mod doesn't work in KSP 1.1.2, I think so it's not compatible, right ? Quote Link to comment Share on other sites More sharing options...
Spul M. Posted April 30, 2016 Share Posted April 30, 2016 15 minutes ago, Gouttfi said: are you updated your mod for 1.1.2 ? or it's already compatible ? because the mod doesn't work in KSP 1.1.2, I think so it's not compatible, right ? This is what I am wondering as well. For some reason the server console is gone since 1.1.2. Normally the server automatically starts, But I am no longer able to connect to it. Quote Link to comment Share on other sites More sharing options...
djungelorm Posted April 30, 2016 Author Share Posted April 30, 2016 Testing it as you type Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.