Jump to content

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


sarbian

Recommended Posts

1 hour ago, bartekltg said:

It will. But mechjeb throttle to 0 and then make correction for atmospheric loss, so it is cheating too;-)

It is hard to do what you want only by adjusting direction during flight. The rocket will get a certain velocity, after a set time. The rocket could be too low for sane orbit;-) If you get to the 80x0 orbit at altitude 40km you spend quite a lot time in the atmosphere. 

You can wait with staging, but it is hard (I think) to do automatically. 
The better idea for getting to orbit with periapsis around 0 is to reduce TRW of (at least) the second stage. My test rocket with AG set to turn shape = 16deg and 80km get periapsis around -250km, and after setting thrust limiter to 70%, periapsis was -4km, circularization burn <100m/s, so doable for "small shuttle engines". A bit more tinkering and you get 0km. But you have to manipulate with not only turn shape but also with the rocket itself, at least with thrust limiters, so the burn is longer.

I'm playing RO and the engines I'm using only have 1 start available.  So I can't have them shut down to make a course correction.  I'm aiming for 200km x -50km (or there abouts).  Getting, and keeping, my Apoapsis at around 200km is not all that hard.  I just used Classic Ascent Profile with turn end altitude of 200 and turn shape of 35% - 60% depending on the rocket I'm launching.  Then I just use the "Final flight path angle" to keep vertical speed close to 0.  The trouble I have is manually disengaging the autopilot at around -50km Periapsis is very hit or miss.  By that point in the launch, even with throttling, I'm usually pushing 4+ Gs.  I can already get Mechjeb to shut down throttle at a certain Apoapsis, which is great when I launch and want the autopilot to get me into a near circular orbit.  It even works fine if I want elliptical orbits with Periapsis above 150km (I just use the above to circulize, then let the engine keep burning till my new Apoapsis is reached).  But I was hoping for a way to have the autopilot shut down when I've reached a certain Periapsis, regardless of what my Apoapsis might be at the time.

Link to comment
Share on other sites

You should have a look at the new launch profile. The "Atlas/Centaur PEG Pitch Program" may have more option for a RO player. 

Adding an option to shutdown the AP earlier would not be too hard but I don't have much dev time recently...

Link to comment
Share on other sites

Hello, I'm experiencing strange problem about Ascent Guidance. Autopilot status and PEG editor shows correct data and autopilot is engaging easily but no real control is provided by it, vessel fly straight up and turn upside down once hitting dense atmophsere. Any of ascent guidance mode work by the way, it happens in Stock-Style Gravity Turn and MJ Classic, too.

I'm playing KSP 1.3.1, using Mechjeb2 2.7.0.0 latest official release, 778 dev build doesn't help.

My mod list:

Spoiler

[x] Science!
000_AT_Utils
000_TexturesUnlimited
000_Toolbar
000_USITools
AIES_Aerospace
Airlocks
AirplanePlus
AJE
AnimatedDecouplers
APP-RPM
ASET
ATK_Propulsion_Pack
AtomicAge
B9_Aerospace_ProceduralWings
B9PartSwitch
BahaConstellation
BahaSP
BetterTimeWarp
blackheart
CactEye
CapsuleCorp
Chatterer
cmd.exe
CMES
Coatl Aerospace
CommunityCategoryKit
CommunityRealAgencyPack
CommunityResourcePack
CommunityTraitIcons
ConfigurableContainers
ConnectedLivingSpace
ContractConfigurator
ContractPacks
CrewManifest
CrowdSourcedScience
CryoEngines
CryoTanks
CustomBarnKit
DeadlyReentry
DeployableEngines
DistantObject
DMagicOrbitalScience
DMagicScienceAnimate
DMagicUtilities
DockingCam
DSSHU
DynamicBatteryStorage
EasyVesselSwitch
ENERGIA
EngineGroupController
EngineLight
EnvironmentalVisualEnhancements
f.txt
F9demo
FASA
FerramAerospaceResearch
Firespitter
Fix
FlagRotate
ForgottenRealEngines
FreedomTex
FShangarExtender
GroundConstruction
HabitatPack
Hangar
HideEmptyTechTreeNodes
HPTechTree
HullCameraVDS
HumanColoredHeadsRecolored
IndicatorLights
InterstellarFuelSwitch
JamesWebb
JanitorsCloset
JNH
JSI
KAS
KerbalConstructionTime
KerbalEngineer
KerbalFoundries
KerbalHacks
KerbalJointReinforcement
KerbalRenamer
KerbalReusabilityExpansion
KIS
Kopernicus
kOS
KOSMOS
KRASH
KronalUtils
KSCSwitcher
KSPTOTConnect
KSPWheel
KWRocketry
LayeredAnimations
MagiCore
MagicSmokeIndustries
MainSailor
MandatoryRCS
MechJeb2
ModularFlightIntegrator
NavyFish
NearFutureConstruction
NearFutureElectrical
NearFutureProps
NearFutureSolar
NicheParts
OTHOABmisc
PlanetShine
PolishFlagPack
PreciseNode
Principia
ProceduralDynamics
ProceduralFairings
ProceduralFairings-ForEverything
ProceduralParts
QuantumStrutsContinued
RCSBuildAid
RealChute
RealFuels
RealHeat
RealismOverhaul
RealPlume
RealScaleBoosters
RealSolarSystem
ReentryParticleEffect
RemoteTech
REPOSoftTech
RLA_Stockalike
RN_Cygnus
RN_Skylab
RN_Solar_Panels
RN_Soviet_Probes
RN_Soviet_Rockets
RN_US_Probes
RN_US_Rockets
RP-0
RSS-Textures
RSSTimeFormatter
RSSVE
RW Saturatable
SCANsat
scatterer
Science818
ScienceCrate
SETIprobeParts
SmartParts
SmokeScreen
SolverEngines
SovietEngines
SpaceY-Expanded
SpaceY-Lifters
Squad
SSTU
StretchySNTextures
SurfaceExperimentPackage
SurfaceLights
TacFuelBalancer
Taerobee
Tantares
TantaresLV
TarsierSpaceTech
TextureReplacerReplaced
ThunderAerospace
Trajectories
TriggerTech
TRR_Galenmacil
TweakScale
UmbraSpaceIndustries
VenStockRevamp
WindowShine

And output_log.txt:

http://www96.zippyshare.com/v/1RpIvEZD/file.html

If I provided not much as necessary info, tell me that, I will update with needed things :)

Edited by Skorupsi
Link to comment
Share on other sites

22 hours ago, sarbian said:

You should have a look at the new launch profile. The "Atlas/Centaur PEG Pitch Program" may have more option for a RO player. 

Adding an option to shutdown the AP earlier would not be too hard but I don't have much dev time recently...

I don't suppose there is a wiki or tutorial on how to use the new PEG Pitch Program?  I did give it a try and it sort of worked.  I setup target Apoapsis to 400 and target Periapsis to -90.  Two test flights later, both auto pilots shut down at about -200km pe which isn't horrible.  But I'm not exactly sure what all the settings do.

Link to comment
Share on other sites

19 hours ago, Skorupsi said:

Hello, I'm experiencing strange problem about Ascent Guidance. Autopilot status and PEG editor shows correct data and autopilot is engaging easily but no real control is provided by it, vessel fly straight up and turn upside down once hitting dense atmophsere. Any of ascent guidance mode work by the way, it happens in Stock-Style Gravity Turn and MJ Classic, too.

I'm playing KSP 1.3.1, using Mechjeb2 2.7.0.0 latest official release, 778 dev build doesn't help.

My mod list:

  Reveal hidden contents

[x] Science!
000_AT_Utils
000_TexturesUnlimited
000_Toolbar
000_USITools
AIES_Aerospace
Airlocks
AirplanePlus
AJE
AnimatedDecouplers
APP-RPM
ASET
ATK_Propulsion_Pack
AtomicAge
B9_Aerospace_ProceduralWings
B9PartSwitch
BahaConstellation
BahaSP
BetterTimeWarp
blackheart
CactEye
CapsuleCorp
Chatterer
cmd.exe
CMES
Coatl Aerospace
CommunityCategoryKit
CommunityRealAgencyPack
CommunityResourcePack
CommunityTraitIcons
ConfigurableContainers
ConnectedLivingSpace
ContractConfigurator
ContractPacks
CrewManifest
CrowdSourcedScience
CryoEngines
CryoTanks
CustomBarnKit
DeadlyReentry
DeployableEngines
DistantObject
DMagicOrbitalScience
DMagicScienceAnimate
DMagicUtilities
DockingCam
DSSHU
DynamicBatteryStorage
EasyVesselSwitch
ENERGIA
EngineGroupController
EngineLight
EnvironmentalVisualEnhancements
f.txt
F9demo
FASA
FerramAerospaceResearch
Firespitter
Fix
FlagRotate
ForgottenRealEngines
FreedomTex
FShangarExtender
GroundConstruction
HabitatPack
Hangar
HideEmptyTechTreeNodes
HPTechTree
HullCameraVDS
HumanColoredHeadsRecolored
IndicatorLights
InterstellarFuelSwitch
JamesWebb
JanitorsCloset
JNH
JSI
KAS
KerbalConstructionTime
KerbalEngineer
KerbalFoundries
KerbalHacks
KerbalJointReinforcement
KerbalRenamer
KerbalReusabilityExpansion
KIS
Kopernicus
kOS
KOSMOS
KRASH
KronalUtils
KSCSwitcher
KSPTOTConnect
KSPWheel
KWRocketry
LayeredAnimations
MagiCore
MagicSmokeIndustries
MainSailor
MandatoryRCS
MechJeb2
ModularFlightIntegrator
NavyFish
NearFutureConstruction
NearFutureElectrical
NearFutureProps
NearFutureSolar
NicheParts
OTHOABmisc
PlanetShine
PolishFlagPack
PreciseNode
Principia
ProceduralDynamics
ProceduralFairings
ProceduralFairings-ForEverything
ProceduralParts
QuantumStrutsContinued
RCSBuildAid
RealChute
RealFuels
RealHeat
RealismOverhaul
RealPlume
RealScaleBoosters
RealSolarSystem
ReentryParticleEffect
RemoteTech
REPOSoftTech
RLA_Stockalike
RN_Cygnus
RN_Skylab
RN_Solar_Panels
RN_Soviet_Probes
RN_Soviet_Rockets
RN_US_Probes
RN_US_Rockets
RP-0
RSS-Textures
RSSTimeFormatter
RSSVE
RW Saturatable
SCANsat
scatterer
Science818
ScienceCrate
SETIprobeParts
SmartParts
SmokeScreen
SolverEngines
SovietEngines
SpaceY-Expanded
SpaceY-Lifters
Squad
SSTU
StretchySNTextures
SurfaceExperimentPackage
SurfaceLights
TacFuelBalancer
Taerobee
Tantares
TantaresLV
TarsierSpaceTech
TextureReplacerReplaced
ThunderAerospace
Trajectories
TriggerTech
TRR_Galenmacil
TweakScale
UmbraSpaceIndustries
VenStockRevamp
WindowShine

And output_log.txt:

http://www96.zippyshare.com/v/1RpIvEZD/file.html

If I provided not much as necessary info, tell me that, I will update with needed things :)

Sorry but you have a lot of error in your logs when some mods loads and run. (CMES/KOSMOS/SSTUKopernicus/scatterer/RealChute/ProceduralWings/...) and it seems you are trying to run RealsimOverhaul but as far as I know RO is not ready for 1.3.1. 

I can not really offer a proper diagnostic with that much errors.

Link to comment
Share on other sites

1 minute ago, Garlik said:

@sarbian Not sure if I can post it here. But as the current MJ dev, I suppose you might have an interest in this. Explanations by one of the SpaceX engineer writing the landing algorithm for Falcon9:

 

Thanks for that :)

But for now I will echo the reply of the current top poster "So basically, in order to understand Lars Blackmore's paper, I need to be Lars Blackmore? Back to classical first order lithobraking I go …"

 (I will have a proper look once I my head stop trying to explode and I have a more free time :wink: )

Link to comment
Share on other sites

The talk about trick launches and stuff don't make sense... Launch to your periapsis then set your apoapsis... Damn simple, don't make mechjeb more complex than it needs to be..

I do have some planet mods installed but these were added after my first gripe. I'm trying to launch from about 730km ( ~1H:30m) orbit to Eve and eventually Moho.. I knew the first launch window was probably bogus because it was not showing any intercepts, so I waited until about 50 days before the launch burn and recomputed, got a new window for 130 days out, it provided intercept markers but it's about 30 degrees out of phase. =( I'd be happy to fix misalignments of up to 15 degrees in a corridor correction burn but this is just ridiculous.) In my previous game I had a flight to Jool that had a burn scheduled 14 **YEARS** out to make an intercept because it was lagging Jool by about ten degrees and was coming up from Kerbin so it had no choice but to wait for Jool to make it all the way around... 

I have a similar satellite parked a little higher slated for Duna. It is showing an intercept but it's about 150 degrees out of phase. 

The parking orbits are perfect equatorial orbits intended to be a good balance between frequency of launch windows and dV needed to launch... The vehicle is a 2.5m  stack with a Skipper engine, 42.8 tons, extremely well behaved craft... 

Earlier versions of mechjeb would botch the launch window and start firing the engines while the rocket was still pointed at Kerbin and crash the damn thing. This version executes the launch perfectly except for being on the wrong orbit. =( 

I use orbits between about 350 and 450 km for mun/minmus missions and between 750 and 1200km for interplanetary missions... 

The workaround seems to be to recompute the launch everytime the node timer starts getting low and only do the launch when it is either showing a close intercept or looks reasonable enough to work. 

 

Link to comment
Share on other sites

It's easy for a dumb and old user pop-ut from nowere with the classic and overrated "uber-idea-of-the-week", but I was randomly surfing the forum and I'm probably just in the mood to practice a bit of english (not my native language: "sempre grazie, @sarbian per mantenere mechjeb" <--- italian thanks :P ):

I remember, Long-Long-Long ago, in both early KSP and mechjeb development, a neat function that I always found a bit of a shame that was removed when Mechjeb became "v.2.-someting"": "manual throttling" using the Ascend Guidance.
Surelly mechjeb now is a complete suit of programmable parameter both to manage the launch profile and the engine, BUT in the early versions I always liked to use the throttle by myself ([Shift]/[CTRL]] like a manual launch, leaving to Mechjeb just the "keep the rocket pointed in the right direction".

That could be my only "wish-list function", if it possible to address this laters year development.
Seeing it back again could make an old 42yo pal smiling like a kid at the Christmas morning :wink:

Edited by Araym
Link to comment
Share on other sites

On 1/26/2018 at 4:58 AM, Garlik said:

@sarbian Not sure if I can post it here. But as the current MJ dev, I suppose you might have an interest in this. Explanations by one of the SpaceX engineer writing the landing algorithm for Falcon9:

Yeah, convex optimization algorithms are at the leading edge of current research in trajectory optimization.

I'm working my way through late-60s era calculus-of-variations style trajectory optimization and that is more likely to land in MechJeb sooner rather than later.  Right now I've got proper PEG (shuttle-era PEG, not Atlas-Centaur-isn't-really-PEG-explicit-guidance that is currently released in MJ) wired up to the Ascent manager and Node executor in my own dev branch.  We can probably improve that even more by some later explicit guidance algorithms which would be more suitable to stock ascents off of Kerbin (I've been trying to figure out how to use PEG on Kerbin and its a lot more difficult than Earth).  We could also use a real CoV trajectory optimizer -- but consider that means adding a runge-kutta integrator, an algorithm to compute numerical jacobians plus a quasi-newton raphson root finder that degrades gracefully into a gradient descent method (stock newton raphson can't handle the spacecraft trajectory optimization problem) and wrap that with a multipoint boundary condition solver to chop up long burns.  And all that needs to be debugged and run right.   And convex optimization is going to be a lot harder with no off-the-shelf convex optimization routines written in C# (and even in C/C++ any libraries will probably cost $$$$ to use so those are out).

And largely the only pay off I can see to convex optimization that is going to be useful to KSP is going to be dealing with integrating the atmospheric drag part of hoverslams.  We should be able to wire up PEG to to airless landing problem just fine for KSP and get a really optimal landing guidance script without needing convex optimization.  I can see some possible uses for it so that the optimizer could automatically avoid terrain, but we should be able to solve that problem both heuristically and through some obvious mission planning advice -- if you try to land on the immediately opposite side of a crater from a very low orbit that skims the surface, you shouldn't be that shocked that you lithobrake into the lip of the crater, so don't plan those kinds of missions...  And when it comes to hoverslams in an atmosphere we can probably use PEG plus heuristics to deal with the drag -- run a full CoV simulation first with a drag model and use that solution to tweak PEG and while the result might not be perfectly optimal it should beat any existing hoverslam script.

From the paper:

"Onboard sensors for terrain-relative navigation generally require specific viewing orientations, which imposes a constraint on the vehicle orientation (attitude)."

Trying to solve the optimization problem with those kinds of constraints is the kind of thing which is motivating SpaceX and NASA towards convex optimization for closed-loop guidance.  KSP players + rockets don't have to worry about those kinds of constraints.

So for KSP-level problems we can probably do something more like this:

https://arc.aiaa.org/doi/abs/10.2514/2.5045?journalCode=jgcd

That handles the Ascent problem, but similar to how IGM was used for lunar landings and how PEG can be used for landings, we could adapt that code to hoverslams in an atmosphere.  Basically that is just a CoV solver, with a drag model, path constraints on aerodynamics and analytical solutions for the coast and burn arcs for speed so it can be run closed-loop.

Edited by Jim DiGriz
Link to comment
Share on other sites

On 1/25/2018 at 8:02 AM, sarbian said:

Nope. I know @Jim DiGriz is working on a newer version and we might get more doc at that point.

 

On 1/25/2018 at 7:34 AM, chrisl said:

I don't suppose there is a wiki or tutorial on how to use the new PEG Pitch Program?  I did give it a try and it sort of worked.  I setup target Apoapsis to 400 and target Periapsis to -90.  Two test flights later, both auto pilots shut down at about -200km pe which isn't horrible.  But I'm not exactly sure what all the settings do.

There's a wiki:

https://github.com/lamont-granquist/MechJeb2/wiki

Note that using it in stock is probably a really bad idea, it is pretty much for RSS-only.  You might be able to make it work, but it'll also all change after Shuttle-era PEG lands in MJ.

Link to comment
Share on other sites

19 hours ago, Jim DiGriz said:

 

There's a wiki:

https://github.com/lamont-granquist/MechJeb2/wiki

Note that using it in stock is probably a really bad idea, it is pretty much for RSS-only.  You might be able to make it work, but it'll also all change after Shuttle-era PEG lands in MJ.

So I've read through the wiki.  I am playing RO/RSS.  I believe I'm using MechJeb2-RO-2.6.1.0-741.

One of the things the wiki says regarding Booster Pitch end is "Try to match the pitch angle at the end of the pitch program to the value PEG is computing for the craft".  But before I launch the "pitch:" value under Burnout Stats says 0.  Is it possible that PEG isn't fully functional in this version of Mechjeb?  Or am I possibly doing something wrong?

Link to comment
Share on other sites

1 hour ago, chrisl said:

So I've read through the wiki.  I am playing RO/RSS.  I believe I'm using MechJeb2-RO-2.6.1.0-741.

One of the things the wiki says regarding Booster Pitch end is "Try to match the pitch angle at the end of the pitch program to the value PEG is computing for the craft".  But before I launch the "pitch:" value under Burnout Stats says 0.  Is it possible that PEG isn't fully functional in this version of Mechjeb?  Or am I possibly doing something wrong?

The point is that you need to launch it and watch the pitch program and see what it does.  You won't know until you get to booster sep what the value is that PEG will predict.  It may be wildly off above or below where your rocket pitch is at that point.  Based on what actually happens during the launch you need to probably adjust the pitch rate up or down to initially loft it higher or lower.

Without having a proper trajectory optimizer (more or less all that yapping I did in the long answer above about convex optimization) you are the trajectory optimizer which is done through multiple launches of the same vehicle and building up skill at getting a feel for how the rocket responds based on how you tweak the pitch angles.

Link to comment
Share on other sites

48 minutes ago, slaintemaith said:

Is there a file where one can re-define the bases/runways this is using?  I'm using a 2.5x RSS and would like to plug in the KSC coordinates.

There is ! Template

Edit: also you can add a "Lat/Lon/Alt Copy to Clipboard" button from the custom windows editor (Misc category) that will put your current position in your clipboard to make the file creation easier.

Edited by sarbian
Link to comment
Share on other sites

On the convex optimization paper, this is a much more accessible overview:

https://www.researchgate.net/publication/316988674_Survey_of_Convex_Optimization_for_Aerospace_Applications

It mentions three software packages SDPT3 (Matlab), SeDuMi (Python) and ECOS (C) which are free and can be used to solve convex problems.  Of those the latter being written in C would have a hope of being used natively by MechJeb via P/invoke to C similar to how Principia is written in C++.  Obviously someone could use kRPC to use SeDuMi, but to use python with MechJeb you'd probably want to plug MechJeb into kRPC the same way kOS has plugins for e.g. Trajectories.

Link to comment
Share on other sites

On to the next question: if you were so inclined, could you make a 'powerless' option where the autopilot attempted to bleed-off speed until 'x' (entered value) or possibly handle the reentry and then would glide to a landing from there? (a la 'Space Shuttle/Buran')

I might be wrong, but your code appears to have some sort of 'turn to bleed off speed' bits or something like it. 

I know examples have been made using KoS that'll not only land but deorbit as well. 

I won't pretend to know the numbers/variables involved in making a blanket glider autopilot, however.  I'm sure what it would be is a pain-in-the-bottom and of course any rejection to my proposal on how to spend your time will be met with, "that totally makes sense, I understand."  =)

 

 

Edited by slaintemaith
Link to comment
Share on other sites

In an attempt to whip up my own deorbit autopilot script in MechJeb, I think I see what's wrong here, only I'm not sure how to fix it...
I believe it's looking for the target's periapsis, when what I really want is a 'while' loop that will reduce my OWN periapsis to 8km.

 

7X8JInl.png

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