EricccMa Posted March 16, 2018 Share Posted March 16, 2018 Thank you for reviewing my code. I try to change my code as you suggest. Unfortunately, throttle still doesn't work. These days, I refactor my code and here is my code. KPanel.ino #include <KerbalSimpit.h> #include <Arduino.h> #include <PayloadStructs.h> #include <Wire.h> #include <SPI.h> #include <U8g2lib.h> #include "Util.h" #define RC_PIN 2 U8G2_SSD1306_128X64_NONAME_1_HW_I2C lcd(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); //init u8g2 driver // How often to send echo packets (in ms) unsigned int sendInterval = 100; void initHandler() { lcd.firstPage(); do { lcd.setCursor(0,20); lcd.print("Connecting"); }while(lcd.nextPage()); } void setup() { lcd.begin(); lcd.setFont(u8g2_font_ncenB14_tr); Serial.begin(115200); initSimpit(Serial,RC_PIN); initHandler(); startSimpit(); } void loop() { static unsigned long lastLoop = millis(); lcd.firstPage(); do { if(receiveFlag) { lcd.setCursor(0,20); if(mannualMode) { lcd.print("Manual"); }else { lcd.print("Auto"); } lcd.setCursor(0,40); lcd.print("ALT:"); lcd.print(altitude.surface); }else { lcd.setCursor(0,40); lcd.print("Wait Data"); } }while(lcd.nextPage()); unsigned long now = millis(); unsigned long delta = now - lastLoop; if(delta>=sendInterval) { sendRC(); } checkRecv(); } Utils.h #ifndef UTIL_H #define UTIL_H #include <Arduino.h> #include <HardwareSerial.h> #include <KerbalSimpit.h> #include <PayloadStructs.h> extern KerbalSimpit* mySimpit;//KerbalSimpit extern bool receiveFlag;//true if is in flight extern int RC[10]; extern int RC_Parsed[4]; extern altitudeMessage altitude; extern int rcPin; extern unsigned long lastRecvTime; extern bool mannualMode; //current mode: true:mannual false:auto void initSimpit(Stream& in,int rc); void startSimpit(); void checkRecv(); void sendRC(); void parseRC(); void InterruptService(); void messageHandler(byte messageType, byte msg[], byte msgSize); #endif Utils.cpp #include "Util.h" KerbalSimpit* mySimpit;//KerbalSimpit bool receiveFlag = false;//true if is in flight int RC[10]={0}; int RC_Parsed[4]={0}; int rcPin; altitudeMessage altitude; unsigned long lastRecvTime=0; bool mannualMode = true; void initSimpit(Stream& in,int rc) { mySimpit = new KerbalSimpit(in); rcPin = rc; attachInterrupt(digitalPinToInterrupt(rcPin),InterruptService,CHANGE); } void startSimpit() { // This loop continually attempts to handshake with the plugin. // It will keep retrying until it gets a successful handshake. while (!mySimpit->init()) { delay(100); } lastRecvTime = millis(); mySimpit->registerChannel(ALTITUDE_MESSAGE); mySimpit->inboundHandler(messageHandler); } void checkRecv() { mySimpit->update(); unsigned long delta = millis() - lastRecvTime; if(delta>1000) { receiveFlag = false; }else { receiveFlag = true; } } void sendRC() { parseRC(); rotationMessage rotationMsg; rotationMsg.mask=1|2|4; if(RC[4]>1500)//Manual { mannualMode = true; rotationMsg.roll=RC_Parsed[0]; rotationMsg.pitch=RC_Parsed[1]; rotationMsg.yaw=RC_Parsed[3]; }else { mannualMode = false; rotationMsg.roll=0; rotationMsg.pitch=0; rotationMsg.yaw=0; } mySimpit->send(ROTATION_MESSAGE,rotationMsg); mySimpit->send(THROTTLE_MESSAGE,(unsigned char*)(&RC_Parsed[2]),2); } void InterruptService() { static unsigned long int lastTime=0; static int cursor=0; if (digitalRead(2) == LOW) { unsigned long int now=micros(); unsigned long int thisTime=now-lastTime; if(thisTime>3000) { cursor=0; }else { RC[cursor++]=thisTime; } lastTime=now; } } void parseRC() { for(int i=0;i<4;i++) { RC_Parsed[i]=map(RC[i],1000,2000,-31000,31000); } RC_Parsed[2] +=31000; } void messageHandler(byte messageType, byte msg[], byte msgSize) { static bool ledStatus = false; digitalWrite(13,ledStatus); ledStatus = !ledStatus; if(messageType == ALTITUDE_MESSAGE) { altitude=parseAltitude(msg); } lastRecvTime = millis(); } I can make sure it sends throttle data, but it still doesn't work. Can you help me find the solution? Hope for replying soon. Thanks Link to comment Share on other sites More sharing options...
CyborgThief Posted March 17, 2018 Share Posted March 17, 2018 Hey, I'm unsure as to what the msg part of parseAltitude actually consists of? Link to comment Share on other sites More sharing options...
stibbons Posted March 29, 2018 Author Share Posted March 29, 2018 On 17/03/2018 at 3:50 AM, EricccMa said: I can make sure it sends throttle data, but it still doesn't work. Can you help me find the solution? Hope for replying soon. Quick read says it looks fine. I'll probably have to dig in to how the plugin is working, sorry. I'm in the middle of moving house, it'll take me some time before I'm settled and able to work on much. On 18/03/2018 at 5:28 AM, CyborgThief said: I'm unsure as to what the msg part of parseAltitude actually consists of? As per the docs at http://kerbalsimpit-arduino.readthedocs.io/en/stable/payloadstructs.html - parseAltitude returns an altitudeMessage struct, containing values for sealevel and surface altitude in your current SOI. The KerbalSimPitAltitudeTrigger demo sketch has an example of how to use parseAltitude and extract data from the struct it returns. In unrelated news, I've just uploaded version 1.2.6 of the plugin, which is just a rebuild for KSP 1.4.2. I've also released a small bugfix release of the Arduino library, version 1.1.4. I'm hoping this release will also sort out the issue I'm having with the Arduino library crawler. Link to comment Share on other sites More sharing options...
Oscar_Mike Posted April 4, 2018 Share Posted April 4, 2018 I've just started initial forays into the world of a Kerbal SimPit, and I'm quite excited by it all, especially after finding that the previous serialIO plugin was no longer supported, but that this one was in development - hurrah! I've poked around with arduinos before, but nothing of any great significance, and I suspect that is where I'm coming unstuck. I've hooked up a small OLED panel to display the altitude and apsides messages, and an 2812 LED bar to show the state of the action groups. Either on their own work fine, but if i have them both enabled then the arduino crashes, restarts, and never quite connects properly again. My first thought was a memory issue, but it seems to have enough spare. Second thought was a conflict between the OLED and the LED, but running them both on a separate sketch with no simpit seems to work, even with a serial write function. Code is as follows: #include <KerbalSimpit.h> #include <Adafruit_NeoPixel.h> #include <Adafruit_SSD1306.h> #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); #if (SSD1306_LCDHEIGHT != 64) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif #define LEDPIN 6 Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, LEDPIN, NEO_GRB + NEO_KHZ800); int XPin = A0; int YPin = A1; int XValue = 0; int YValue = 0; int XGame, YGame; int displayAltitude; long displayApsides; KerbalSimpit mySimpit(Serial); void setup() { strip.begin(); strip.show(); display.begin(SSD1306_SWITCHCAPVCC, 0x3c); Serial.begin(115200); display.clearDisplay(); display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(0,0); display.println(" Load "); display.println(" Kerbal"); display.display(); delay(1000); while (!mySimpit.init()) { display.setCursor(0,0); display.println("Connecting"); display.display(); } display.setCursor(0,0); display.clearDisplay(); display.println("Initialised"); display.display(); delay(1000); mySimpit.inboundHandler(messageHandler); mySimpit.registerChannel(ALTITUDE_MESSAGE); mySimpit.registerChannel(APSIDES_MESSAGE); mySimpit.registerChannel(ACTIONSTATUS_MESSAGE); } void loop() { XValue = analogRead(XPin); YValue = analogRead(YPin); XGame = map(XValue,0,680,-32000,32000); YGame = map(YValue,0,680,32000,-32000); rotationMessage rotationMsg; rotationMsg.mask=1|2|4; rotationMsg.yaw=XGame; rotationMsg.pitch=YGame; rotationMsg.roll=0; mySimpit.send(ROTATION_MESSAGE,rotationMsg); mySimpit.update(); updateDisplay(); } void messageHandler(byte messageType, byte message[], byte messageSize) { clearpixels(); switch(messageType) { case ALTITUDE_MESSAGE: if (messageSize == sizeof(altitudeMessage)) { altitudeMessage myAltitude; myAltitude = parseAltitude(message); displayAltitude = myAltitude.sealevel; } break; case APSIDES_MESSAGE: if (messageSize == sizeof(apsidesMessage)) { apsidesMessage myApsides; myApsides = parseApsides(message); displayApsides = myApsides.apoapsis; } break; case ACTIONSTATUS_MESSAGE: byte testip = message[0]; //Test action groups if(testip & ABORT_ACTION) { strip.setPixelColor(6,50,50,50); } if(testip & BRAKES_ACTION) { strip.setPixelColor(5,0,50,50); } if(testip & SAS_ACTION) { strip.setPixelColor(4,50,0,50); } if(testip & RCS_ACTION) { strip.setPixelColor(3,50,50,0); } if(testip & LIGHT_ACTION) { strip.setPixelColor(2,0,0,50); } if(testip & GEAR_ACTION) { strip.setPixelColor(1,0,50,0); } if(testip & STAGE_ACTION) { strip.setPixelColor(0,50,0,0); } strip.show(); break; } } void clearpixels(){ for (int i = 0 ; i < 16; i++){ strip.setPixelColor(i,0,0,0); } } void updateDisplay(){ display.clearDisplay(); display.setCursor(0,0); display.print("Alt: "); display.println(displayAltitude); display.print("Aps: "); display.println(displayApsides); display.print("RAM: "); display.println(freeRam()); display.display(); } int freeRam () { extern int __heap_start, *__brkval; int v; return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); } Can anyone see something blindingly obvious that I'm doing stupidly (or rather, that would cause problems, no doubt there's lots of stupid stuff in there). Similarly if there is a better place to post queries please just shout TIA! Link to comment Share on other sites More sharing options...
stibbons Posted April 5, 2018 Author Share Posted April 5, 2018 Nope, this is probably the best place to ask. But not the best time, I'm currently in the middle of moving house. At first glance that looks like it's OK. I did see reports of similar stuff happening, which I think I've gotten a handle on. The only suggestion I think of is making sure you've got the most recent arduino library. Unfortunately the library manager isn't updating properly, which I need to figure out with the arduino folk. But you can get the most recent from https://bitbucket.org/pjhardy/kerbalsimpit-arduino/downloads/ Hopefully that will help. Link to comment Share on other sites More sharing options...
Oscar_Mike Posted April 7, 2018 Share Posted April 7, 2018 Ok - tried the latest library (I think) and it's still happening. Will do some more digging around - I know the 2812 needs pretty accurate timing, so i wonder if there's something crashing on a timer etc. Might try off-boarding the displays to another arduino through wire and see if that helps! Link to comment Share on other sites More sharing options...
Oscar_Mike Posted April 14, 2018 Share Posted April 14, 2018 Ok - tried the latest library (I think) and it's still happening. Will do some more digging around - I know the 2812 needs pretty accurate timing, so i wonder if there's something crashing on a timer etc. Might try off-boarding the displays to another arduino through wire and see if that helps! edit - tried running the LEDs from an encoder chip through i2c, same dealio. Link to comment Share on other sites More sharing options...
Codapop Posted May 3, 2018 Share Posted May 3, 2018 I'm having a hard time installing the mod. I can't seem to find out what to put into the game data folder. I believe I have all of the files downloaded in the zip file from the sources provided in the OP. Can someone please give me more information about what to put into the game data folder? Link to comment Share on other sites More sharing options...
stibbons Posted May 4, 2018 Author Share Posted May 4, 2018 This one was, again, a very small update, rebuilding for KSP 1.4.3. Should be available shortly. In related news, the Arduino Library Manager has once again started indexing my Arduino library properly. I've started work on a fairly major update, replacing the serial protocol for something that I'm hoping will be a lot more reliable. This will also include some minor but breaking changes in how smaller packets are handled. So look for a version 2.0 of everything in the next few weeks. 23 hours ago, Codapop said: I'm having a hard time installing the mod. I can't seem to find out what to put into the game data folder. I believe I have all of the files downloaded in the zip file from the sources provided in the OP. Can someone please give me more information about what to put into the game data folder? Please install using CKAN. I don't support manually installing the mod. Link to comment Share on other sites More sharing options...
Codapop Posted May 4, 2018 Share Posted May 4, 2018 (edited) I got it working manually, but I'll keep that in mind for the future, thanks! Is it possible to link up multiple Arduino microcontrollers to the same instance of KSP? Would this be as simple as editing the config file? I'm hoping to run one for inputs and one for outputs. EDIT: Also, do other resources work? Like if I install TAC Life Support, can the Simpit return values for amount of food? Or are those commands hard coded? Edited May 4, 2018 by Codapop Link to comment Share on other sites More sharing options...
stibbons Posted May 4, 2018 Author Share Posted May 4, 2018 7 hours ago, Codapop said: Is it possible to link up multiple Arduino microcontrollers to the same instance of KSP? Would this be as simple as editing the config file? Yes, and yes. 7 hours ago, Codapop said: Also, do other resources work? Like if I install TAC Life Support, can the Simpit return values for amount of food? Or are those commands hard coded? The current resource provider does hard code the resources it knows about. Somewhere on my todo list is a more generic option that will let the user specify what resource ID they want. But I haven't yet figured out a nice way to fit that in to the design. If you want to get your hands dirty writing your own KSP plugin, a new provider that interfaces with Kerbal Simpit and returns the resources you want shouldn't be too difficult. Link to comment Share on other sites More sharing options...
Codapop Posted May 6, 2018 Share Posted May 6, 2018 On 5/5/2018 at 6:23 AM, stibbons said: The current resource provider does hard code the resources it knows about. Somewhere on my todo list is a more generic option that will let the user specify what resource ID they want. But I haven't yet figured out a nice way to fit that in to the design. If you want to get your hands dirty writing your own KSP plugin, a new provider that interfaces with Kerbal Simpit and returns the resources you want shouldn't be too difficult. Unfortunately, I wouldn't have any idea where to start building something like that. I'm already holding on for dear life just trying to get my arduino code working with Simpit. Perhaps adding compatibility with some of the more popular mods that add resources (TAC, Near-Future, etc) by hard-coding them could suffice. Or requiring TAC Fuel Balancer, as it already displays fuel data of stock and mod fuels, and building the new version off of that. I have no idea what is possible nor what is easiest, though. In other news, I think the stage tutorial is broken. It works, but it doesn't work twice, so it stages once and then gets stuck (requiring a reset on the arduino). I think it has to do with the "buttonState" not getting reset to LOW, but my attempts to make it work perfectly are in vain. I was able to get it to work well enough by adding: buttonState = LOW; delay(1000); after the stage command in the same IF statement. This doesn't work like the space bar, since it will just stage every second if the button is held down, but it doesn't get stuck at least. If this was brought up previously, I apologize. I've only read through about half of this post's comments and hope to finish reading soon. Link to comment Share on other sites More sharing options...
stibbons Posted May 7, 2018 Author Share Posted May 7, 2018 (edited) 17 hours ago, Codapop said: Perhaps adding compatibility with some of the more popular mods that add resources (TAC, Near-Future, etc) by hard-coding them could suffice. Or requiring TAC Fuel Balancer, as it already displays fuel data of stock and mod fuels, and building the new version off of that. I have no idea what is possible nor what is easiest, though. I already rely on Alternate Resource Panel for resource fetching, which can indeed handle modded resources easily enough. The problem is how to expose that through Simpit. I'm wary of hardcoding non-stock resources, mostly because I worry it will be a never ending game of hide and seek. I don't yet know of a good, flexible, robust way to let a Simpit client request arbitrary resources though. It may come down to mapping resource IDs and channel IDs in the Simpit config file. 17 hours ago, Codapop said: In other news, I think the stage tutorial is broken. It works, but it doesn't work twice, so it stages once and then gets stuck (requiring a reset on the arduino). I think it has to do with the "buttonState" not getting reset to LOW, but my attempts to make it work perfectly are in vain. I was able to get it to work well enough by adding: buttonState = LOW; delay(1000); after the stage command in the same IF statement. This doesn't work like the space bar, since it will just stage every second if the button is held down, but it doesn't get stuck at least. I'll make some time to verify this today. But just to confirm, what does your hardware look like? It's intended to work with a momentary button, with a pulldown resistor, see the example on the Arduino debounce tutorial page: Pushing the button sends buttonState HIGH, and releasing it should set buttonState back to LOW. The sketch should also be turning the Arduino's built-in LED on while the button is held down. Edited May 7, 2018 by stibbons Link to comment Share on other sites More sharing options...
Codapop Posted May 10, 2018 Share Posted May 10, 2018 Ah, my circuit looked differently, which might have affected my results. I just had 5V going to the button going to the input pin. No ground. Link to comment Share on other sites More sharing options...
Codapop Posted May 30, 2018 Share Posted May 30, 2018 (edited) I could just be doing something wrong, but for some reason "while (!mySimpit.init()) {delay(100);}" doesn't work. It's in all of the examples, and I have it in all of my testing code, but it never connects to the Simpit on its own. I always have to push the reset button on the Arduino Mega. Is there a way to fix this? EDIT: Also I managed to get my potentiometer to control throttle, but there appears to be a noticeable delay of something like 300-500ms. Also, the throttle hits 0 when the pot is still at about 50%. Are these known issues or do I just have buggy gear? I'm using a Mega with a slide pot. Code is: Quote void loop() { int throttle = analogRead(2); int scaled_y_reading = map(throttle, 0, 1023, -32768, 32767); mySimpit.send(THROTTLE_MESSAGE, scaled_y_reading); delay(25); } Edited June 5, 2018 by Codapop Link to comment Share on other sites More sharing options...
cjohannsen Posted June 19, 2018 Share Posted June 19, 2018 (edited) Howdy all! First and foremost, Kerbal Simpit is amazing. But of course, I didn't have an Arduino around, so I decided to build an interface from my Raspberry Pi. Also, since it's my background and I've been doing for a long time, I wrote in Java as a Spring Boot application. https://github.com/cory-johannsen/rpi-simpit-java I have all the message channels flowing down from KSP to the Pi, and I have the message subscription and echo commands working. I'm about to begin implementing the upstream commands from the device, starting with staging. spring-boot makes it stupid easy to embed an application server, so I have REST endpoints coming together to trigger the separate actions. Once that's all working, I'll start in on the physical hardware interface. Ultimately I'll be designing a control console of some sort. Ok, to be perfectly honest, I had to buy an arduino so I could put the example sketches on it and then sniff the serial protocol to get the byte ordering correct. So technically, now I have that also. Update: I have GPIO functional and am triggering commands back to KSP! Edited June 21, 2018 by cjohannsen Link to comment Share on other sites More sharing options...
DerSpanischGamer Posted June 22, 2018 Share Posted June 22, 2018 (edited) On 5/30/2018 at 7:55 PM, Codapop said: I could just be doing something wrong, but for some reason "while (!mySimpit.init()) {delay(100);}" doesn't work. It's in all of the examples, and I have it in all of my testing code, but it never connects to the Simpit on its own. I always have to push the reset button on the Arduino Mega. Is there a way to fix this? EDIT: Also I managed to get my potentiometer to control throttle, but there appears to be a noticeable delay of something like 300-500ms. Also, the throttle hits 0 when the pot is still at about 50%. Are these known issues or do I just have buggy gear? I'm using a Mega with a slide pot. Code is: Hi, I was just wondering if you could share with me your whole code, as I'm only able to use the rotationMsg, I've tried translationMsg but I can't get it to work. Thanks ! EDIT: nvm I just got it working I just verified the files, I'd like tosay great work to the dev Edited June 22, 2018 by DerSpanischGamer Link to comment Share on other sites More sharing options...
stibbons Posted June 30, 2018 Author Share Posted June 30, 2018 (edited) Breaking my surprisingly long KSP hiatus for a little bit to kick things along for KSP 1.4.4. I've pushed a new release, no significant changes apart from a rebuild. Work on a 2.0 version that revamps the serial protocol is slow but... kinda steady. I do plan on spending some time this weekend tweaking the current Arduino library though, time and experience have given me a few ideas for improvement. On 6/19/2018 at 1:33 PM, cjohannsen said: But of course, I didn't have an Arduino around, so I decided to build an interface from my Raspberry Pi. Also, since it's my background and I've been doing for a long time, I wrote in Java as a Spring Boot application. Ahahaha, this is fantastic! Nice work. How are you doing the serial connection? Hooking in to the Pi's UART? ETA: @cjohannsen I've actually documented how the serial protocol works, at https://bitbucket.org/pjhardy/kerbalsimpit/wiki/PluginHacking.md . If there's still any gaps in how you understand it please do let me know and I'll be happy to fill you in. Edited June 30, 2018 by stibbons Link to comment Share on other sites More sharing options...
stibbons Posted June 30, 2018 Author Share Posted June 30, 2018 And, for a bonus, I've just pushed version 1.1.5 of the Kerbal Sim Pit Arduino library. Not a lot in here, but it fixes some dumb bugs and hopefully will make the library a lot more stable for busier controllers now. Link to comment Share on other sites More sharing options...
WestCoastJedi Posted September 23, 2018 Share Posted September 23, 2018 I am looking to start my own KSP controller. have purchased an Elegoo MEGA2560 R3 and Keyestudio Leonardo mini controllers to work with and a couple buttons and slider for throttle. first tried using KSPserialIO mod, but couldnt get it to work. after doing some research i landed on this mod and want to try luck with this one. I noticed it is not currently on CKAN, where can i find it? will it be on CKAN soon? do you have suggestions on how to get started and a way to ensure it is actually loaded correctly and communicating with my mini controllers? any help you can provide is greatly appreciated! Link to comment Share on other sites More sharing options...
Codapop Posted September 25, 2018 Share Posted September 25, 2018 (edited) Does ACTIONSTATUS_MESSAGE work for AG1-10 and CAG's too? Or does it only work for the standard AG's? EDIT: Also I've come across a problem using the Arduino Due and Simpit. The Due has two serial ports, programming and native. Programming port is like the normal Arduino port, and the Native port has extra features. I would greatly prefer to use the native port, as the rest of my project relies on those extra features. This requires me to use "SerialUSB" instead of "Serial". Normally this isn't a problem, but it doesn't seem to work at all in the mod. I've tried running the HelloWorld script with both ports, making sure to edit the settings.cfg in the process. I get the handshake with the programming port using "Serial" but not with the native port using either "Serial" nor "SerialUSB". Is there a possible fix for this? EDIT 1.5: I've managed to open the Arduino library files as well as the .dll in a hex editor. I see a lot of mentions of "Serial" but probably too many for me to guess at what to change. I'll try to edit the ones in the Arduino library one by one and see if that will fix it, but if you have any other ideas I'd be happy to try them out. EDIT 2: Can Simpit be used with the Outer Planets Mod? Like can it tell which body the vessel is orbiting? Edited October 13, 2018 by Codapop Link to comment Share on other sites More sharing options...
Codapop Posted September 29, 2018 Share Posted September 29, 2018 On 9/24/2018 at 5:53 AM, WestCoastJedi said: I am looking to start my own KSP controller. have purchased an Elegoo MEGA2560 R3 and Keyestudio Leonardo mini controllers to work with and a couple buttons and slider for throttle. first tried using KSPserialIO mod, but couldnt get it to work. after doing some research i landed on this mod and want to try luck with this one. I noticed it is not currently on CKAN, where can i find it? will it be on CKAN soon? do you have suggestions on how to get started and a way to ensure it is actually loaded correctly and communicating with my mini controllers? any help you can provide is greatly appreciated! Since this thread isn't checked very often, I can try to give some input, but I'm only a bit more into it than you are. You can get the mod from the github site. I don't use CKAN yet, as I'm just testing with a few mods, so github is fine for me and should work for you. The best bet for testing is to simply use the example scripts. They aren't comprehensive (like personally I still have a lot of trouble with the messages functions as they aren't really explained in detail) but you can usually get what you need through copying parts of the example code and then changing a few things or expanding upon them. The best script for testing the connection is the HelloWorld script, as it will turn your built in LED off when it connects. If you're having trouble with that, then you need to change the settings.cfg file and make sure you're on the correct port. Link to comment Share on other sites More sharing options...
stibbons Posted October 21, 2018 Author Share Posted October 21, 2018 On 9/24/2018 at 7:53 AM, WestCoastJedi said: I noticed it is not currently on CKAN, where can i find it? will it be on CKAN soon? Apologies, it is on CKAN, but travel and some other commitments over the last couple of months meant the latest release was marked for KSP 1.4.4. I've just pushed an update for KSP 1.5.1, CKAN will have it shortly. On 9/25/2018 at 10:30 PM, Codapop said: Does ACTIONSTATUS_MESSAGE work for AG1-10 and CAG's too? Or does it only work for the standard AG's? ACTIONSTATUS_MESSAGE only works for regular action groups - see the documentation for what it supports. Currently the plugin does not send the status of regular action groups. But it makes sense to also be able to subscribe to custom action group notifications. I'll add that to the backlog (and I promise I'll actually do some work on the backlog soon). On 9/25/2018 at 10:30 PM, Codapop said: The Due has two serial ports, programming and native. Programming port is like the normal Arduino port, and the Native port has extra features. I would greatly prefer to use the native port, as the rest of my project relies on those extra features. This requires me to use "SerialUSB" instead of "Serial". Odd. I've tested the Arduino library with multiple hardware serial ports on an Arduino Mega and Leonardo boards. And I've tested it works with SoftwareSerial. But haven't tried it with the Due. I don't yet have an answer, but will look in to it. On 9/25/2018 at 10:30 PM, Codapop said: EDIT 2: Can Simpit be used with the Outer Planets Mod? Like can it tell which body the vessel is orbiting? I haven't personally tested it, but it should be getting the correct names for all non-stock planets, yes. Link to comment Share on other sites More sharing options...
Codapop Posted October 24, 2018 Share Posted October 24, 2018 (edited) Though Simpit doesn't receive all of the orbital data, a lot of useful info can be deduced from the data it gets as well as the info from the Wiki. You can extrapolate the following: mu = GM (G = gravitational constant, M = planet mass) SEMIMAJORAXIS { a = (r1 + r2)/2 r1 = APOAPSIS + BODY RADIUS r2 = PERIAPSIS + BODY RADIUS } HORIZONTAL SURFACE VELOCITY { sqrt(sV^2 - vV^2) sV = SURFACE VELOCITY vV = VERTICAL VELOCITY } HORIZONTAL ORBITAL VELOCITY { sqrt(oV^2 - vV^2) oV = ORBITAL VELOCITY vV = VERTICAL VELOCITY } TIME PERIOD OF ORBIT { T = 2pi*sqrt(a^3/GM) a = SEMIMAJORAXIS G = GRAVITATIONAL CONSTANT M = MASS OF PLANET } IMPACT VELOCITY { V = sqrt(2mu/(r+(H-Hs))-(mu/a)) mu = GRAVITATIONAL CONSTANT (GM) r = BODY RADIUS H = ALTUTUDE (SEA) Hs = ALTITUDE (SRF) a = SEMIMAJORAXIS } ROTATIONAL VELOCITY { HV = sa/r s = PLANET ROTATION SPEED a = Orbit Alt r = BODY RADIUS } ROUGH UNSIGNED INCLINATION { I = ARCCOS(((A^2)+(C^2)-(B^2))/(2AC)) a = HORIZONTAL ORBITAL VELOCITY b = HORIZONTAL SURFACE VELOCITY c = ROTATIONAL VELOCITY } Rough inclination is an interesting one, as it uses some really hack-ey math. It can tell you the rough inclination of the orbit, but it cannot tell you if it is North or South. This will produce a value between 0-180 that will oscillate. It will reach maximum at the equator (AN/DN) and will be accurate at the equator. Elsewhere it will be as much as 10% low. As far as I can tell, this is the absolute best inclination reading you can get with this mod. You could potentially take samples at intervals (say, each second) and get a perfect reading, but that's beyond me. You could also write some code to only show the maximum (the most accurate) and only seek a new maximum when the SMA changes. This kind of messy code could also get you the AN/DN (by taking the time when the Inclination reading is maximum and then taking the Period and dividing by 2.) Calculate T at Impact { T = t1 + t2 + t3 } Time to Impact is one that I never personally got working, but it's an attempt to solve some complicated math with a close approximation. t1, t2, and t3 are simple time to impact equations at varying altitudes, each one for a different gravity to account for the change in gravity at higher altitudes. It breaks up the distance into 3 parts and calculates them separately and then adds together the pieces. It should be accurate within a few seconds at least. Here's the relevant data from the wiki. This can be dropped into your arduino project as a list, and just add commas and the necessary syntax. Eeloo data is for the OPM mod and may not be the same as for stock KSP. Body Data Chart Body | Radius | mu | Rotation Speed Kerbol 261600000 1.1723328×10^18 3804.8 Moho 250000 1.6860938×10^11 1.2982 Eve 700000 8.1717302×10^12 54.636 Gilly 13000 8289449.8 2.8909 Kerbin 600000 3.5316000×10^12 174.94 Mun 200000 6.5138398×10^10 9.0416 Minmus 60000 1.7658000×10^9 9.3315 Duna 320000 3.0136321×10^11 30.688 Ike 130000 1.8568369×10^10 12.467 Dres 138000 2.1484489×10^10 24.916 Jool 6000000 2.8252800×10^14 1047.2 Laythe 500000 1.9620000×10^12 59.297 Vall 300000 2.0748150×10^11 17.789 Tylo 600000 2.8252800×10^12 17.789 Bop 65000 2.4868349×10^9 0.75005 Pol 44000 7.2170208×10^8 0.30653 Sarnus 5300000 8.2089702×10^13 1168.5 Hale 6000 811990.62 1.6005 Ovok 26000 13258591 5.5490 Eeloo 210000 7.4410815×10^10 22.783 Slate 540000 1.9788564×10^12 17.601 Tekto 280000 1.9244099×10^11 2.6410 Urlum 2177000 1.1944574×10^13 333.62 Polta 220000 9.0181953×10^10 18.931 Priax 74000 3.3831766×10^9 6.3678 Wal 370000 4.9673624×10^11 2.3031 Tal 22000 2.1358884×10^8 2.8283 Neidon 2145000 1.4167882×10^13 334.84 Thatmo 286000 1.8609758×10^11 5.8640 Nissee 30000 3.9716933×10^8 6.7501 Plock 189000 5.1844895×10^10 11.170 Edited October 24, 2018 by Codapop Link to comment Share on other sites More sharing options...
TrainWreck Posted November 8, 2018 Share Posted November 8, 2018 Hello, Are there any plans to include the SAS headings as controllable items (e.g. hold prograde, hold retrograde, etc.)? I looked through the docs and it doesn't look like this is available currently. Are you open to accepting pull requests if you don't have the time to put in anymore? Link to comment Share on other sites More sharing options...
Recommended Posts