Shadowmage

[1.7.x] Kerbal Foundries -- Continued - Tracks, Wheels, and Gear

Recommended Posts

@Grease1991 That would really need to be fixed on that mod's end.  If it's only looking for the stock module then there's no way it will work with KSPWheel.

Share this post


Link to post
Share on other sites

I had a look at it and it could be modified to work with KSPWheelBase... but that's not on our end.  One things that is on our end is the fact that the ModuleWheelBase "isGrounded" boolean is called "grounded" in KSPWheelBase instead.  If that were renamed to "isGrounded" like the stock module, then altering their code to work for either the stock or the new module would be extremely easy I think.  I didn't look at al lof the code though, so there's still a chance there would be some conflict somewhere.  I just caught the last method in the Catapult class where it looks up all the modules on the parts.

Share this post


Link to post
Share on other sites

would it be possible to open up the CS file for the catapult and copy the {If} parts that include the modulewheelbase, paste it below while retaining the hierarchy and replace the modulewheelbase with KSPwheelbase and then replace isgrounded with grounded. and then compile it?

 

Share this post


Link to post
Share on other sites
8 hours ago, Grease1991 said:

would it be possible to open up the CS file for the catapult and copy the {If} parts that include the modulewheelbase, paste it below while retaining the hierarchy and replace the modulewheelbase with KSPwheelbase and then replace isgrounded with grounded. and then compile it?

 

You'd need to use reflection to pull the grounded field out of KSPWheelBase...

Share this post


Link to post
Share on other sites
14 hours ago, Starwaster said:

You'd need to use reflection to pull the grounded field out of KSPWheelBase...

another issue is that flywlyx said the KSPwheelbase doesn't have a collider and thats what the catapult uses to do its thing.

 

Share this post


Link to post
Share on other sites
On 20/07/2017 at 7:33 PM, Shadowmage said:

Is this on the most recent version?  If so, you could try out the previous release to see if the problem persists.  Have they ever worked properly for you (or is this your first time trying them out)?

If the older version works for you, please let me know so that I can look into whatever code I may have messed up.

Even if I switch to 0.2 spring and max damping, I still get immense bounce on landing - even at minimal vertical speeds. I remember using them a week or two back on a space plane in another save, so it is possible that something changed between then (it is at least 8 days since I flew that space plane, for sure...) This is on 2.0.2.7. I'll give a previous version a try later today and see if I can get it working.

Share this post


Link to post
Share on other sites
45 minutes ago, Tivec said:
On 20/07/2017 at 7:33 PM, Shadowmage said:

Is this on the most recent version?  If so, you could try out the previous release to see if the problem persists.  Have they ever worked properly for you (or is this your first time trying them out)?

If the older version works for you, please let me know so that I can look into whatever code I may have messed up.

Even if I switch to 0.2 spring and max damping, I still get immense bounce on landing - even at minimal vertical speeds. I remember using them a week or two back on a space plane in another save, so it is possible that something changed between then (it is at least 8 days since I flew that space plane, for sure...) This is on 2.0.2.7. I'll give a previous version a try later today and see if I can get it working.

Unfortunately, it does not seem like this has solved the issue. I have recorded a video clip that  shows the issue, and I suspect it has to do with brakes. I fly with AtmosphereAutopilot, and when forcing it to a given speed the brakes will automatically deploy, and as such my brakes will be on as I touch down. As you can see in the clip, landing without brakes seem to work out just fine, but landing with them active, causes it to flip out violently. Here's another happy spin, with brake force set to 100 on the back wheels, but nothing on the front wheel: Wheeeeeeeeee!

 

Edited by Tivec

Share this post


Link to post
Share on other sites

Have you considered to redisign your craft ?

Put additional fuselage on craft to make it longer, having more distance between front and rear wheels.
Put airbrakes behind COM, not in front or aligned with COM.
On light aircraft like this, you should have lower springs on all wheels 0.1 - 02. for front wheel and 03.-04 for rear wheels.

Damping with 0.4 up to 0.6 should be plenty for such light aircraft.

Share this post


Link to post
Share on other sites
1 hour ago, kcs123 said:

Have you considered to redisign your craft ?

Put additional fuselage on craft to make it longer, having more distance between front and rear wheels.
Put airbrakes behind COM, not in front or aligned with COM.
On light aircraft like this, you should have lower springs on all wheels 0.1 - 02. for front wheel and 03.-04 for rear wheels.

Damping with 0.4 up to 0.6 should be plenty for such light aircraft.

If you noticed, I can land perfectly fine with the brakes off. Therefore, I highly doubt that it is the spring and dampen that matters, nor the airbrakes being on the COM or not. With the default wheels, I can touch down on pretty much any surface.

Share this post


Link to post
Share on other sites
4 hours ago, Tivec said:

Unfortunately, it does not seem like this has solved the issue. I have recorded a video clip that  shows the issue, and I suspect it has to do with brakes. I fly with AtmosphereAutopilot, and when forcing it to a given speed the brakes will automatically deploy, and as such my brakes will be on as I touch down. As you can see in the clip, landing without brakes seem to work out just fine, but landing with them active, causes it to flip out violently. Here's another happy spin, with brake force set to 100 on the back wheels, but nothing on the front wheel: Wheeeeeeeeee!

 

Thanks for taking the time to investigate;  I will mark this down as an issue and add the relevant info.  Should hopefully be able to start investigating sometime this week (going to be a crazy week at work, so it might take until next weekend).

https://github.com/shadowmage45/KSPWheel/issues/44

 

11 hours ago, Grease1991 said:

another issue is that flywlyx said the KSPwheelbase doesn't have a collider and thats what the catapult uses to do its thing.

 

Yes, that is the entire point of KSPWheel -- it doesn't use the Unity WheelColliders.  If the catapult mod has hard-coded things specifically for the Stock wheel system or Unity wheel-colliders, that is not a problem I can solve.

If the author of that mod needs some minor accessibility changes made, please send him my way (and/or put up a PR for the changes).  I'm more than willing to accommodate reasonable changes for mod integration, but do not have the time to dig into or fix every mod-compatibility problem myself.

Share this post


Link to post
Share on other sites
10 minutes ago, Shadowmage said:

Thanks for taking the time to investigate;  I will mark this down as an issue and add the relevant info.  Should hopefully be able to start investigating sometime this week (going to be a crazy week at work, so it might take until next weekend).

https://github.com/shadowmage45/KSPWheel/issues/44

No problems mate, thank you for investigating, and if there's anything else I can do to help, do let me know!

Share this post


Link to post
Share on other sites
2 hours ago, Shadowmage said:

Yes, that is the entire point of KSPWheel -- it doesn't use the Unity WheelColliders.  If the catapult mod has hard-coded things specifically for the Stock wheel system or Unity wheel-colliders, that is not a problem I can solve.

If the author of that mod needs some minor accessibility changes made, please send him my way (and/or put up a PR for the changes).  I'm more than willing to accommodate reasonable changes for mod integration, but do not have the time to dig into or fix every mod-compatibility problem myself.

I'll definitely do that, cause both mods are awesome but i definitely see how limiting the coding can be on ACA from other weird things with it
 

Share this post


Link to post
Share on other sites

I really didn't see a lot of changes that really needed to be made on the Catapult mod's side to make it work really.  They would just need to use a bunch of reflection stuff to maintain compatibility with non-KSPWheel setups.  It would take a little testing and manipulating... but it most likely can be overcome.

Anyway... I don't have any time to really dig into it so... that's how it'll be until someone can convince the other party to look into it.

On the topic of the bouncing and spinning... and video does show it off nicely.  Some bounce when landing is pretty normal for a plane, but that flip was crazy.

Edited by Gaalidas

Share this post


Link to post
Share on other sites
9 hours ago, Gaalidas said:

Some bounce when landing is pretty normal for a plane, but that flip was crazy.

Agreed, a certain amount of springiness can be expected - though bounces shouldn't happen, especially not if touching down at low vertical speed and low speed in general. Stall out as you set the plane down. :wink: Source: Used to be a glider pilot.

Share this post


Link to post
Share on other sites

A tip for limiting bounciness and jittering: Adjust your damping.

Excess damping will happily lead to oscillations; since simulation rate is so very finite, the physics will tend to "overcorrect" and thus set up quite vigorous oscillations. When your craft is free to leave the ground, it'll do so and the oscillations will cease. You'll see this as a bounce. When it's too heavy to go flying, it'll probably pogo around on the ground until something breaks, it gains enough energy to fly, or it goes on-rails. Similarly, insufficient damping causes problems. The suspension will tend to go from one extreme of compression to the other very quickly, resulting in similar oscillations. Additionally, simulation fidelity falls off at either end of travel, and you should try to not occupy these unstable zones in normal use. (@Shadowmage, is my understanding accurate?)

Taken together, these properties of KSPWheel mean that you should try to occupy medium areas of strength and damping if at all possible. Bad Things™ often happen when you jam damping or strength to one side or the other, and especially when you do both.

Now, the fact that the plane's behavior seems to be correlated to brakes… very interesting. Possibly none of the above issues, but I do seem to recall some mention of "full dampers." Worth looking into, if you haven't already.

Edited by 0111narwhalz

Share this post


Link to post
Share on other sites
1 minute ago, 0111narwhalz said:

A tip for limiting bounciness and jittering: Adjust your damping.

Excess damping will happily lead to oscillations; since simulation rate is so very finite, the physics will tend to "overcorrect" and thus set up quite vigorous oscillations. When your craft is free to leave the ground, it'll do so and the oscillations will cease. You'll see this as a bounce. When it's too heavy to go flying, it'll probably pogo around on the ground until something breaks, it gains enough energy to fly, or it goes on-rails. Similarly, insufficient damping causes problems. The suspension will tend to go from one extreme of compression to the other very quickly, resulting in similar oscillations. Additionally, simulation fidelity falls off at either end of travel, and you should try to not occupy these unstable zones in normal use.

Taken together, these properties of KSPWheel mean that you should try to occupy medium areas of strength and damping if at all possible. Bad Things™ often happen when you jam damping or strength to one side or the other, and especially when you do both.

Now, the fact that the plane's behavior seems to be correlated to brakes… very interesting. Possibly none of the above issues, but I do seem to recall some mention of "full dampers." Worth looking into, if you haven't already.

Done tests with all sorts of damping and springiness settings, and unfortunately that's a no go. The same plane landed with brakes off and roughly the same vertical speed lands fine without bounce, but if the brakes are on during touchdown, I'm in for a world of hurt :D

Share this post


Link to post
Share on other sites
4 hours ago, Tivec said:

Done tests with all sorts of damping and springiness settings, and unfortunately that's a no go. The same plane landed with brakes off and roughly the same vertical speed lands fine without bounce, but if the brakes are on during touchdown, I'm in for a world of hurt :D

Just out of curiosity, probably nothing but have you tried with the motor disabled? Just thinking maybe there's some weird interaction between the brakes and motor...

Share this post


Link to post
Share on other sites
1 hour ago, Starwaster said:

Just out of curiosity, probably nothing but have you tried with the motor disabled? Just thinking maybe there's some weird interaction between the brakes and motor...

A good suggestion but alas, didn't work out. Tried with motor lock on and off, motor strength set to 0, but no luck.

Share this post


Link to post
Share on other sites
3 hours ago, Tivec said:

A good suggestion but alas, didn't work out. Tried with motor lock on and off, motor strength set to 0, but no luck.

And, I assume, you've attached stock gear to it to be sure it doesn't happen with those?

Share this post


Link to post
Share on other sites
2 hours ago, Gaalidas said:

And, I assume, you've attached stock gear to it to be sure it doesn't happen with those?

Yup, confirmed does not happen with stock gear, I've been flying around using those for a long time in this save without incident.

Share this post


Link to post
Share on other sites

Re:  Bouncing with brakes enabled -- haven't yet had time to investigate, but I have some ideas on what could be causing it.  My current thinking is that the brakes are putting out too much torque, causing the rear wheels to 'snag' on the terrain, which would over-compress the front wheel, driving it into the lower end of its suspension, which would cause an exaggerated suspension response, resulting in a bounce.  (haven't even had time to view the video yet, sorry;  got called into work both Sat and Sun, and still working late all this week, so my free-time is... non-existent for the foreseeable future).

 

Re:  Aircraft catapults -- after looking over the source code for that mod, I'm not sure that there is any way to make it compatible due to its use of trigger colliders.  The standard Unity WheelCollider interacts with trigger colliders as if it were any other collider;  the KSPWheel collider cannot do the same as it is not an actual collider and not hooked into the low-level physics back-end code.

The best I might be able to offer is a workaround where the KSPWheel collider would do a per-tick examination of colliders in an area around its contact point, and call their trigger methods manually.  Would be slow, hacky, and probably error prone.  Certainly open to ideas/suggestions on alternate solutions.

Share this post


Link to post
Share on other sites
5 minutes ago, Shadowmage said:

(haven't even had time to view the video yet, sorry;  got called into work both Sat and Sun, and still working late all this week, so my free-time is... non-existent for the foreseeable future).

Absolutely no worries. I am not forced to use the wheels, the stock ones are still passable for my purposes at the moment :) Take your time, don't stress it. (But I have to say, you'll enjoy the second video, it's spinny wheeeeee!)

Edited by Tivec

Share this post


Link to post
Share on other sites
5 hours ago, Shadowmage said:

Re:  Aircraft catapults -- after looking over the source code for that mod, I'm not sure that there is any way to make it compatible due to its use of trigger colliders.  The standard Unity WheelCollider interacts with trigger colliders as if it were any other collider;  the KSPWheel collider cannot do the same as it is not an actual collider and not hooked into the low-level physics back-end code.

The best I might be able to offer is a workaround where the KSPWheel collider would do a per-tick examination of colliders in an area around its contact point, and call their trigger methods manually.  Would be slow, hacky, and probably error prone.  Certainly open to ideas/suggestions on alternate solutions.

My thought was maybe just tieing to to another part in the mod simular to the way arresting hook and tail hook operate, like maybe a tow bar that you can place that would catch the catapult, it would allow for more range of landing gear setup, (this is ksp after all) but i realize this isn't the thread for this, 

I also assume that adding a collider to kspwheel that really does nothing except let the catapult grab it is alot more difficult and error prone than it sounds. 

 

Share this post


Link to post
Share on other sites
1 hour ago, Grease1991 said:

I also assume that adding a collider to kspwheel that really does nothing except let the catapult grab it is alot more difficult and error prone than it sounds.

Yeah, I'm not sure that I could add colliders that wouldn't interfere with either the suspension mechanics or collision response.

The real question would be -- does a 'trigger' collider also trigger other 'trigger' colliders?  Or is it only physicsCollider->triggerCollider interactions?  (more of a rhetorical question / request for information, likely only a few on the forums would be able to answer that).

Share this post


Link to post
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.