Jump to content

[PLUGIN] [0.2x.x] Automatic Centre of Mass Tracking - 0.01


ecat

Recommended Posts

Starting with a design for an asymmetrical craft I knew there would be problems placing the engines. Realising the craft would go from a mass of 50t empty through 87t fully fueled all the way to 190t with a full load of kethane it was obvious that no simple 'three engines fixed in place' solution existed. I had to find some way to move those engines.

With almost perfect timing Sirkut and Devo released an extension to the Infernal Robotics (IR) mod, adding the possibility of linear movement via an adjustable rail. Add the rail to the rear of the craft, affix the engines to the rail and... Perfect...

NIPInSpaceRear.jpg

... almost...

Finding the correct position for the engines was not as tricky as I expected it to be, well, after a couple of guesses at least. The problem came when under power as the Centre of Mass slowly shifted, reaching the impossible when under x4 physics acceleration during those long NERVA burns. If only I could get the rails to adjust automatically.

I came up with an ever so simple solution that worked well for a limited set of rail orientations. Good enough for my requirements. During some tests I made a video which I posted to the main IR thread http://forum.kerbalspaceprogram.com/showthread.php/37707-0-21-Magic-Smoke-Industries-Parts-Infernal-Robotics-0-8

... and it turns out I'm not the only one interested in forcing the asymmetrical to behave in a civilised fashion. After a few requests and a craft designed to take advantage my magic rail tracking, should I ever release it, I got down to the serious business of turning a one-off solution into something which should, hopefully, work in a good number of configurations...

So, here we have it. The beta release of my... what should we call it?... ecCoMAdj for IR Adjustable Rail.

The zip includes the plugin and two parts:

'ec Cube of Rail Balance' which is a tracking enabled Cubic Strut that can be found under Structural.

To use this part, place the IR Adjustable Rail (full size, 1/2 or 1/4) then place the part on the rail. Part on rail, it will not work any other way. Once the part is placed you a free to reposition the rail any way you wish. You are also free to add any other parts, an engine for example, to the ec Cube.

'ec LV-T45 Liquid Fuel Engine' which is a tracking enabled LV-T45 which I've hidden under Propulsion.

This is used in much the same way as the above BUT the 'Editor Extensions' mod is needed as the modified engine can only be placed directly on the rail if 'Surface Attachment' is enabled.

To install just copy the ecMods directory to your GameData directory.

Requires Infernal Robotics

http://forum.kerbalspaceprogram.com/showthread.php/37707-0-21-Magic-Smoke-Industries-Parts-Infernal-Robotics-0-8

The zip also includes four demo craft for your VAB.

ecCoMAdj Test 1 ec T45 NoMJ

ecCoMAdj Test 1 ec Cube T45 NoMJ

ecCoMAdj Test 1 ec T45

ecCoMAdj Test 1 ec Cube T45

All should reach orbit but none have return capability so be ready to 'Revert Flight' before you strand your pilot. The Cube versions use a standard engine mounted on an ec Cube, the non-Cube versions mount the engine directly to the rail.

By default CoM tracking is disabled. To enable either set an action key or right click the part in flight.

The code still includes a little debugging output that may swell your log file a little but hopefully no by too much.

--------------------------------------------

Zip...

http://www.i2net.me.uk/files/Games/KerbalSP/MyMods/ReleasedMods/ecCoMAdjModule/ecCoMAdjModule-00.21.00.01-Mod.zip

--------------------------------------------

Source...

License:

Released under CC BY-NC-SA 3.0

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

http://www.i2net.me.uk/files/Games/KerbalSP/MyMods/ReleasedMods/ecCoMAdjModule/ecCoMAdjModule-00.21.00.01-Source.zip

If anyone knows of a better way to do the 'which way is the rail pointing' code I'd be more than happy to hear from you. As it is, it's light weight and works. In fact if anyone knows of a better way to do any of this, as it's my first KSP mod I'd love to hear form you :)

Edited by ecat
Link to comment
Share on other sites

Nice job, i can see where this is going to help many people. Your giving some freedom in designing

Freedom. Good word :)

There are already a couple of balance around CoM mods out there but iirc both of them require extra engines, achieving balance by varying the thrust distribution. Not quite what I was after and this did start as something just for me, until a few folk expressed their interest.

Would an empty gameobjects help you with which way the rail is pointing?

Something like the thrustTransform object ? http://forum.kerbalspaceprogram.com/showthread.php/35225-Some-lesser-known-bits-of-info-for-addon-developers?p=515883&viewfull=1#post515883

That may sound knowledgeable but I read about it just 10 minutes ago! If it works the way I think it works then it certainly should help. I think - my knowledge of all this 3d space stuff is close enough to zero to be, zero. Even if it doesn't help, what's in there works quite well, just not the way I think game programmers would do it.

Link to comment
Share on other sites

Thank you for the compliment :)

If I understand the idea behind the engines and thrustTransform correctly your proposal of an empty gameobject is spot on. This would need to be added to the adjustable rail in unity?

I can poke around myself or do you wish to make it a standard IR feature?

Link to comment
Share on other sites

  • 1 month later...
Dear Jeb this thread was a pain to find! I vant this mod, had to locate it!
Dear Jivaii,

I'm sorry you had trouble tracking this mod down, I'm afraid it is stuck in a limbo between the chicken, the egg and the impossible. This thread has links to my good friend ecat's youtube channel, ecatvids, which doesn't help much if you cannot find the thread. The relevant videos on the youtube channel have links to this thread, which are again quite useless if you are unaware of their existence or the gods of search engines frown upon your key phrase. Ecat did consider posting this mod to the spaceport but every time he has tried to search the 'port he has had difficulty locating the mods amongst the multitude of optimistically keyworded craft. Perhaps a later release will be blessed with greater visibility.

I thank you for your patience in locating this mod and look forward to both seeing and piloting whatever awesome crafts you go on to create.

Best Regards

Jeb.

(ten char)

Link to comment
Share on other sites

I was wondering if this mod could be used for rcs thruster placement to automatically adjust to the centre of mass to allow for easy translation in space? because getting rcs thrusters balanced in the vab is a nightmare! I know there is the rcs build aid mod already however even that can be fiddily at times when you cant get the thrusters in the right place!

Link to comment
Share on other sites

I was wondering if this mod could be used for rcs thruster placement to automatically adjust to the centre of mass to allow for easy translation in space? because getting rcs thrusters balanced in the vab is a nightmare! I know there is the rcs build aid mod already however even that can be fiddily at times when you cant get the thrusters in the right place!

Well, there's the rub, eh? As I understand it, this mod uses IR parts (adjustable rails) to move the position of the ENGINE(s) to cause the center of thrust to pass through the center of mass, even as the CoM changes, dynamically. So, if you can't position RCS thrusters properly in the VAB (and believe me, I hear you on that, brother! It ALWAYS needs them to be RIGHT where I've already placed a wing or engine or something that I just can't relocate...), then this probably wouldn't solve your problem. Put another way, the engine/thruster must be able to at least GET TO the right place to start out with, got it? :) I'm not saying that it would never work for RCS placement, I just think that it may not be the solution you seek. I could be wrong. It happened once, I thought I'd made a mistake. ;P

Link to comment
Share on other sites

Dare I ask if this could be used with a hinge or something similar? Mostly for use on shuttles to help keep them balanced..

+1. There's an old VTOL part in the Damned Aerospace pack that pivoted an engine 90 degrees. It might be worth asking DYJ if it could be rolled into IR for this purpose. DA also had wing pivots, which could be used to match centre of lift with centre of mass in a similar method.

Link to comment
Share on other sites

Is it possible to use the same thing but with engine thrust balancing instead of the rail? For example you have multiple engines but one tank spends more (like in the shuttles), so that you slowly reduce power in one engine and increase in the other to keep the balance. That would cut most of the problems with building shuttles

Link to comment
Share on other sites

I hate to ask this but does this still work with the update to 8.0b that magic smoke put out yesterday? Because I have the part and can toggle the CoM, but nothing moves on it's own. Either that or this mod is conflicting with something else I have. Any help would be greatly appreciated.

Link to comment
Share on other sites

I was wondering if this mod could be used for rcs thruster placement to automatically adjust to the centre of mass to allow for easy translation in space? because getting rcs thrusters balanced in the vab is a nightmare! I know there is the rcs build aid mod already however even that can be fiddily at times when you cant get the thrusters in the right place!

Well, there's the rub, eh? As I understand it, this mod uses IR parts (adjustable rails) to move the position of the ENGINE(s) to cause the center of thrust to pass through the center of mass, even as the CoM changes, dynamically. So, if you can't position RCS thrusters properly in the VAB (and believe me, I hear you on that, brother! It ALWAYS needs them to be RIGHT where I've already placed a wing or engine or something that I just can't relocate...), then this probably wouldn't solve your problem. Put another way, the engine/thruster must be able to at least GET TO the right place to start out with, got it? :) I'm not saying that it would never work for RCS placement, I just think that it may not be the solution you seek. I could be wrong. It happened once, I thought I'd made a mistake. ;P

This mod should work with RCS so long as the rcs thrusters are in a single ring and each is centred over an ec Cubic part. As Neutrinovore mentions, the rails do take up valuable space but you could regain some of that by placing a modular girder between the ec Cubic and rcs thruster using the additional surface area for solar panels, batteries etc. Just don't go putting too much mass on the moving part as this will have a significant effect on the CoM when it moves.

Dare I ask if this could be used with a hinge or something similar? Mostly for use on shuttles to help keep them balanced..

The plugin should support most if not all of the IR parts, exactly what sort of motion you end up with... well, experimentation is required. I do have a shuttle design somewhere that mounts the three orbiter engines on a single rail, it works quite well. I'll dig it out if you want?

Is it possible to use the same thing but with engine thrust balancing instead of the rail? For example you have multiple engines but one tank spends more (like in the shuttles), so that you slowly reduce power in one engine and increase in the other to keep the balance. That would cut most of the problems with building shuttles

As Adyx mentions there are a couple of mods out there that do exactly this. The two methods have there own pros and cons, it's always nice to hav a choice :)

I hate to ask this but does this still work with the update to 8.0b that magic smoke put out yesterday? Because I have the part and can toggle the CoM, but nothing moves on it's own. Either that or this mod is conflicting with something else I have. Any help would be greatly appreciated.

No harm in asking :)

I've been away from the game for a short while and have not tested 8.0b. I'll give it a go when I have time and report back to this thread.

Link to comment
Share on other sites

@Malsheck,

Just ran a couple of tests with 8.0b and everything looks fine. If you're still having problems could you post a picture of your craft or the craft file or both and I'll check what's going on.

Link to comment
Share on other sites

  • 2 weeks later...

Would it be possible to add this module to a IR rail, rather than an added piece? I hadd assumed I could just add this:

MODULE
{
name = ecCoMAdjPart
}

to a rail cfg, but the 'Adj' part of the module name leads me to believe it links in to adjacent parts and may not pick up on its actual host part...?

If this is the case, would it be possible for you to release a slightly tweaked module that works on the host part itself?

Link to comment
Share on other sites

Would it be possible to add this module to a IR rail, rather than an added piece? I hadd assumed I could just add this:

MODULE
{
name = ecCoMAdjPart
}

to a rail cfg, but the 'Adj' part of the module name leads me to believe it links in to adjacent parts and may not pick up on its actual host part...?

If this is the case, would it be possible for you to release a slightly tweaked module that works on the host part itself?

That is a very good question.

You can certainly add the module but it will not work unfortunately. This was a deliberate decision as I didn't want to scare people away with the thought of .cfg editing. Also, 'the part' can be placed anywhere on the rail which is I think more intuitive and gives more flexibility than having to guess the centre of the rail and position it appropriately, but that's just my thought on the matter. And if you have a use for it...

Can it be made to work this way? Maybe. I need a location on both sides of the rail, at the moment the CoM and the origin of 'the part', since the origin of the rail is usually fixed to the craft a rail only solution may be impossible for me to do. I may be able to add the module to the rail and then track the first part, any type of part, to be added to the rail, would this help you?

I may also be able to access the sub objects of the rail which would make for a rail only solution. I don't know how or if this can be done. Any advice on this would be welcomed.

Edited by ecat
Link to comment
Share on other sites

  • 2 months later...
any plans on updating this? the Idea is great.

There's not much to update at this time, unless someone reports a bug. With that said I have not tested with 0.23 yet, I'll go through that soon and if inspiration or bugs strike I'll see what I can do :)

Link to comment
Share on other sites

  • 1 month later...

This mod is awesome! I remember seeing it in a demo video for a kethane miner (Mosquito?) and thinking "I must have this". And now I do! One question; is there a possibility of this being updated to account for thrust angle? That would make building shuttles and the like a lot easier.

Link to comment
Share on other sites

Just a little mod that fills a small niche, thank you for your kind words. The Mosquito is certainly fun and the video is linked in the OP.

The idea behind the shuttle is to angle the engines so the thrust compensates for the imbalanced mass, are you asking for the engines to move along a plane or for their angle to change? If you can give me an example of what you are trying to achieve I'll certainly take a look.

Link to comment
Share on other sites

-to angle the engines so the thrust compensates for the imbalanced mass, are you asking for the engines to move along a plane or for their angle to change?

When I'm building shuttles I have a lot of trouble keeping the CoM stable; it jumps when the SRB's drop, then gradually shifts along the length of the craft as the tank empties. Probably just a symptom of shuttle design/bad design, but it'd help if the engines could compensate. So what I mean is a change of angle to keep the CoT pointed at the CoM.

Link to comment
Share on other sites

The only way I can change the angle is by using an Infernal Robotics Rotatron: put a CoM Cubic on the top half of the moving disk and somehow mount the engine to the bottom half of the moving disk. This will certainly change the angle as the CoM changes but I do not think the control will be fine enough ie it will sweep through too large an angle.

Have a look at the engines from this pack http://forum.kerbalspaceprogram.com/threads/55985-0-22-01-Dec-Space-Shuttle-Engines-V0-8-Performance-and-smart-parts .Designed for shuttle use I believe they have a very large gimble range.

Another thing to try if you have multiple engines is a thrust balancer. There are two such mods I'm aware of on the forum, sadly I can find only one...

http://forum.kerbalspaceprogram.com/threads/28044-WIP-Plugin-KerbCom-Avionics-Analytical-engine-and-RCS-thrust-balancing

I cannot say for certain if it works with 2.3. I'm offering a free, one previous owner, Rotatron to anyone who can point me at the other thrust balancing mod that used to be around here.

Let me know how you get on. All my shuttle craft are either ugly or 'not really' shuttles so ideas are always welcome :)

Edited by ecat
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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