[OPEN-SOURCE] Machinery Modelling Toolkit

Work in progress:
54595cacd9b15bcb4002a8697dbd62a0ee4f6dfd.jpeg

Compiled version is here if you want to give it a try :smiley:
https://www.dropbox.com/s/7koyioj300n4rt7/MMT_Content_Hovercraft.zip?dl=0

Controls:
Press 2 to posses Hovercraft
E - will turn on “hover” engine and Q will turn it off
WASD - to steer using the prop engine

It’s really hard to steer it, but not because of the simulation but crappy design of the hovercraft itself :smiley:
This is one of the reasons why I’m working on this project, for me personally its an ability to model some approximation of the behavior of the real machine. That’s why its called Machinery Modelling Toolkit. Where Modelling stand for approximating physical behavior rather than building a detailed 3d mesh.
But I digress, the reason why it steers so bad is because I’m and awful hovercraft designer. I decided not to copy some existing design, like this one
b12548c5afe2c8ec21c62a0320d5f83ebc87d901.jpeg
but try to design something simple on my own. First mistake, is that prop engine is too high above the center of mass, this creates a lot of torque from propeller thrust in tight turns and when accelerating. Second mistake is steering using single engine by rotating it, instead of having an airfoil on the tail. The difference is that tail will work even if engine doesn’t provide any thrust, just by deflecting incoming air, when hovercraft is costing, like on a glider for example. But here you need to turn engine and press on throttle, which will add some extra torque that you don’t want.
Anyway, this can be a really nice use-case for adding PID controller to help user with steering.

Feedback is very welcome, sorry for absence of GUI, I’ll try to add it before next build.

EDIT: Forgot to establish context for this post. This is the “machine” for “tutorial” on how to use MMT plugin. This hovercraft is relatively simple and has few components. Math is simple too. Prop engine is a re-usable component from Aerosled, the only custom thing here is a rigged mesh for the hovercraft skirt and an air pressure component which imitates air-cushion effect.

Haha nice… it is indeed very hard to steer :smiley:

I work with Naval Architects a lot, I think I will show them this… they will love it :slight_smile:

Very curious about feedback :smiley:
I think I was wrong about simulation being correct - skirt produces too little friction. My friction coefficients where rather small.
Another thing is that there should be more control over the air pressure in air-cushion. I’m not sure, but most likely in real life, pilots can adjust the hovering effect to balance speed and control. The less contact with the ground you have the faster you can go but at the same time it’s harder to steer as there is less friction of skirt with the ground/water. Right now you can do something like emergency brake by shutting down hover engine. From videos of the real craft they seam to operate it in similar way. Right before it vehicle stops, cushion gets a bit deflated so you get more friction with the ground and you stop faster.

Experimenting with different shapes for collision elements of the skirt. Up-side-down pyramidal prisms are working better than capsules, they can go over higher obstacles and movement is more smooth.
Added ability to change throttle of the hover engine. At 60% of engine power can be used as emergency or parking brake. At 70% percent, friction drops enough to start moving around but at the same time you have much better control over steering. At 100% you can get the maximum of acceleration but fiction is too small to steer effectively:
c297d06a95b1cf5df4a066113709ec275514d69c.jpeg

Compiled version:

Prop engine is placed much lower, this should minimize torque around Y axis.
We need two controllers to steer this efficiently. One would be a PID controller to help pilot with maintaining a direction in which he wants hovercraft to move. Second controller will detect when steering is inefficient because of luck of friction and will power done hover engine until control is restored.

@ : Can you pm me your e-mail adres? I want to ask you something… somehow I don’t think you have pm notifications turned on :wink:

Replied about an hour ago, did you received it?

ah yes, got it! thanx :wink:

interesting… indeed It handles pretty good when hoover throttle is at 70% … lower and it’s hard to move… put it to 100% and it becomes very hard to keep under controll.
I wonder how they do this with real hovercraft… doe they also have a sort of hoover throttle?

Most likely they do control it as long as they use friction with the ground to assist in steering. Like when you enter a turn and vehicle starts to slide sideways. Some of the hovercrafts have additional systems for steering, for example this one:

has two curved tubes in front part, they are placed right on top of the main engine and exhaust from them is used for steering. Those tubes can turn independently from the rudders at the back. I’ve heard that there are other systems which release part of the air through the series of vents in the skirt, which allows to move vehicle in any direction regardless of it’s orientation. Small racing hovercrafts can be steered by the driver, simply by leaning into different directions, which moves center of mass and add both torque and sideways force.

I’ve added PID Controller to MMT as one of re-usable components. It can be used to help with steering of physically controlled bodies.
This is a simple example where aerosled’s chassis is rotated by output of PID controller, to keep orientation with red arrow. Red arrow is turning using user input. The rotation is done using AddTorque() and chassis has no friction on it, so imagine how hard would it be to control it if you apply torque manually using keys.

Applications are numerous, for example if you have a physics based vehicle and you want AI to drive in a certain direction, PID controller can steer a wheel for you. Or maybe you have a spaceship or helicopter and you want to turn it to face specific direction. For something like a hovercraft you can control the output of the hover engine to maintain specific altitude. Keeping vehicle on cruising speed or restoring a balance of a platform. Some of these things can be done using “springs” but PID controller exhibits more “intelligent” behavior. In practice it’s a very simple mathematical construct and you can read more about them here: PID controller - Wikipedia

nice!

Is this also something you could use for a gun stabilisation system.
I’ve been thinking about how on earth you could do that.

So while driving, the barrel remains fixed at a certain target, like an aim constraint. Correcing the rotation of the barrel based on the pitch and roll of the main hull.

I see great use for AI indeed, and maybe ROV’s , Drones, Helicopter.

Yeap, all what you need is an “error” between what rotation should be and what rotation you have now. You could use a single controller or two separate controllers for pitch and yaw, then they can converge with a different speed.
They way it works is you feed error to controller on each step you want correction to be applied. Then you just get a control output, which is normally is just a float value. The behavior of controller is governed by 3 coefficients which you need to tune. One is responsible on how fast you want to correct error, second removes error accumulating over multiple frames and lastly third removes oscillation. I’ll make a tutorial on how to use them.

Thanks so much for providing an StayUpRight pawn, been trying to find an working example past couple days and all the links before this have been removed/dead.

You are welcome! Be careful with it, it employs two tricks. High angular damping - otherwise it spins like crazy as pointy base is not good in providing angular friction. One end of the spring is higher then object surface, this makes it more stable as it will pull object slightly up over it’s center. Pulling directly to the center will add a lot of oscillations.

Update on Hovercraft. I’ve lost a battle to small collision primitives attached to bones. They make it almost impossible to pass over obstacles. Solution is to remove them and add friction manually (I’ll make a component for this).
Steering of the vehicle is done using PID Controller, we just point a direction where we want to go and press W button to provide throttle to the engine, controller does the rest:

[video is recorded using Camtasia, while I was recording UE4 was behaving really choppy. Any suggestion on what to use for screen capture? I need something reliable to record tutorials later]

Friction is right now fake and doesn’t depend on hovering engine, it’s simply done using linear damping. This is going to be fixed with next update or so.
I’ve pushed latest version of code to GitHub. Code is very alpha and many things are going to change! Sharing so you could already start using PID Controller as it’s rather final but not too well documented.
Compiled version is here:
https://www.dropbox.com/s/7koyioj300n4rt7/MMT_Content_Hovercraft.zip?dl=0
Controls:
1 - posses PID controller example
2 - posses Hovercraft
Q/E - Hover engine throttle
A/D - change desired direction of travel
W/S - steering engine throttle, keep holding W for controller to steer hovercraft

EDIT: A bit silly from my side, but hovercraft doesn’t benefit from sub-stepping yet. I would need to refactor some pieces of code for that.

With the PID controller it seems better controllable :slight_smile:

I use icecream screenrecording software… never have problems with choppy recordings in UE4. Screen Recorder: Gratis Beeldscherm Opnemen - Icecream Apps

New version is up. Both git repository and executable are updated. You can grab fresh version from here or first post:
https://www.dropbox.com/s/55dazkm8q4s0axn/MMT_Content.zip?dl=0
https://github.com//MMT_Content

Tracked vehicle are ported into MMT. They don’t use physics sub-stepping yet, but you can already use this repo instead of Tracked Vehicles as most likely any bug fixes will be done here first. Please try them out and tell me if something is broken. There were some legacy code to attach one machine to another, as it was half complete I’ve removed it. It will be added later with proper implementation.

As to other additions, Hovercraft’s components are now properly made to work with physics sub-stepping. No proper friction component yet, for now friction is imitated using linear and angular damping.
Added physics sub-stepping visual debugger component, which you can feed debug lines or strings, in sub-step thread, and it will render them right after physics update is finished.

There were some other changes here and there mostly for organization of folders, naming convention and cleaning.
Added some simple Main Menu:

Feedback and ideas are welcome!

Thanx!

I will be moving over my CV90 and Tiger build from the tracked vehicle blueprint and use the MMT build from now on.

Thx, maybe a little tutorial when 4.11 out?

Sure, Zip! I was thinking about a complete tutorial of hovercraft when it’s done. To show all steps how to build it from ground up. But perhaps a series of shorter tutorials is needed. Something like this:
#1

  • How to add plugin into your own project
  • How to make simple physics driven actor
  • How to enable and use physics sub-stepping
  • How to package project

#2

  • Why physics sub-stepping is important
  • Using controllers and applying forces during sub-stepping
  • Design considerations for components and actors

Then do something about hovercraft. I don’t know if this is optimal, maybe some other subjects are of more interest to you?