Jump to content

ljkjl

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by ljkjl

  1. 12 hours ago, zitronen said:

    A basic aircraft autopilot that flies to way points is possible. For launch you don't really need prograde vector. A simple pitch vs altitude map and throttle based on time to AP could be enough for some rockets.

    And for launch auto that’s exactly what I wanted to do. About the aircraft auto: that’s a great idea! I’m definitely going to add it.

  2. 6 hours ago, Freshmeat said:

    Cool start, what are the plans.

    The plans are three 128x64 glcd’s at the top (flight data, resources, status), some warning lights, RCS, SAS (with mode selection as well), lights/gear/brakes, a buzzer alarm, throttle, controls for both rotation and traslation via joystick potentiometer, action groups and, hopefully, some kind of launch autopilot (mechjeb style). All was to be done with a Mega, until i discovered the Due (exactly two hours ago :D). If that turns out to be still not enough i’ll try to use a RasPi 3, if it is possible. 

    Now the box (50x40x15 cm) is done, i still have to do all the wiring and write the program. 

  3. Okay. Windows 8.1 64bit, KSP 1.3 in 64bit mode (also tried in 32bit mode, nothing different), plugin version 0.19.0. I also have KerbalEngineer installed.

     

    Here's the log:

    [LOG 11:03:29.314] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
    [LOG 11:03:29.316] KSPSerialIO: Version 0.19.0
    [LOG 11:03:29.316] KSPSerialIO: Getting serial ports...
    [LOG 11:03:29.317] KSPSerialIO: Output packet size: 200/255
    [LOG 11:03:29.320] KSPSerialIO: Found 2 serial ports
    [LOG 11:03:29.320] KSPSerialIO: trying default port 
    [LOG 11:03:29.321] Error opening serial port : Object reference not set to an instance of an object
    [LOG 11:03:29.323] KSPSerialIO: trying port \Device\USBSER000 - COM9
    [LOG 11:03:30.845] KSPSerialIO: KSP Display not found
    [LOG 11:03:30.848] [AddonLoader]: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'
    [LOG 11:03:30.856] [AddonLoader]: Instantiating addon 'FlightAppLauncher' from assembly 'KerbalEngineer'
    [LOG 11:03:30.885] [AddonLoader]: Instantiating addon 'DisplayStack' from assembly 'KerbalEngineer'
    [LOG 11:03:30.912] [AddonLoader]: Instantiating addon 'FlightEngineerCore' from assembly 'KerbalEngineer'
    [LOG 11:03:30.917] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
    [LOG 11:03:30.918] KSPSerialIO: Version 0.19.0
    [LOG 11:03:30.918] KSPSerialIO: Getting serial ports...
    [LOG 11:03:30.919] KSPSerialIO: Output packet size: 200/255
    [LOG 11:03:30.919] KSPSerialIO: Found 2 serial ports
    [LOG 11:03:30.920] KSPSerialIO: trying default port 
    [LOG 11:03:30.921] Error opening serial port : Object reference not set to an instance of an object
    [LOG 11:03:30.922] KSPSerialIO: trying port \Device\USBSER000 - COM9
    [LOG 11:03:32.426] KSPSerialIO: KSP Display not found
    [LOG 11:03:32.428] [AddonLoader]: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'
    [LOG 11:03:32.432] [PlanetariumCamera]: Focus: Kerbin

  4. Hello everyone! I've been trying to use this plugin with an Arduino UNO but it wouldn't work. I loaded @zitronen's "Warning LEDs" example with the same setup he used, except for an additional LED to signal whether or not rx_len is equal to 0 (it always is, thus the BoardReceive function won't read anything). I suspect this is because KSP won't transmit any data since the plugin, upon spawning on the launchpad, says  "No display found", and in the plugin sourcecode (game side) i've seen that in order for the Begin(); function to be called, a display has to be found. My question is, what do you mean by display, and what could i do to add one?

    Here is the Arduino sourcecode (only the one i modified, the rest is identical to the example):

    uint8_t rx_len;
    uint8_t * address;
    byte buffer[256]; //address for temporary storage and parsing buffer
    uint8_t structSize;
    uint8_t rx_array_inx;  //index for RX parsing buffer
    uint8_t calc_CS;	   //calculated Chacksum
    
    //This excrements contains stuff borrowed from EasyTransfer lib
    boolean KSPBoardReceiveData() {
    
      //THIS IS THE ONLY PART I ADDED
      if(rx_len==0)
        digitalWrite(12, HIGH);
      else
        digitalWrite(12, LOW);
        
      if ((rx_len == 0)&&(Serial.available()>3)){
        while(Serial.read()!= 0xBE) {
          if (Serial.available() == 0)
            return false;  
        }
        if (Serial.read() == 0xEF){
          rx_len = Serial.read();   
          id = Serial.read(); 
          rx_array_inx = 1;
    
          switch(id) {
          case 0:
            structSize = sizeof(HPacket);   
            address = (byte*)&HPacket;     
            break;
          case 1:
            structSize = sizeof(VData);   
            address = (byte*)&VData;     
            break;
          }
        }
    
        //make sure the binary structs on both Arduinos are the same size.
        if(rx_len != structSize){
          rx_len = 0;
          return false;
        }   
      }
    
      if(rx_len != 0){
        while((Serial.available()) && (rx_array_inx <= rx_len)){
          buffer[rx_array_inx++] = Serial.read();
        }
        buffer[0] = id;
    
        if(rx_len == (rx_array_inx-1)){
          //seem to have got whole message
          //last uint8_t is CS
          calc_CS = rx_len;
          for (int i = 0; i<rx_len; i++){
            calc_CS^=buffer[i];
          } 
    
          if(calc_CS == buffer[rx_array_inx-1]){//CS good
            memcpy(address,buffer,structSize);
            rx_len = 0;
            rx_array_inx = 1;
            return true;
          }
          else{
            //failed checksum, need to clear this out anyway
            rx_len = 0;
            rx_array_inx = 1;
            return false;
          }
        }
      }
    
      return false;
    }

    P.S. This is the first time i use serial communication, so that "BoardReceive won't read" is almost a guess.

    Thanks in advance for your answer!

×
×
  • Create New...