Jump to content

[PART, 1.0.2] Anatid Robotics / MuMech - MechJeb - Autopilot - Historical thread


r4m0n

Recommended Posts

  • 2 weeks later...

I don't know about others, but i miss one feature that was in mj1, that was the launch timing. so you could time your launch to instantly end up near your target in orbit

ok, it was nicely hidden, now i found it and at the moment i am trying it, Thanks

Edited by m2ger8
Link to comment
Share on other sites

Ever tried selecting a Target and looking into the Launch Guidance AP?
I did. Neither "start into targetplane" nor "launch to target" works. Instead, it does some really weird stuff that i can't comprehend.

So, adding such features would be nice ;)

Link to comment
Share on other sites

I have used "launch to target" many times. It does in fact work. It requires you to do a practice launch first so that MJ2 can establish a file for that particular vessel. Once that file has been established, it will launch your vessel at the appropriate time to rendevous with the target.

Link to comment
Share on other sites

Hello there everyone, I'm a teacher looking to utilize Mechjeb in the classroom, but I have an issue with the part of Mechjeb that is named "Smart A.S.S." there is no way I would ever (in a billion years) be allowed to run such an unfortunately named program when kids would be able to see it or even stumble on it accidentally when they are given the ability to build their own ships.

That being said, is there any way to modify the mechjeb file to remove or rename that particular phrase?

Any help would be immensely appreciated.

Thanks in advance & God bless!

- Mr. S

Link to comment
Share on other sites

There is nothing I could do or say that would convince parents and my administration that it is acceptable to display in front of 5th graders. I realize it may be meant as a joke, but it doesn't fit the requirements of an educational environment.

Link to comment
Share on other sites

I have been having a problem with MechJeb 2.0.9 - let me explain:

I have a craft that uses checmical rockets to get into orbit, electric propulsion to travel to a celestial body with an atmosphere (ie laythe), enter the atmosphere, decend (fast) on parachutes and then just before impact fire final stage of 2 seperatons to slow for impact. The electric propulsion is built into the craft that will decend. Here is the craft file. And here is a close up picture:

screenshot45.png

The problem is that when I come to execute manuover nodes (which with the ion engine will take a long time) rather than starting at -10m as I would have expected, mechjeb starts the manuover at -2s. I looked into it and believe that this problem could be overcome with a change in FuelFlowSimulation::AllowedToStage. There is an assumption that if a stage is not being removed from the craft, then it is OK to stage even if it has not spent all its fuel. (as a side issue this has always annoyed me as it means that if I have a stage for seperating fairings, and another for releasing the cargo, the fairings will get released as soon as the previous stage is active). In this scenario the problem that it causes is that the fuel flow simulation fires the seperatrons as soon as the electric engine becomes active. As a consequence it considers that the craft is going to have a much higher TWR than it will with just the ion engine, and so it does not start the manuover until it is too late.

You can see what it is thinking by looking at the delta-v table that it comes up with for the whole craft. I wouls have expected the ion delta-v to show up in stage 2, but it as all been moved to to stage0. See below:

screenshot46.png

I believe that I can fix the problem by changing the method to be:

        //Whether we've used up the current stage
public bool AllowedToStage()
{
List<FuelNode> activeEngines = FindActiveEngines();

Debug.Log("Checking whether allowed to stage at t = " + t + " SimStage = " + simStage);
Debug.Log(" activeEngines.Count = " + activeEngines.Count);

//if no engines are active, we can always stage
if (activeEngines.Count == 0)
{
Debug.Log("Allowed to stage because no active engines");
return true;
}

var burnedResources = activeEngines.SelectMany(eng => eng.BurnedResources()).Distinct();

//if staging would decouple an active engine or non-empty fuel tank, we're not allowed to stage
foreach (FuelNode n in nodes)
{
if (n.decoupledInStage == (simStage - 1) && !n.isSepratron)
{
if (activeEngines.Contains(n) || n.ContainsResources(burnedResources))
{
Debug.Log("Not allowed to stage because " + n.partName + " either contains resources or is an active engine");
return false;
}
}
}

// We are not allowed to stage if there is an active engine that still has access to resources
foreach (FuelNode n in nodes)
{
if (activeEngines.Contains(n))
{
if (n.CanDrawNeededResources(nodes))
{
Debug.Log("Not allowed to stage because " + n.partName + " is an active engine that still has resources to draw on.");
return false;
}
}
}

//if this isn't the last stage, we're allowed to stage because doing so wouldn't drop anything important
if (simStage > 0)
{
Debug.Log("Allowed to stage because this isn't the last stage");
return true;
}

Debug.Log("Not allowed to stage because there are active engines and this is the last stage");

//if this is the last stage, we're not allowed to stage while there are still active engines
return false;
}

This also resolves the delta-v table not being dispkayed correctly. (see below (I have been hacking around with different mechjeb forks - I dunno why the gui is broken on this build, but you can still read the table!)

screenshot43.png

So I suppose I have a few questions:

1) Is my thinking about the staging logic fair or does the current more aggressive staging strategy help in some way (personally I have only ever noticed it not doing what I want)

2) Should I raise this as a bug in github, and if so which github? I see that there are several forks now. Where should I raise this?

3) I see one of the forks is drawing various patches together. Is there a way that I can package a fix for this up as a patch and have it rolled into a maintained release?

At the moment I have not tested this change thourghly as I am not really sure which codebase to work from - I could really just use some advise on how best of offer this to the community if it is desireable.

Link to comment
Share on other sites

Hello there everyone, I'm a teacher looking to utilize Mechjeb in the classroom, but I have an issue with the part of Mechjeb that is named "Smart A.S.S." there is no way I would ever (in a billion years) be allowed to run such an unfortunately named program when kids would be able to see it or even stumble on it accidentally when they are given the ability to build their own ships.

That being said, is there any way to modify the mechjeb file to remove or rename that particular phrase?

Any help would be immensely appreciated.

Thanks in advance & God bless!

- Mr. S

Yes it is technically possible. It requires editing the source code to remove the offending code and then compiling it.

The file that needs editing is MechJebModuleSmartASS.cs


public override string getName()
{
return "Smart A.S.S.";
}

Change that to return something different (Attitude Control or whatever else you want)

Are you capable of doing that or do you have anyone who can do that?

Link to comment
Share on other sites

Yes it is technically possible. It requires editing the source code to remove the offending code and then compiling it.

The file that needs editing is MechJebModuleSmartASS.cs


public override string getName()
{
return "Smart A.S.S.";
}

Change that to return something different (Attitude Control or whatever else you want)

Are you capable of doing that or do you have anyone who can do that?

Starwaster & Nathan - thank you so much for your responses, I am happy to here there is a potential solution for me.

I do not know how to do what you are suggesting off the top of my head, and I'm not sure how I would go about doing it, but I have used Hex type editors before to change things in my registry by searching for a term then replacing it.

I would just need to know how to open the file and search and replace the offending items. (In the past I have followed a walkthrough with screengrabs and that was fairly straightforward without the potential for any mistakes.

Please let me know what your advice is - It means a lot to me!

Link to comment
Share on other sites

I ran a search for "MechJebModuleSmartASS.cs" from my computer (within the KSP_Win directory) but did not come up with any results.

Sorry, let me clarify. I'm referring to source code (which is linked to on the first page....) You would have to download the source, make the changes there and recompile it into a new mechjeb2.dll file

Link to comment
Share on other sites

Sorry, let me clarify. I'm referring to source code (which is linked to on the first page....) You would have to download the source, make the changes there and recompile it into a new mechjeb2.dll file

Ok... I certainly do not know how to do that, maybe I can find someone who does. Thank you for the help and advice.

Link to comment
Share on other sites

I asked on a seperate thread, but others suggested I ask here - has anyone tried to add support to mechjeb landing guidance for parachutes? I am about to start hacking up some suppoprt for it, but did not want to if others already have, and I also wondered if there were ideas for features in this areas before I start.

Link to comment
Share on other sites

I asked on a seperate thread, but others suggested I ask here - has anyone tried to add support to mechjeb landing guidance for parachutes? I am about to start hacking up some suppoprt for it, but did not want to if others already have, and I also wondered if there were ideas for features in this areas before I start.

not sure... I dont THINK so but on the other hand I would swear parachutes deployed once for me on an autopilot landing. maybe that was a bug. maybe I hallucinated it. ohnoes ima hallucinating again...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...