funkheld
Members-
Posts
53 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by funkheld
-
KRPC.MechJeb not funktion.
funkheld replied to funkheld's topic in KSP1 Technical Support (PC, modded installs)
yes i have pip install. ------------------------------- Did you use pip install krpc to install it? ? _____________________ greetin g -
hello, good day. all other programs with krpc 0.48 is ok. I have ksp 1.6.1 and python 2.7. this not funktion: LaunchIntoOrbit.py - Mechjeb2 installiert - Copy KRPC.MechJeb.dll to Kerbal Space Program/GameData/kRPC directory. errormeldung: ------------------------------------------------------ f:\python27>python.exe f:\python27\pebi-py\LaunchIntoOrbit.py Traceback (most recent call last): File "f:\python27\pebi-py\LaunchIntoOrbit.py", line 9, in <module> ascent = mj.ascent_autopilot File "<string>", line 1, in <lambda> File "f:\python27\lib\site-packages\krpc\client.py", line 163, in _invoke raise self._build_error(response.results[0].error) krpc.types.MJServiceException: Exception has been thrown by the target of an invocation.: Non-static field requires a target Server stack trace: at KRPC.MechJeb.ExtensionMethods.TypeExtensions.CreateInstance[AscentAutopilot] (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0 at KRPC.MechJeb.MechJeb.GetComputerModule[AscentAutopilot] (System.Object[] modules, Int32 id, System.Object[] args) [0x00000] in <filename unknown>:0 at KRPC.MechJeb.MechJeb.GetComputerModule[AscentAutopilot] (System.Object[] modules, Int32 id) [0x00000] in <filename unknown>:0 at KRPC.MechJeb.MechJeb.get_AscentAutopilot () [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 ---------------------------------------------- mport krpc conn = krpc.connect(name='test', address='127.0.0.1', rpc_port=1000, stream_port=1001) sc = conn.space_center mj = conn.mech_jeb ascent = mj.ascent_autopilot #All of these options will be filled directly into Ascent Guidance window and can be modified manually during flight. ascent.desired_orbit_altitude = 100000 ascent.desired_inclination = 6 ascent.force_roll = True ascent.vertical_roll = 90 ascent.turn_roll = 90 ascent.autostage = True ascent.enabled = True sc.active_vessel.control.activate_next_stage() #launch the vessel with conn.stream(getattr, ascent, "enabled") as enabled: enabled.rate = 1 #we don't need a high throughput rate, 1 second is more than enough with enabled.condition: while enabled(): enabled.wait() print("Launch complete!") conn.close() thanks greeting.
-
Hi good afternoon. have now this krpc with the arduino mega2560 driven. I can do the control with the keypad throttle +- and stage. this is just a test. you can move much more with the mega2560. on the mega2560 I have serial2 usb-ttl) to the pc (python-krpc) and the data output (data_velo, data_alti, data_apoa) I do about the serial port of the mega2560 with what you previously synonymous program transmits. the data can be later synonymous to a lcd display output, which is connected to the mega2560. the throttle and stage control also works with one bluetooth module hc-05 at the mega2560 and a table. I wrote program android with B4A. greeting Code for Python 2.7 : import time import krpc import serial conn = krpc.connect(name='Sub-orbital flight', address='127.0.0.1', rpc_port=1000, stream_port=1001) vessel = conn.space_center.active_vessel ref_frame = conn.space_center.ReferenceFrame.create_hybrid( position=vessel.orbit.body.reference_frame, rotation=vessel.surface_reference_frame) time.sleep(1) port = "com6" ser = serial.Serial(port, 9600, timeout=0) def throttle_func(par): vessel.control.throttle = float(par) return def stage_func(): vessel.control.activate_next_stage() return t=0 data_alti=0 data_velo=0 data_apoa=0 while True: time.sleep(0.1) s = ser.readline() if s == '1': t=t+0.1 throttle_func(t) if s == '2': t=t-0.1 throttle_func(t) if s == '3': stage_func() data_velo=round(vessel.flight(ref_frame).speed) data_alti =round(vessel.flight().mean_altitude) data_apoa =round(vessel.orbit.apoapsis_altitude) ser.write(str(data_velo)+':'+str(data_alti)+':'+str(data_apoa)+'\n\r') con.close() conn.close() Code for Arduino Mega2560 mit Keypad: #include <Keypad.h> const byte numRows= 4; const byte numCols= 4; char keymap[numRows][numCols]= { {'0', '4', '8', 'C'}, {'1', '5', '9', 'D'}, {'2', '6', 'A', 'E'}, {'3', '7', 'B', 'F'} }; byte rowPins[numRows] = {53,51,49,47}; //Rows 0 to 3 byte colPins[numCols]= {45,43,41,39}; //Columns 0 to 3 byte inbyte; byte throttle_p; byte throttle_m; byte stage; Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols); void setup() { Serial2.begin(9600); Serial.begin(9600); throttle_p=1; throttle_m=2; stage=3; } void loop() { char keypressed = myKeypad.getKey(); if (Serial2.available()){ inbyte = Serial2.read(); Serial.write(inbyte); } if (keypressed =='0') { Serial2.print(throttle_p); } if (keypressed =='1') { Serial2.print(throttle_m); } if (keypressed =='2') { Serial2.print(stage); } } Code for Arduino Mega2560 mit hc-05: byte inbyte; byte throttle_p; byte throttle_m; byte stage; void setup() { Serial1.begin(9600); Serial2.begin(9600); Serial.begin(9600); throttle_p=1; throttle_m=2; stage=3; } void loop() { if (Serial2.available()) { inbyte = Serial2.read(); Serial.write(inbyte); } if (Serial1.available()) { inbyte = Serial1.read(); if(inbyte == 50) { Serial2.print(throttle_p); } if(inbyte == 51) { Serial2.print(throttle_m); } if(inbyte == 52) { Serial2.print(stage); } } }
-
Hi good afternoon. throttle = map(pitchRead, 0, 1023, 0, 32767); what does this table mean? I want to set the trottle with it. it does not work. the word of A0 is 23-1017. greeting
-
- hello good day. the errormeldung from : KerbalSimpitHelloWorld. Greeting ---------------------------------------------------------------------------------------------------- Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)" C:\Users\pebi\Documents\Arduino\libraries\kerbalsimpit-arduino\examples\KerbalSimpitHelloWorld\KerbalSimpitHelloWorld.ino: In function 'void loop()': KerbalSimpitHelloWorld:51: error: invalid conversion from 'const char*' to 'byte* {aka unsigned char*}' [-fpermissive] mySimpit.send(ECHO_REQ_MESSAGE, "low", 4); ^ In file included from C:\Users\pebi\Documents\Arduino\libraries\kerbalsimpit-arduino\examples\KerbalSimpitHelloWorld\KerbalSimpitHelloWorld.ino:11:0: C:\Users\pebi\Documents\Arduino\libraries\kerbalsimpit-arduino\src/KerbalSimpit.h:72:8: error: initializing argument 2 of 'void KerbalSimpit::send(byte, byte*, byte)' [-fpermissive] void send(byte messageType, byte msg[], byte msgSize); ^ KerbalSimpitHelloWorld:53: error: invalid conversion from 'const char*' to 'byte* {aka unsigned char*}' [-fpermissive] mySimpit.send(ECHO_REQ_MESSAGE, "high", 5); ^ In file included from C:\Users\pebi\Documents\Arduino\libraries\kerbalsimpit-arduino\examples\KerbalSimpitHelloWorld\KerbalSimpitHelloWorld.ino:11:0: C:\Users\pebi\Documents\Arduino\libraries\kerbalsimpit-arduino\src/KerbalSimpit.h:72:8: error: initializing argument 2 of 'void KerbalSimpit::send(byte, byte*, byte)' [-fpermissive] void send(byte messageType, byte msg[], byte msgSize); ^ C:\Users\pebi\Documents\Arduino\libraries\kerbalsimpit-arduino\examples\KerbalSimpitHelloWorld\KerbalSimpitHelloWorld.ino: In function 'void messageHandler(byte, byte*, byte)': KerbalSimpitHelloWorld:70: error: invalid conversion from 'byte* {aka unsigned char*}' to 'const char*' [-fpermissive] if (strcmp(msg, "low")) { ^ In file included from F:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:25:0, from sketch\KerbalSimpitHelloWorld.ino.cpp:1: f:\arduino\hardware\tools\avr\avr\include\string.h:125:12: error: initializing argument 1 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp(const char *, const char *) __ATTR_PURE__; ^ exit status 1 invalid conversion from 'const char*' to 'byte* {aka unsigned char*}' [-fpermissive] --------------------------------------------------------------------------------------------- Dieser Bericht wäre detaillierter, wenn die Option "Ausführliche Ausgabe während der Kompilierung" in Datei -> Voreinstellungen aktiviert wäre. Hi good afternoon. this command is different than in the description. KerbalSimpitAltitudeTrigger.ino : void messageHandler(byte messageType, byte msg[], byte msgSize) { switch(messageType) { case ALTITUDE_MESSAGE: ........ https://kerbalsimpit-arduino.readthedocs.io/en/stable/quickstart.html void myCallbackHandler(byte messageType, byte mesesage[], byte messageSize) { switch(messageType) { case ALTITUDE_MESSAGE: Greeting
-
[KSP 1.12.x] kOS v1.4.0.0: kOS Scriptable Autopilot System
funkheld replied to Dunbaratu's topic in KSP1 Mod Releases
I wanted a command from tcp to kos in a loop and work off in the loop ------------------------------ until false { ......I wanted a command from tcp to kos in a loop and work off in the loop } greeting- 1,361 replies
-
- autopilot
- programming
-
(and 1 more)
Tagged with:
-
[KSP 1.12.x] kOS v1.4.0.0: kOS Scriptable Autopilot System
funkheld replied to Dunbaratu's topic in KSP1 Mod Releases
how can you please receive data in one until please ? LOCK THROTTLE TO 1.0. WHEN MAXTHRUST = 0 THEN { STAGE. PRESERVE. }. LOCK STEERING TO UP. UNTIL SHIP:ALTITUDE > 9000 { PRINT "Altitude :". PRINT ROUND(SHIP:ALTITUDE,0). PRINT "Apoapsis:". PRINT ROUND(SHIP:APOAPSIS,0). PRINT "Periapsis:". PRINT ROUND(SHIP:PERIAPSIS,0). PRINT "Velocity:". PRINT ROUND(SHIP:VELOCITY:SURFACE:MAG,1). WAIT 0.1. ......how can you please receive data in one until? }. LOCK THROTTLE TO 0. SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. greeting.- 1,361 replies
-
- autopilot
- programming
-
(and 1 more)
Tagged with:
-
LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. WHEN MAXTHRUST = 0 THEN { STAGE. PRESERVE. }. LOCK STEERING TO UP. UNTIL SHIP:ALTITUDE > 9000 { PRINT "Altitude :". PRINT ROUND(SHIP:ALTITUDE,0). PRINT "Apoapsis:". PRINT ROUND(SHIP:APOAPSIS,0). PRINT "Periapsis:". PRINT ROUND(SHIP:PERIAPSIS,0). PRINT "Velocity:". PRINT ROUND(SHIP:VELOCITY:SURFACE:MAG,1). WAIT 0.5. .....with which command from kos can you please receive data which .......Send here with TCP for koS }. LOCK THROTTLE TO 0. SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. Data received from the tcp in untilschleife for kOS ? LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. WHEN MAXTHRUST = 0 THEN { STAGE. PRESERVE. }. LOCK STEERING TO UP. UNTIL SHIP:ALTITUDE > 9000 { PRINT "Altitude :". PRINT ROUND(SHIP:ALTITUDE,0). PRINT "Apoapsis:". PRINT ROUND(SHIP:APOAPSIS,0). PRINT "Periapsis:". PRINT ROUND(SHIP:PERIAPSIS,0). PRINT "Velocity:". PRINT ROUND(SHIP:VELOCITY:SURFACE:MAG,1). WAIT 0.1. ........Data received from the tcp in untilschleife ??? }. LOCK THROTTLE TO 0. SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. greeting
-
Hi good afternoon. how can you send this data directly to the server-krpc with a client? start this python program : ------------------------------------------------- import time import krpc conn = krpc.connect(name='Sub-orbital flight', address='127.0.0.1', rpc_port=1000, stream_port=1001) vessel = conn.space_center.active_vessel ref_frame = conn.space_center.ReferenceFrame.create_hybrid( position=vessel.orbit.body.reference_frame, rotation=vessel.surface_reference_frame) time.sleep(1) while True: data =' ' time.sleep(0.1) conn.close() --------------------------------------------------- then whis one client to send : vessel.control.activate_next_stage () Thank you. greeting
-
For kOS, I used to write my own TCP client with Purebasic. Can receive / send all data and also start scripts (ks). Can I then graph the data itself or write the data into a file nr: 64 https://www.kerbalspaceprogram.de/index.php?thread/4173-diskussion-fragen-actiongroups-smartparts-verticalvelocity-und-co/&pageNo=4 greeting
-
I would like to create a connection to kos with a tcp program from purebasic please. Now I would like to know please, what does the datnstron of kos and through which data order the space data held together can be sent? in which period do I have to send data to kos with the tcp so kos the connection does not interrupt? Thank you. Greeting i'm old german.
-
Hello, good day For me this WarningBoardCode works on my i2c-lcd-display 20x4 with KSPSerialIO_019_0. greeting #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h> #define I2C_ADDR 0x27 #define BACKLIGHT_PIN 3 #define En_pin 2 #define Rw_pin 1 #define Rs_pin 0 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7 //macro #define details(name) (uint8_t*)&name,sizeof(name) //if no message received from KSP for more than 2s, go idle #define IDLETIMER 2000 #define CONTROLREFRESH 25 unsigned long deadtime, deadtimeOld, controlTime, controlTimeOld; unsigned long now; boolean Connected = false; byte caution = 0, warning = 0, id; struct VesselData { byte id; //1 float AP; //2 float PE; //3 float SemiMajorAxis; //4 float SemiMinorAxis; //5 float VVI; //6 float e; //7 float inc; //8 float G; //9 long TAp; //10 long TPe; //11 float TrueAnomaly; //12 float Density; //13 long period; //14 float RAlt; //15 float Alt; //16 float Vsurf; //17 float Lat; //18 float Lon; //19 float LiquidFuelTot; //20 float LiquidFuel; //21 float OxidizerTot; //22 float Oxidizer; //23 float EChargeTot; //24 float ECharge; //25 float MonoPropTot; //26 float MonoProp; //27 float IntakeAirTot; //28 float IntakeAir; //29 float SolidFuelTot; //30 float SolidFuel; //31 float XenonGasTot; //32 float XenonGas; //33 float LiquidFuelTotS; //34 float LiquidFuelS; //35 float OxidizerTotS; //36 float OxidizerS; //37 uint32_t MissionTime; //38 float deltaTime; //39 float VOrbit; //40 uint32_t MNTime; //41 float MNDeltaV; //42 float Pitch; //43 float Roll; //44 float Heading; //45 uint16_t ActionGroups; //46 status bit order:SAS, RCS, Light, Gear, Brakes, Abort, Custom01 - 10 byte SOINumber; //47 SOI Number (decimal format: sun-planet-moon e.g. 130 = kerbin, 131 = mun) byte MaxOverHeat; //48 Max part overheat (% percent) float MachNumber; //49 float IAS; //50 Indicated Air Speed byte CurrentStage; //51 Current stage number byte TotalStage; //52 TotalNumber of stages float TargetDist; //53 Distance to targeted vessel (m) float TargetV; //54 Target vessel relative velocity byte NavballSASMode; //55 Combined byte for navball target mode and SAS mode // First four bits indicate AutoPilot mode: // 0 SAS is off //1 = Regular Stability Assist //2 = Prograde // 3 = RetroGrade //4 = Normal //5 = Antinormal //6 = Radial In // 7 = Radial Out //8 = Target //9 = Anti-Target //10 = Maneuver node // Last 4 bits set navball mode. (0=ignore,1=ORBIT,2=SURFACE,3=TARGET) }; struct HandShakePacket { byte id; byte M1; byte M2; byte M3; }; /*struct ControlPacket { byte id; byte MainControls; //SAS RCS Lights Gear Brakes Precision Abort Stage byte Mode; //0 = stage, 1 = docking, 2 = map unsigned int ControlGroup; //control groups 1-10 in 2 bytes byte NavballSASMode; //AutoPilot mode byte AdditionalControlByte1; int Pitch; //-1000 -> 1000 int Roll; //-1000 -> 1000 int Yaw; //-1000 -> 1000 int TX; //-1000 -> 1000 int TY; //-1000 -> 1000 int TZ; //-1000 -> 1000 int WheelSteer; //-1000 -> 1000 int Throttle; // 0 -> 1000 int WheelThrottle; // 0 -> 1000 }; */ LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); int time = 0; HandShakePacket HPacket; VesselData VData; //ControlPacket CPacket; void setup() { Serial.begin(38400); Wire.begin(); InitTxPackets(); lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home (); lcd.begin(20, 4); lcd.clear(); delay(200); lcd.setCursor(0,3); lcd.print("V:"); } void loop() { input(); if (time==50) { lcd.setCursor(8,3); lcd.print(VData.Alt); lcd.print(" m/s "); time=0; } time++; }
-
FOR ROCKET USE ONLY: A Kerbal Simpit Build Log
funkheld replied to ohMorrissey's topic in KSP1 Mod Development
Hi good afternoon. How come the control data from the arduino over the serial interface to the kerbal program? How can you install this in KSPIODemo16? Thank you. greeting- 20 replies
-
- external controller
- add-on
-
(and 3 more)
Tagged with:
-
Hi good afternoon. With an arduino leonardo, I redirect the serial data back to the pc and display it graphically. Furthermore you can display the data on the arduino with an lcd.display or led. greeting https://www.kerbalspaceprogram.de/index.php?thread/4040-daten-mit-ksp-serial-io-0-18-7-vom-arduino-zum-pc-zurück/