JSBSim-Team / jsbsim

An open source flight dynamics & control software library
GNU Lesser General Public License v2.1
1.35k stars 450 forks source link

Bogey: no way to adjust side force #127

Closed ghost closed 5 years ago

ghost commented 5 years ago

There is no way to separately adjust the side force from bogeys. <rolling_friction> seems to adjust both front and side force, and if I try to increase it I get too much front force.

The bogeys are too "slippery", and I can not reproduce the crosswind landing behaviour for the Tu-144. The reports say it should align itself with the runway after a crabbed touchdown without much rudder, but I always have to apply rudder to keep it from rolling off. Neither can I turn during taxi without too much braking.

https://gitlab.com/mdanil/Tu-144/blob/master/Tu-144-jsbsim/gndreac.xml , first 3 contact points.

ghost commented 5 years ago

Actually, <rolling_friction> does not change side force at all.

abassign commented 5 years ago

I also verified this problem with the G91R1B, for example if there is a side wind the G91 rotates like a flag ... The thing is very bad because it makes very unrealistic a takeoff and landing with side wind or slope track lateral. I thought I had something wrong in the code, but this post confirmed my suspicion. One solution is to place three lateral force vectors that follow the rules of the carts (static friction coefficient, surface of the truck in contact with the ground, load), but what are these rules? Once identified it is simple because they are normal forces to motion. It would be better, before using a "do it yourself" solution to have an official solution.

bcoconni commented 5 years ago

At the moment, JSBSim is using Pacejka "magic formula" for tires model with coefficients hard coded in the C++ code of FGLGear.cpp.

The problem I see with the formula, as it is implemented in JSBSim, is that as long as there is no side slip velocity, there is no side friction force. This is most likely the reason why you are observing the behaviors you describe above.

There is no way to separately adjust the side force from bogeys.

That is incorrect you can provide a <table> that describes how side friction coefficient depends from the wheel slip angle.

<table type="CORNERING_COEFF">
  ...
  {wheel_slip angle} {friction coefficient}
  ...
</table>

I have to admit that the documentation is not very clear about that functionality :flushed: In addition, since it is seldom used, I give no guarantees about its results.

Let me know if you face problems and I will try to address them.

Finally, there is also the issue #89 on a related topic and we might need to address the 2 issues as the 2 sides of the same problem. And my experience is that friction is definitely not an easy topic to solve :disappointed:

ghost commented 5 years ago

Wow, if that works I won't have to wait until the next release, I'll give it a try tonight.

What is the default value of CORNERING_COEFF , or what is better to use there as a starting point?

bcoconni commented 5 years ago

What is the default value of CORNERING_COEFF , or what is better to use there as a starting point?

As a starting point I would grossly mimic the shape of Pacejka's formula curve Pacejka's formula curve

The first column of the table should give the side slip angle in degrees and second column the friction coefficient

<table type="CORNERING_COEFF">
  -10. -1.0
  -2.0 -1.0
   2.0  1.0
   10.  1.0
</table>

From there I would modify the profile of the curve until it gives the desired results.

Note that as soon as the wheel/bogey slips, this table will be ignored and the dynamic friction coefficient will be used instead. And as I am writing these lines I am realizing that the whole thing might probably not work !?!

If you don't mind, I will let you (@mike402 and @abassign) drive the experiments and then based on your feedback we will discuss how we can proceed further.

bcoconni commented 5 years ago

Another interesting experiment would be to check what happens if you specify a positive friction coefficient even for negative slip angles ?

<table type="CORNERING_COEFF">
  -10. 1.0
  -2.0 1.0
   0.0 0.1 <!-- and what about a non zero coefficient at zero slip angle ? -->
   2.0 1.0
   10. 1.0
</table>
ghost commented 5 years ago

Thanks, I will try it and do some crabbed landings either tonight or on the weekend.

ghost commented 5 years ago

Looking at this quickly, maybe it's a good idea to add some simple scaling factor for Pacejka formula, which would roughly be the number of tyres on bogey?

ghost commented 5 years ago

For the <table type="CORNERING_COEFF"> FlightGear-next crashes with Fatal error (const char*): An unknown table type attribute is listed: . Execution cannot continue.. If I remove type="CORNERING_COEFF" or put any other value in the quotes, it loads ok but the table does not have any effect.

bcoconni commented 5 years ago

For the <table type="CORNERING_COEFF"> FlightGear-next crashes with Fatal error (const char*): An unknown table type attribute is listed: . Execution cannot continue.. If I remove type="CORNERING_COEFF" or put any other value in the quotes, it loads ok but the table does not have any effect.

This has just been fixed by commit c21af41. The fix has also been pushed to FlightGear so you should be able to conduct your tests.

Important note The problem was coming from the use of the attribute type to specify CORNERING_COEFF which was clashing with FGTable which is using the same attribute for other purposes. As a consequence, the correct syntax is now:

<table name="CORNERING_COEFF" type="internal">
  <tableData>
    -10. -1.0
    -2.0 -1.0
     2.0  1.0
     10.  1.0
  </tableData>
</table>

The 2 columns keep the same meaning as was discussed above. The docs have been updated accordingly.

FWIW this bug has probably existed since the day this feature was introduced :astonished:

ghost commented 5 years ago

Thanks, just tried it with nose wheel steering and it looks very promising -- there was no longer that icy-slippery feel to taxiing.

bcoconni commented 5 years ago

Thanks, just tried it with nose wheel steering and it looks very promising -- there was no longer that icy-slippery feel to taxiing.

Great ! :+1:

Let us know what you learnt in the process once you will have gathered enough experience with that feature. Possibly the default function to compute the side force (Pacejka) can benefit from your feedback :smile: ?

ghost commented 5 years ago

I think I should start with a Python script to print Pacejka for user-defined parameters in the <table> format -- I'll try to write it tomorrow.

ghost commented 5 years ago

Ah, I think I get it! Pacejka is actually fine -- it is just that many people including me have been using <static_friction> to set maximum braking force of the wheel brakes, but it is used as scaling factor for Pacejka formula at https://github.com/JSBSim-Team/jsbsim/blob/b914b2480217354c377fbec909a933875d8e8223/src/models/FGLGear.cpp#L225

I put a larger <static_friction> on the nose wheel and the steering improves a lot.

ghost commented 5 years ago

I'm getting weird results with the default Pacejka: when I make nose wheel grippy enough for taxiing, I get massive rolloff tendency when derotating with side slip (or maybe it's actually realistic and you shouldn't do that); when I make main gears more grippy, all I get is a huge rolling force turning me upside down, but not in any way aligning with the runway -- maybe those tyres should have shallower friction per angle.

Built-in Pacejka is actually proportional to the square of <static_friction> because it's scaled the second time, also user-supplied table is scaled linearly. I think if we don't make a separate Peak setting, this scaling should ideally be moved under the if() to affect only the user table, if not removed completely?

https://github.com/JSBSim-Team/jsbsim/blob/b914b2480217354c377fbec909a933875d8e8223/src/models/FGLGear.cpp#L588

ghost commented 5 years ago

Indeed, the default seems too stiff, more like general aviation / WWII fighter tyre than big airliner bogey. I will try different parameters tonight.

Here's the script for anyone else willing to experiment: https://gitlab.com/mdanil/aircraft-model-tools/blob/master/jsbsim-pacejka.py

ghost commented 5 years ago

Looks like I'm done. I had expected to spend a week or more on it, but it took only a day, so it was fast ^_^.

  1. For FlightGear release I managed to make taxi steering satisfactory by setting larger <static_friction>. But it's a bit too stiff for landings, causing rollout tendency and rolling moment if you are not careful enough and derotate with side slip:

https://gitlab.com/mdanil/Tu-144/commit/662910fdbabdcca8c227a0a9050121e2c3358003

  1. For FlightGear-next, now that CORNERING_COEFF is working (I really really hope that commit gets cherrypicked), I made nose wheels less stiff and gave the main bogeys enough force to help align with the runway, but made them soft enough not to cause dangerous rolling moment in max crosswind.

https://gitlab.com/mdanil/Tu-144/blob/2018.3.0/Tu-144-jsbsim/gndreac.xml

Later I may want to check and reduce strut damping, because it seems to cause a bit of bouncing, but at least the side-force part is okay now.

Thank you for the timely bugfix!

P.S.: Might be useful for someone scratching their head with "why in the world can't I decrab": I also found a problem in my FDM: the "Yaw moment due to beta" was too large, making the aircraft turn into the wind on the rollout beyond rudder authority. Naturally, that also kept the aligning effect of main gear from being felt -- so I wasted most of my time with too-high side forces, only to watch the plane turn upside down because of rolling moment.

P.P.S.: Is there a repository for JSBSim development tools to which I can give my Pacejka script, so that it does not get lost?

ghost commented 5 years ago

About improving built-in Pacejka. Personally, I I think I would no longer need to manually give CORNERING_COEFF tables, if the built-in Pacejka could be like:

  1. Its parameters exposed to some tags under <contact>, something like <cornering_peak>, <cornering_stiffness>, etc.
  2. Peak at https://github.com/JSBSim-Team/jsbsim/blob/b914b2480217354c377fbec909a933875d8e8223/src/models/FGLGear.cpp#L225 is optionally decoupled from from <static_friction> by supplying <cornering_peak> under <contact>.

The second scaling times <static_friction> https://github.com/JSBSim-Team/jsbsim/blob/b914b2480217354c377fbec909a933875d8e8223/src/models/FGLGear.cpp#L588 should be kept for compatibility, but perhaps there should be made a way to override it, because what if some case needs zero forward force, but non-zero side force.

I think with these changes the built-in formula should be enough for most cases.

agodemar commented 5 years ago

Hi @mike402

P.P.S.: Is there a repository for JSBSim development tools to which I can give my Pacejka script, so that it does not get lost?

I think the folder <JSBSim root>/utils/python can be an option. Make sure you fork a clone of the master repository and please submit a pull request. Thanks! ;-)

legoboyvdlp commented 5 years ago

copying my comment:

Hi, Many users are tuning brakes using - this results in correct braking behaviour, but really seems to mess up steering - is it possible to have a property that tunes the brake force without affecting the static friction of the wheels ( resistance to lateral force if I remember right? )

legoboyvdlp commented 5 years ago

For reference, I'm speaking not about side force when the wheels hit the ground on a crabbed landing, but trying to turn at ~20 knots, especially when on grass, but also noticeable on asphalt - sometimes, when I command full right, I actually go left!

ghost commented 5 years ago

That would still not let you adjust other parameters of Pacejka's formula, which is really necessary for wide airliner-type tyres, as I found out from my experiments.

But indeed it would be good to have, because it would save some kludging developer-side, because you would no longer have to scale down the fcs/{left,right}-brake-cmd-norm when you increase <static_friction>.

On Wed, Nov 07, 2018 at 02:17:44AM -0800, Jonathan Redpath wrote:

copying my comment:

Hi, Many users are tuning brakes using - this results in correct braking behaviour, but really seems to mess up steering - is it possible to have a property that tunes the brake force without affecting the static friction of the wheels ( resistance to lateral force if I remember right? )

ghost commented 5 years ago

I noticed that too when derotating when still crabbed, and increasing only <static_friction> does exactly that. You should decrease the tyre stiffness at the same time, else it ends up being uncontrollable at higher speeds.

On Wed, Nov 07, 2018 at 02:21:38AM -0800, Jonathan Redpath wrote:

For reference, I'm speaking not about side force when the wheels hit the ground on a crabbed landing, but trying to turn at ~20 knots, especially when on grass - sometimes, when I command full right, I actually go left!

legoboyvdlp commented 5 years ago

@it0uchpods would know more about this than me, he is the one that adjusted the brakes on the A320

ghost commented 5 years ago

By the way, far as I understand typically there is no brakes on the front wheel, apart from the small pads to stop it when it's retracting -- so the <static_friction> can be arbitrarily high there, but like I said, it can get too stiff and kill you on accidental derotation with side speed.

On Wed, Nov 07, 2018 at 03:09:02AM -0800, Jonathan Redpath wrote:

@it0uchpods would know more about this than me, he is the one that adjusted the brakes on the A320

bcoconni commented 5 years ago

@legoboyvdlp The side friction that is generated by a steering wheel is not different than the side friction that occurs during a crabbed landing. Both are managed by the Pacejka function that has been discussed above.

A steering wheel can modify the orientation of the side friction force. And since the side friction force is generally significantly higher than the rolling friction the aircraft, which tends to follow the path of least resistance, will follow the rolling/steering direction.

Now that I fixed the bug with the CORNERING_COEFF tables, you can specify the side friction via this feature.

but also noticeable on asphalt - sometimes, when I command full right, I actually go left!

I am still bothered about the fact that the Pacejka function returns a negative friction coefficient for negative steering angles. I would be curious to know if that direction inversion still occurs if the friction coefficient from the Pacejka would be forced to an always positive value.

There might be another explanation for that behavior: is there some strong cross wind when you observe the inverted steering command behavior ? I mean while you are on the grass, FlightGear might reduce the friction coefficient making the steering wheel unable to resist cross wind ?

legoboyvdlp commented 5 years ago

Yes, I think that is what is happening.

legoboyvdlp commented 5 years ago

Regardless, I'll see if the nose wheel can be adjusted by changing static friction and using cornering coeff once 2018.4 is released.

bcoconni commented 5 years ago

@legoboyvdlp

I'll see if the nose wheel can be adjusted by changing static friction and using cornering coeff once 2018.4 is released.

FYI the fix for the CORNERING_COEFF feature has been pushed to FlightGear 2018.3.

legoboyvdlp commented 5 years ago

Excellent, thanks.

bcoconni commented 5 years ago

@mike402 and @legoboyvdlp Can this issue be considered closed ? Or do you need some further support ?

ghost commented 5 years ago

I think now that this works it can be closed, unless someone wants to expand the default Pacejka the way I had described.

Thank you for fixes!

On Thu, Dec 27, 2018 at 10:41:26AM -0800, Bertrand Coconnier wrote:

@mike402 and @legoboyvdlp Can this issue be considered closed ? Or do you need some further support ?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/JSBSim-Team/jsbsim/issues/127#issuecomment-450207695

legoboyvdlp commented 5 years ago

I am experimenting with it, and it works really well for nose wheel steering! @mike402 python file helps a lot :)

bcoconni commented 5 years ago

OK thanks. Issue closed.