Jump to content

sashan

Members
  • Posts

    1,004
  • Joined

  • Last visited

Everything posted by sashan

  1. Yes, I've thought about that. However, I believe they do lose thrust a lot before that. Not just get disabled out of sudden.
  2. Would it be possible to add raycasting? I really need to detect stuff I'm trying to land on - it will not always be terrain. It's also useful for some other things.
  3. Hey, is there a way to get specific impulse for an engine that is not active? I need to calculate dV and TWR that separatron would give me in current situation.
  4. There are 2 instances when it happens: 1. When I run Py script by double-clicking it. Happens all the time, and those processes do consume CPU time. 2. It occasionally happens when I terminate any program. For example, that PID one I've posted. Instead of stating an error it just hangs and does nothing.
  5. I have written a PID loop class in Python. It works well for holding altitude, still need to test it with attitude control. Here it is, with the full program for simple simulation of Grasshopper test. Attitude control is manual. Just build a rocket that can hover, has landing legs and RCS. Put it on the pad, launch script. It will ascend slowly for 10 seconds, then hover, then descend. Manually kill the script after landing. If the rocket pointed roughly up it should do fine, otherwise do some small adjustments. import krpc import math import time class PIDregulator: def __init__(self,kp,ki,kd,minout,maxout,target,state,nowtime,prevtime=0,prevstate=0,midpoint=0): self.kp = kp self.ki = ki self.kd = kd self.target = target #target setpoint self.state = state #current state self.minout = minout #minimal needed output self.maxout = maxout #maximal needed output self.nowtime = nowtime #current time, time.time() works when KSP is running at close to realtime self.prevtime = prevtime self.prevstate = prevstate self.midpoint = midpoint #optional: expected set point, e.g. 1/TWR for throttle control self.I_term = 0 self.preverror = 0 self.prevtarget = 0 self.prevtime = nowtime def __enter__(self): return self def update(self,state,target,nowtime,midpoint=0): self.state = state self.target = target self.nowtime = nowtime self.error = (self.target - self.state) self.dt=(self.nowtime - self.prevtime) self.midpoint = midpoint # PID regulator self.P_term = self.error*self.kp self.I_term = self.I_term + self.error*self.dt*self.ki #limit I term if self.I_term>self.maxout: self.I_term = self.maxout elif self.I_term<self.minout: self.I_term = self.minout self.D_term = -(self.error-self.preverror)/self.dt*self.kd self.output = self.midpoint + self.P_term + self.I_term + self.D_term print(self.P_term, self.I_term, self.D_term) return self.output self.prevtime = nowtime self.prevtarget = target self.preverror = error conn = krpc.connect(name='Grasshopper') vessel = conn.space_center.active_vessel alt_kP = 0.3 alt_kI = 0.1 alt_kD = 0.0 ref_frame = conn.space_center.ReferenceFrame.create_hybrid( position=vessel.orbit.body.reference_frame, rotation=vessel.surface_reference_frame) conn.drawing.add_direction((0, 1, 0), vessel.surface_velocity_reference_frame) #some telemetry ut = conn.add_stream(getattr, conn.space_center, 'ut') g_constant = conn.add_stream(getattr, conn.space_center, 'g') altitude = conn.add_stream(getattr, vessel.flight(vessel.orbit.body.reference_frame), 'surface_altitude') vertical_vel = conn.add_stream(getattr, vessel.flight(vessel.orbit.body.reference_frame), 'vertical_speed') vessel.control.sas = True vessel.control.rcs = True vessel.control.throttle = 0.0 vessel.control.activate_next_stage() start_time = time.time() last_update_time = start_time #initialise PIDs #args: kp,ki,kd,minout,maxout,target,state,nowtime altPID = PIDregulator(alt_kP,alt_kI,alt_kD,0,1,0,0,start_time) while True: #manage time now_time = time.time() #Get data velocity = vessel.flight(ref_frame).velocity #calculate hover throttle if vessel.available_thrust>0: hov_thr = vessel.mass/(vessel.available_thrust*0.10197) else: hov_thr = 1 #decide on how and where to fly if (now_time-start_time<10): desired_velz = 2 elif (now_time-start_time<15): desired_velz = 0 else: desired_velz = -2 #call PID regulator throttle = altPID.update(velocity[0],desired_velz,time.time(),midpoint=hov_thr) vessel.control.throttle = throttle #print(hov_thr,desired_velz,velocity[0],throttle)
  6. I know it won't. I need a way to track connection and terminate the program when the server breaks it. Well, it can be done by tracking errors but IMO there should be easier and cleaner way. Also, a question. Can I get KSP's internal time with microsecond accuracy somehow? Running PIDs off computer's time is wrong since should the game slow down PID gains would all be wrong
  7. Hello, how do I detect if server has disconnected a Python client? I kill connection from the game when something starts going wrong but then I have Python processes hanged on my PC.
  8. TOW missile won't work in orbit since targeting ball doesn't. It references Earth-fixed coordinate system and low update frequency causes it to point retrograde if I attempt to lock onto ship. Can this be fixed? Also, fixes for HEKV would be nice. ANd general space combat. At least some simple stuff... It's 100% broken now. Even guns cant hit targets since they don't lead them enough. Just a space weapons mod developer's rant.
  9. Confirmed to be working in latest BDA and KSP. MAy need to fix bullet strength (heard it was changed), but it ain't broken.
  10. Well, space combat is hard. BDA would probably have to reference something like MechJeb's orbit solver or have its own code that does similar job. Not to mention that maneuvering missiles would be even harder. Last time I tried it guns weren't able to hit craft that was travelling parallel to me at the same velocity, at 200m separation.
  11. I'll see what I can do. Is there a mod that adds something at least remotely related to The Expanse? Like torchships? Also, is space targeting in BDA fixed?
  12. Anyone tested this in newer KSP and BDA versions? I don't have KSP installed currently but I wanted to update the mod's page on Spacedock.
  13. Btw, I can't vote on the poll again, but it would be super awesome if you could divert some attention to hull parts. So far we have awesome weapons but very basic models of hulls, from that large boat pack.
  14. I'm getting this spammed in my logs: NullReferenceException: Object reference not set to an instance of an object at KAS.KASAddonControlKey.UpdateGUIControl () [0x00000] in <filename unknown>:0 at KAS.KASAddonControlKey.Update () [0x00000] in <filename unknown>:0 (Filename: Line: -1) Everything seems to work fine tho. Anyone? P.S. Baha, can you eventually add possibility to fire heatseekers at cruise missiles?
  15. Win8.1, both x64 and x32. Same blindling white outdoors, more or less normal in SPH.
  16. BahamutoD made it work somehow. Unfortunately, he never released it.
  17. I've just noticed that latest version now has configs for 1.0.5 engines, making my old ones unnecessary. However, my ones seemed to look better on afterburning jet. Try it out: @PART[turboJet]:FOR[RealPlume]:NEEDS[SmokeScreen] { PLUME { name = Turbofan transformName = thrustTransform localRotation = 0,0,0 localPosition = 0,0,-1.2 fixedScale = 0.75 energy = 1.2 speed = 1 } PLUME { name = Turbojet transformName = thrustTransform localRotation = 0,0,0 localPosition = 0,0,-0.6 fixedScale = 1.4 energy = 0.7 speed = 1 } @MODULE[ModuleEnginesFX]:HAS[#engineID[Dry]] { %powerEffectName = Turbofan %spoolEffectName = Turbofan-Spool } @MODULE[ModuleEnginesFX]:HAS[#engineID[Wet]] { %powerEffectName = Turbojet %spoolEffectName = Turbojet-Spool } }
  18. I'd go further than suggesting 90 deg version. I'd suggest adding slider that will act like trimmer on steering part, with plus minus 90 degrees limit.
  19. I always set width of main part of ailerons to minimal value - making its surface invisible. Instead, I make trailing edge wider. Like here:
  20. B9_Aero_Wing_Procedural_TypeB and B9_Aero_Wing_Procedural_TypeC have them - those are control surfaces. Values may be different - but still, just put comment symbol // in front of them. And yes, I know it's a workaround - but it would certainly be useful. You only need to add this to control surfaces. Wings themselves don;t need it.
  21. That's certainly possible - but I generally use wings with same up and bottom colors anyways. However, it did fix control surfaces deflection direction - which is the most important thing for me.
  22. Scatterer doesn't support it - and is completely disabled in those screenshots. Btw, I've found what causes "tsunami" bug, i.e. ocean out of position. Zooming in in IVA camera, then switching back to EVA. Ocean becomes misplaced, and camera FOV doesn't revert to normal.
  23. It was most probably Num2 - I'm using numpad for BDarmory targeting cam. But I've pressed all numpad numbers - and idk which one caused it. I'll test more.
  24. Btw, removing that mirrorRefAxis = 0, 0, -1 lines from configs fixed the symmetry. Now the mod is functional but shader still looks weird. Here are a couple of pics. Look at how bright they are on the sunlit side: Just look at those glossy lines on panels. Btw, they always point at the light source, i.e. at roof in SPH, at sun on runway.
×
×
  • Create New...