Space Engineers

Space Engineers

DAS - Driver Assisting System
此主题已被锁定
£6lbs._onion 2021 年 8 月 18 日 上午 10:12
[SOLVED!] "Sunbathing seal" Problem with Vehicle + Trailer (all axis hitch) setup.
Issue:
  • When trailer Suspensions control are given to the script, the main vehicle's Rear Suspensions are significantly weaken - results in the whole setup looking like what I like to call "Sunbathing Seal" (hence the title.)

Fix tried:
引用自 author
@Λlyx's Van the script has problems with pitch-free hinges. If you can leave with static strength on trailer wheels I can suggest the script edits:
find the line:
if(Math.Abs(UserInput.AD) < 0.2) // !!workaround: steering bug
replace it with:
if(Math.Abs(UserInput.AD) < 0.2 && !suspension.IsSubgrid) // !!workaround: steering bug

Working Fix
引用自 Wanderer_308
All right, i come with alternative approach, instead of finding a workaround for an issue, we will (or try to) fix it. Scrap all previous edits and do this:
find code:
suspension.WeightDistributionRatio=Math.Abs((suspension.WheelPositionAgainstCoM.Z-frontHalfZ)/wheelsBaseZ*weightRearRatio);
else
suspension.WeightDistributionRatio=Math.Abs((rearHalfZ-suspension.WheelPositionAgainstCoM.Z)/wheelsBaseZ*weightFrontRatio);
replace it with
suspension.WeightDistributionRatio=Math.Abs(((wheelsBaseZ-suspension.WheelPositionAgainstCoM.Z)/wheelsBaseZ)*weightFrontRatio);
else
suspension.WeightDistributionRatio=Math.Abs(((wheelsBaseZ+suspension.WheelPositionAgainstCoM.Z)/wheelsBaseZ)*weightRearRatio);
Those should redistribute strength across all wheels, more strength closer to CoM, less to the periphery. Test it and say how is it going. I wanted to change the formula a long time ago, even did a math model at work, but forgot it there.


Result:
- RESOLVED!
最后由 £6lbs._onion 编辑于; 2021 年 8 月 21 日 下午 2:30
< >
正在显示第 1 - 13 条,共 13 条留言
Wanderer_308  [开发者] 2021 年 8 月 18 日 上午 10:42 
You haven't forgot to set the strength of the trailer wheels manually in the terminal, right?
£6lbs._onion 2021 年 8 月 18 日 上午 11:26 
I did set them up like how I would like them to be before recompiling the script

The same problem occurs as if I didn't implement your fix code.

And it's the rear suspensions on the main grid that's having the weaken strength problem
£6lbs._onion 2021 年 8 月 18 日 上午 11:31 
I should have taken some picture to better show what I mean, but please bear with me here.

All grids are Large-Grid.
- Main Vehicle: 4 Suspensions - 2 Front, 2 Rear (≤ the pair I'm having issues with)
- Trailer: 4 Suspensions - all situated to the Rear (in a sense like an irl semi-truck Trailer)
最后由 £6lbs._onion 编辑于; 2021 年 8 月 18 日 下午 12:46
£6lbs._onion 2021 年 8 月 18 日 上午 11:36 
I realise after posting the above comment that I do have something to visually show what I described :p

The current setup I have is more finalised than what is shown in the video, but they share the same design.

https://youtu.be/XDNd5oCy4eg
Wanderer_308  [开发者] 2021 年 8 月 18 日 下午 3:03 
I see. It will take more edits than i thought. Let me think...
Wanderer_308  [开发者] 2021 年 8 月 18 日 下午 3:47 
All right, try this:
locate the line:
weightsSum += suspension.WeightDistributionRatio;
and add the code before it, so it should look like:
if(!suspension.IsSubgrid)
weightsSum += suspension.WeightDistributionRatio;
find lines
rearHalfZ = Math.Max(rearHalfZ, suspension.WheelPositionAgainstCoM.Z);
frontHalfZ = Math.Min(frontHalfZ, suspension.WheelPositionAgainstCoM.Z);
and add the code before it, so it should look like:
if(!suspension.IsSubgrid)
{
rearHalfZ = Math.Max(rearHalfZ, suspension.WheelPositionAgainstCoM.Z);
frontHalfZ = Math.Min(frontHalfZ, suspension.WheelPositionAgainstCoM.Z);
}
keep the previous edit, from first post.
最后由 Wanderer_308 编辑于; 2021 年 8 月 18 日 下午 3:48
£6lbs._onion 2021 年 8 月 19 日 上午 9:56 
Tried the extra patch just now.

the suspensions that I'm having issues with is improved by 1% lol (from 9% to 10%).
But now the Fronts strength is also significantly increased - from ~30% to 42%.

I think I'll upload the vehicle up as unlisted so you could take a look yourself if you're willing to.

and thank you for helping thus far
Wanderer_308  [开发者] 2021 年 8 月 20 日 下午 1:44 
All right, i come with alternative approach, instead of finding a workaround for an issue, we will (or try to) fix it. Scrap all previous edits and do this:
find code:
suspension.WeightDistributionRatio=Math.Abs((suspension.WheelPositionAgainstCoM.Z-frontHalfZ)/wheelsBaseZ*weightRearRatio);
else
suspension.WeightDistributionRatio=Math.Abs((rearHalfZ-suspension.WheelPositionAgainstCoM.Z)/wheelsBaseZ*weightFrontRatio);
replace it with
suspension.WeightDistributionRatio=Math.Abs(((wheelsBaseZ-suspension.WheelPositionAgainstCoM.Z)/wheelsBaseZ)*weightFrontRatio);
else
suspension.WeightDistributionRatio=Math.Abs(((wheelsBaseZ+suspension.WheelPositionAgainstCoM.Z)/wheelsBaseZ)*weightRearRatio);
Those should redistribute strength across all wheels, more strength closer to CoM, less to the periphery. Test it and say how is it going. I wanted to change the formula a long time ago, even did a math model at work, but forgot it there.
最后由 Wanderer_308 编辑于; 2021 年 8 月 20 日 下午 1:45
£6lbs._onion 2021 年 8 月 21 日 下午 1:53 
Oh my... It functions 𝒃 𝒆 𝒂 𝒖 𝒕 𝒊 𝒇 𝒖 𝒍 𝒍 𝒚 !
Just as I had hoped for and even more! :D
It can now climbs 45 degree grade with ease, even when starting mid way up, without thrusters support!

Some more questions:
- Since this type of fix is based on main CoM, it should function as normal for any setup, right? Be it single body system or multi-body system (i.e trailer convoy)?

Or this fix is only specific for my case? (If it is, I'm even more grateful)

- Permission to upload showcase video of the patch? :P

Wanderer_308  [开发者] 2021 年 8 月 21 日 下午 2:50 
引用自 Λlyx's Van
- Since this type of fix is based on main CoM, it should function as normal for any setup, right? Be it single body system or multi-body system (i.e trailer convoy)?
Not really. Multi-body has more complex physical behavior than the single rigid body, since it has multiple points of reaction, and calculating them all is a nontrivial task. My formula is designed for rigid body rovers, it sorta works шер trailers too because one joint brings little error to the whole system, but the more there would be trailers the more error would be noticeable.
引用自 Λlyx's Van
- Permission to upload showcase video of the patch? :P
Sure you can showcase it, I would be glad to any video featuring my script. Also, I think to make this fix official and upload an update to my script in not so distant future. Problems with trailers were reported for a long time now.
£6lbs._onion 2021 年 8 月 21 日 下午 4:33 
I see, basically the script should run fine as long as things are kept within practical scale then.

And thank you for the greenlight. As well as thank you for everything :D :selike:
£6lbs._onion 2021 年 8 月 21 日 下午 5:33 
https://youtu.be/v9lK6hwCd2k

here's the video showing the patch in action, it's just me driving around terrain with the script running lel
< >
正在显示第 1 - 13 条,共 13 条留言
每页显示数: 1530 50