Jump to content

[1.12.x] Anatid Robotics / MuMech - MechJeb - Autopilot - [2.14.3] [4th March 2023]


sarbian

Recommended Posts

I'm having an issue in Career in which the Rover Autopilot button doesn't exist. It does exist in Sandbox. I have most of the tech tree unlocked, including all nodes with any MechJeb module unlocks.

However, I'm running a very not-standard tech tree in the form of Un Kerbaled Start, which I suspect is the problem, as it changes a lot of early-game nodes, and I'm not sure it even has "fieldScience" (the node that unlocks the Rover guidance).

Is there a way to just enable everything in career mode? There used to be mods for that, but they're waaaaaay deprecated, like 6 KSP versions ago.

Link to comment
Share on other sites

On 9/25/2023 at 7:03 PM, AnFa said:

Why ascent guidance is so excrements? I'm flying this rocket

8F3XQNG.png

I can get it manually to orbit without issue, but MechJeb can't even find a way to get out of orbit. All settings a refactory default. This is the result:

Like I said, I can fly this rocket to orbit just fine, but no matter what changes I make to the options, MechJeb can't, so I must ask again. Why is ascent guidance so excrements?

Well... a few things.

First, that rocket is barely flyable. I realize you managed to get it to orbit, but I don't imagine it was particularly easy. Typically you want a first-stage TWR of around 1.6 in atmosphere, so with most engines, closer to 2 given the losses to low-atmosphere ISP. Yours is 1.37, so very slow off the pad. Then after just 990 m/s it drops to below 1. What this tells me is that you're probably having to fly with a really big AoA to get it to orbit. This is inefficient and very hard for a simple autopilot like MJ to do.

I imagine you're thinking in terms of an initial boost stage, then a sustainer stage, and then a circularization stage, like real-life rockets use, but KSP, stock, just doesn't work very well with that method. This is because Kerbin is just too small. Its atmosphere is too shallow. By the time a real rocket would be on a sustainer stage, it'd already be in space. They are much more powerful and have much more fuel ratio and much higher ISP because Earth is much bigger than Kerbin (10 times bigger, to be exact, with around double the atmosphere depth).

Second, you are correct: MechJeb's ascent guidance is trash. All it does is go straight up for a bit, then turn to 40° or whatever you set your initial angle to, then gradually turns more and more on a preset flight plan. This forces an unnatural flight path with high angle of attack (ideally you want zero AoA for almost the entire launch), and creates massive losses to aerodynamic drag while also failing to optimize for gravity losses... the worst of both worlds. It's basically the "rocket launch 101" scheme new players tend to be taught, but it's an absolutely abysmal launch profile. The only worse one is going straight up all the way to vacuum and then doing a transverse burn.

The most efficient launch profile (in Stock KSP) for most well-built rockets is to accelerate straight up to around 100 m/s, then pitch to 10°. Once things are stabilized at 10°, turn off SAS and then you shouldn't ever need to touch rotational controls again until space. Everything from then on should be done just with the throttle, allowing the rocket to rotate naturally due to a correct drag profile (Center of Pressure slightly below center of mass). Once your Time to Ap hits about 50 seconds, throttle down to maintain 50 seconds until you get to your desired Ap, at which point you should need <100 m/s of dV to circularize, and can get to orbit with as little as 3200 m/s dV.

There is a mod that does all of this for you, correctly, called GravityTurn Continued. It defaults to exactly what I just said, and can also try to guess, based on stats for your rocket, what to set the initial turn velocity and angle to for a more efficient ascent. The default almost always works. Having it guess usually works, but occasionally it'll fail to get to orbit, in which case, revert, and instead of "Initial Guess" it'll have "Improve Guess". Theoretically, for a given launch vehicle, it should find the absolute optimal launch profile in around 3-4 tries, but I usually just cheat its guess up by about 5 m/s and down by about 2° and it's "efficient enough" and extremely reliable.

However... you'll still need more TWR than that rocket has in the first few stages. I suppose in theory you could coax MechJeb into flying the same trajectory that you do, as others have suggested, but honestly MJ's ascent guidance just isn't good enough to bother. Add some more TWR and get GravityTurn, and you'll be much happier I think!

 

(In general, MechJeb is a jack of all trades, master of none. It can do basically everything, yes... but for certain situations, especially involving atmosphere, bespoke autopilot mods do significantly better, such as GravityTurn for atmospheric ascents, Atmosphere Autopilot for flying planes, or Throttle Controlled Avionics for VTOL control and balance. MJ can do all of those things... kind of. But it's not that good at them. I recommend mostly using it for orbital maneuvering and planning, and rover stabilization. Actually, I recommend not using it at all until you're 100% confident you can do absolutely everything it does, and understand what it's doing at all times. After all, that's kind of the point of KSP, plus that whole "Yes, you have a calculator, but you need to know the math yourself so you know if the number it spits out makes sense" idea. Even then, honestly, you'll be better at a lot of stuff than it is. Its docking routine, for example, is horrifyingly inefficient. It kind of has to be, in order to be as foolproof as it is, but again with Docking Alignment Indicator you can do oodles better hand-flying.)

Edit: It's worth noting that the optimal ascent profile is basically behaving like an idealized version of the boost-sustain model used in the real world. The reason those are done in separate stages in real life is because real-life rockets don't have the ability to throttle down to sustain time-to-apogee like you can in KSP. Most first-stage-capable rockets can only throttle down to around 70%, while some "deep throttle" engines can go as low as 25% (SpaceX claims 17% on their vacuum Merlin, but realistically there are probably significant issues with reliability and durability throttling that low). KSP's 1% throttle is a pipe dream. That said, a lot of the more modern rockets being flown do use the same engine to sustain, by throttling down and/or ejecting boosters to get down to a single core.

You could do the staging version of booster-sustainer-circularizer (though it's unnecessary through most of a stock playthrough) in KSP, but you'd have to do a fair amount more math, testing, and development. Keep in mind, you're building a rocket in what, maybe an hour? NASA and SpaceX and any other real life rocket developer spends millions of hours on them, and hundreds or thousands of additional man-hours to fine-tune the parameters for each launch.

Edited by FirroSeranel
Link to comment
Share on other sites

Started a new career today (while watching the Starship livestream IRL). Was somewhat surprised when I got Jeb into mun orbit for his first landing and saw that the McJeb landing guidance was available (and worked fine) even though I had not yet unlocked unmanned tech. Typically I have to do a manual landing or two before I have enough science to unlock that tech node and thus McJeb's landing guidance. This was with McJeb dev version 1306, which I see wasn't the newest one, so I just now did a quick update to the newest dev version and I see that it is still there. Didn't bother to grab a log file as it didn't seem worth the bother. Doesn't hurt anything - just a bit surprising. I do have that node unlocked in a separate career in the same game install; wouldn't think that should matter, but possibly.

Link to comment
Share on other sites

Just posted an issue on github, with a log; thought I'd make a brief note of it here as well. First, there are a lot of McJeb oddities apparently specific to Gilly, which have been there a long time, but I tend to just work around. Maneuver planner sometimes generates quite wild things for simple maneuvers. Latest example was "change inclination to 90 at the cheapest AN/DN crossing" generating a maneuver that throws completely out of Gilly's SOI, although asking for the same inclination change at the nearest point works fine. Second, new to very recent dev versions, "execute next node" takes seemingly forever to terminate after executing pretty much any maneuver. https://www.dropbox.com/scl/fi/nxfag6bt9wph9mfmie3rn/Player.log?rlkey=5m2qysptmtnqf0hfcbukpvsc1&dl=0

Link to comment
Share on other sites

  • 1 month later...

I have a 52Mb Log because of a spam of Mechjeb. The thing is I'd never had this strange bug. The KSP.log is full of this:

[LOG 16:41:49.214] [PR] MechJeb wrapper.Active  1
[LOG 16:41:49.215] [PR] MechJeb wrapper.Active  2
[LOG 16:41:49.215] [PR] MechJeb wrapper.Active  3
[LOG 16:41:49.215] [PR] MechJeb wrapper.Active  4
[LOG 16:41:49.215] [PR] MechJeb wrapper.Active  5

And then it repeats all the time from 1 to 5.

KSP.log

Edited by Overlocker96
Link to comment
Share on other sites

2 hours ago, Overlocker96 said:

I have a 52Mb Log because of a spam of Mechjeb.

Butting in ...

Sorry I can't help you with the MechJeb errors, but you do have a couple other things that would be good to look at, too.

First, you have at least one instance of MiniAVC.dll somewhere, and that mod is outdated and broken and can cause issues. You can either get the ZeroMiniAVC mod or just delete any instance of the dll from your GameData and below.

You have a science lab that's freaking out, and here's the report of it, followed by tons of nullrefs around line 119735.

114906 [ERR 16:36:23.567] [ModuleScienceLab]: No Container Module found at index 4

The fix for this is pretty simple once you identify the part causing it. Do you know how to use something like grep to search through CFGs files in your gamedata folder and below? if so, the text you want to find is "containerModuleIndex = 4"  - the only other way I know to find it is to instantiate a lab in the VAB, and right-click on it. If you have the debug console open, it will start spewing walls of red nullrefs on the bad laboratory part. If you can find it and report the full path of the cfg file, I can help you fix it - but the fix depends 100% on the file itself, so you'd need the right cfg file. Btw, if you can't find that text, reduce it to just "containerModuleIndex" and look for one with a 4.

Sorry, slightly off topic from your question - but if I've learned anything about KSP mods, it's that one problem can cascade into other problems, so a clean log is good.

Link to comment
Share on other sites

Posted (edited)
2 hours ago, Overlocker96 said:

[LOG 16:41:49.214] [PR] MechJeb wrapper.Active  1

This is not a log generated by Mechjeb but by whatever [PR] is.

Mechjeb 2 logs looks like this :

[LOG 16:20:09.602] [MechJeb2] Starting the Dispatcher

 

Edited by sarbian
Link to comment
Share on other sites

2 hours ago, Starwaster said:

@Overlocker96 @sarbian

It's Persistent Rotation.

Yeah, it was.
I deleted it and the majority of the spam stopped.

5 hours ago, OrbitalManeuvers said:

The fix for this is pretty simple once you identify the part causing it. Do you know how to use something like grep to search through CFGs files in your gamedata folder and below? if so, the text you want to find is "containerModuleIndex = 4"  - the only other way I know to find it is to instantiate a lab in the VAB, and right-click on it. If you have the debug console open, it will start spewing walls of red nullrefs on the bad laboratory part. If you can find it and report the full path of the cfg file, I can help you fix it - but the fix depends 100% on the file itself, so you'd need the right cfg file. Btw, if you can't find that text, reduce it to just "containerModuleIndex" and look for one with a 4.

I tried the second method and the part is the SDV-X 'Cronus' Extensible Centrifuge from SSPX. I had that problem for a while using that mod even on fresh installs, is the mod itself that has a bad config file for its Science Lab.

Also installed ZeroAVC and fixed any residual MiniAVC.dll that is around. Also I searched for it and the .dll itself doesn't exists, it will come with another mod's .dll

Link to comment
Share on other sites

12 hours ago, OrbitalManeuvers said:

i don't think i'm seeing the same thing as you ... can you tell me the actual path and filename you found?

Here's the relevant LOG part:
 

Spoiler

[ERR 01:07:26.842] [ModuleScienceLab]: No Container Module found at index 4

[LOG 01:07:26.935] [Part sspx-expandable-centrifuge-5-1] [ModuleB9PartSwitch 'endcapSwitch'] Switched subtype to BlackHandles
[LOG 01:07:26.935] [Part sspx-expandable-centrifuge-5-1] [ModuleB9PartSwitch 'endcapSwitch2'] Switched subtype to BlackHandles
[ERR 01:07:27.483] Exception handling event onPartActionUICreate in class ModuleScienceLab:System.NullReferenceException: Object reference not set to an instance of an object
  at ModuleScienceLab.updateModuleUI () [0x00000] in <4b449f2841f84227adfaad3149c8fdba>:0 
  at ModuleScienceLab.onPartActionUI (Part p) [0x00025] in <4b449f2841f84227adfaad3149c8fdba>:0 
  at EventData`1[T].Fire (T data) [0x000b0] in <4b449f2841f84227adfaad3149c8fdba>:0 

[EXC 01:07:27.485] NullReferenceException: Object reference not set to an instance of an object
    ModuleScienceLab.updateModuleUI () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    ModuleScienceLab.onPartActionUI (Part p) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    EventData`1[T].Fire (T data) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    EventData`1:Fire(Part)
    UIPartActionWindow:CreatePartList(Boolean)
    UIPartActionWindow:Setup(Part, DisplayType, UI_Scene)
    UIPartActionController:CreatePartUI(Part, DisplayType, UI_Scene)
    UIPartActionController:SelectPart(Part, Boolean, Boolean)
    UIPartActionController:HandleMouseClick(Camera, Boolean)
    <MouseClickCoroutine>d__39:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

"sspx-expandable-centrifuge-5-1" Is the Cronus Centrifuge, the only one in 5m diameter. I think the problem may be because is an "Expandable" Centrifuge, so when it changes from stowed to deployed, the Science Lab module bugs out. All other Centrifuges and Science Bays never had this problem.

Also I don't know if its better to keep discussing this last problem in the SSPX Forum, instead of the Mechjeb one.

EDIT: Ok, I have found in the SSPX forums that the problem is with TAC Life Support and its compatibility with SSPX. Here's the link:

EDIT 2: And also here's a simple Patch to fix the problem with the converters in those modules (I only had the problem with the 5m centrifuge, but still)

 

Edited by Overlocker96
Link to comment
Share on other sites

I'm getting direct-to-desktop KSP crashes when using a maneuver node to transfer to Jool. I note that KSP.log has a lot of MechJeb spam at the bottom, so I thought to repost here.

KSP.log and mod list in this thread:

 

Link to comment
Share on other sites

23 hours ago, bigyihsuan said:

I'm getting direct-to-desktop KSP crashes when using a maneuver node to transfer to Jool. I note that KSP.log has a lot of MechJeb spam at the bottom, so I thought to repost here.

KSP.log and mod list in this thread:

 

Same issue as above. MechJeb might be mentioned but it's not the mod that is logging that. [PR] would be Persistent Rotation, logging about its MechJeb wrappers. (wrapper functions so that it can call MJ functions)

So, there's nothing in your log file that really implicates MJ. Might not even be Persistent Rotation. The log spam is a bit excessive and should be toned down, but it's not an error.

If you look in %localappdata%low\Squad\Kerbal Space Program, you'll find logs relating specifically to your crashes. They should have some more information extending past the ksp.log files as well as information about the crash itself. It might help or it might not if the crash is some generic error.  (just paste %localappdata%low\Squad\Kerbal Space Program into your Explorer URL bar)

(you should post THAT log in the thread you referenced, not here. There's really no indication in your log of MJ being at fault)

Link to comment
Share on other sites

  • 1 month later...

Is anyone else getting what seems to a new message warning that the Hohmann transfer function isn't suitable for targets with SoIs and a new transfer to Moon function is needed?

Link to comment
Share on other sites

Having some odd issues with MJ. When I'm merging two craft or even sometimes when I build just a plain orbiter something is screwing with Mechjeb. To the point it causes severe studdering or even freezes the game. For one design, If I place a rover in the launch vehicle something happens with MJ and causes a bunch of exceptions about fuelflowsimulation. Which makes sense because when viewing the delta-v stats in MJ if I change fuel type none of the calculated values adjust. Now if I remove the rover MJ will see I changed the fuel type and display the updated values. Its as if the rover is blocking something and causing MJ to freak out. This also happens with other vehicles created. Any ideas would be appreciated. If I find an offending part, in this case the rover, and remove it I can launch just fine and game runs perfectly. Attached log.

Link to log file showing all the MJ fuelflowsimulation exceptions

Edited by Fihnakis
Link to comment
Share on other sites

I'm experiencing an issue that seemed to randomly manifest itself recently where command pods that previously had the MechJeb module ingame have inexplicably lost it, so that the only part that can give crafts MechJeb capability is the AR202

>Log file<

Link to comment
Share on other sites

Update:

I've figured out the cause seems to be my game thinking RO is installed which is preventing MechJeb from loading, I'm working on fixing that now

Link to comment
Share on other sites

On 2/23/2024 at 8:49 PM, KeaKaka said:

I'm experiencing an issue that seemed to randomly manifest itself recently where command pods that previously had the MechJeb module ingame have inexplicably lost it, so that the only part that can give crafts MechJeb capability is the AR202

>Log file<

MJ does not add the MJ module to command pods by itself. That requires a separate patch. If you had it being added before then you had another mod installed that was patching the command pods. It sounds like that mod is no longer present. Think back to mods you recently uninstalled. You could also just patch it yourself. I maintain my own tweak folder for portability that contains MM patches.  One of them is this patch:

(Note that commented line: the docking guidance module was changed to be available at start. You may want to switch it back. Or not.)

MJ_for_all.cfg

@PART[*]:HAS[@MODULE[ModuleCommand],!MODULE[MechJebCore]]:Final
{
	MODULE
	{
		name = MechJebCore
		eduMode  = true
		MechJebLocalSettings
		{
			MechJebModuleCustomWindowEditor { unlockTechs = flightControl }
			MechJebModuleSmartASS { unlockTechs = flightControl }
			MechJebModuleManeuverPlanner { unlockTechs = advFlightControl }
			MechJebModuleNodeEditor { unlockTechs = advFlightControl }
			MechJebModuleTranslatron { unlockTechs = advFlightControl }
			MechJebModuleWarpHelper { unlockTechs = advFlightControl }
			MechJebModuleAttitudeAdjustment { unlockTechs = advFlightControl }
			MechJebModuleThrustWindow { unlockTechs = advFlightControl }
			MechJebModuleRCSBalancerWindow { unlockTechs = advFlightControl }
			MechJebModuleRoverWindow { unlockTechs = fieldScience }
			MechJebModuleAscentGuidance { unlockTechs = advFlightControl }
			MechJebModuleLandingGuidance { unlockTechs = unmannedTech }
			MechJebModuleSpaceplaneGuidance { unlockTechs = unmannedTech }
			MechJebModuleDockingGuidance { unlockTechs = advUnmanned }
			MechJebModuleRendezvousAutopilotWindow { unlockTechs = advUnmanned }
			MechJebModuleRendezvousGuidance { unlockTechs = advUnmanned }
		}
	}
}

 

Link to comment
Share on other sites

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