Jump to content

Game data serial output?


Recommended Posts

I'm wanting to build an Arduino based flight control panel with buttons for toggling RCS, SAS, gear, ect. That part will be easy. What I need help with is writing a plugin for KSP to output game state data like fuel levels, electric charge, alt, and velocity via serial port. My plan was to have the Arduino buffer this data and then write it to a LCD screen. If someone is interested in helping with this, if it's even possible, when I have a working prototype I will post details on how to build the flight controller and the Arduino code so anyone who wants to get their hands dirty can have a nerd toy of their own.

Link to comment
Share on other sites

I'm fairly certain that since they unlocked System.IO a few versions ago you should be able to send data to a serial port. Rich's Telemachus plugin is probably reading and displaying almost all the data you are looking for, so if you look at that you should be able to tell if it is possible to do, before getting too far along.

I'll have to pass on helping directly though at the moment, but will keep an eye on this.

Link to comment
Share on other sites

How's your C#? What you're looking to do is achievable (assuming as Trigger Au said that System.Io.Ports is available), and a good way to get started with KSP plugin development. There's a guide to starting out on the wiki here, and TaranisElsu has put together some example plugins here. There is some player-compiled documentation for autocomplete here.

Talking over a serial COM port is pretty easy in C#. See here for an example.

To get the various values you're looking to read, have a browse through FlightGlobals.ActiveVessel in your IDE.

If you have any questions that you don't think warrant a thread of their own, this thread is the place to go.

Good luck!

Link to comment
Share on other sites

Thanks for the input. The last time I wrote in any program language was about ten years ago but I'll take a look and see what I can do. I did not expect to get info so quickly on this topic so that in itself is encouraging. I will try to post news of my progress here for those who are interested. Thanks again for the breadcrumbs at the start of my trail.

Link to comment
Share on other sites

I am also planning to use an Arduino based controller setup with KSP. My first goal is just to add a few frequently used controls, and remap controls of my XBOX 360 controller in flight using the USB Host Shield. So I am definitely interested in this.

Some of my ideas:

- deadzone control so no manual deadzone adjustment is necessary

- use a rotary encoder to adjust controller sensitivity

- use a motorized pot for throttle (so it can be set to min/max with a button and also controlled from the controller)

Link to comment
Share on other sites

I am also planning to use an Arduino based controller setup with KSP. My first goal is just to add a few frequently used controls, and remap controls of my XBOX 360 controller in flight using the USB Host Shield. So I am definitely interested in this.

Some of my ideas:

- deadzone control so no manual deadzone adjustment is necessary

- use a rotary encoder to adjust controller sensitivity

- use a motorized pot for throttle (so it can be set to min/max with a button and also controlled from the controller)

My plan was to start with a basic "flight komputer" and use a USB joystick for flight controls. Then if that went as planned, look at building a new box with integrated flight controls. This weekend I will try to get some EagleCAD proto drawings going and post them. Right now I'm working on getting an IDE setup so I can look into pulling data from the game and output via serial.

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...