Lua Script VW Thing

OHM Lua Script VW Thing 5

Thunder Chicken

Resident Lua Script Rabble-Rouser
Donator
Joined
Mar 22, 2008
Messages
5,847
Reaction score
5,509
Points
188
Location
Massachusetts
Thunder Chicken submitted a new addon:

Lua Script VW Thing - A Volkswagen Thing, a Lua scrip test bed for steering, braking, and animations for surface vehicles.

Accelerate using the normal throttle +/- keys.
Brake by pressing the B key
Steer with rudder inputs (keyboard 1 and 3)

Looking to add a rudimentary transmission to allow reverse, and am still looking at refinements to the steering model.

If you have any questions or issues, post them here. Be aware that the wheel strut animations aren't (and will never be) perfect in steep surface terrain as there is insufficient information available about the surface topology to animate them ideally, but...

Read more about this addon...
 
Thunder Chicken updated Lua Script VW Thing with a new update entry:

VWThing Updated with Static and Dynamic Friction Models

I was struggling with how to model static friction. Attempting to calculate the forces needed to prevent skidding often lead to extremely high forces that would flip the car or send it to Alpha Centauri. What I hit upon was a more compliant means to enforce no side skid. I determine the lateral velocity of each wheel (in the wheel frame of reference) relative to the ground, and I multiply that by the simulation time step to yield an effective displacement dx for each wheel, and I integrate...

Read the rest of this update entry...
 
Thunder Chicken updated Lua Script VW Thing with a new update entry:

Various Improvements and Refinements

This update contains:
  • Generalization of code to set suspension and touchdown points under any gravitational acceleration. You can drop this on any planet and the contact points will be correct and the suspension will be tuned to the local gravity.
  • Fixes for some logic errors that caused erroneous implementation of the dynamic skid model instead of the static rolling model.
  • Refinements of the static rolling model.
  • Improved steering control and animation.
  • General code...

Read the rest of this update entry...
 
Thunder Chicken updated Lua Script VW Thing with a new update entry:

Further Improvements to the Steering Model

I fixed some items and improved my understanding of the steering model. It was incorrectly failing to transition from the static friction to the dynamic friction skid model as I was calculating those forces simultaneously, and the vehicle dynamics caused the calculation for the alternative model to be incorrect.

I also related the stiffness of the pseudo spring forces to prevent skid to the shear forces of a rubber tire with a known tread height and contact patch area. It yields a stiffness...

Read the rest of this update entry...
 
Maybe I'm doing something forbidden, but I'm noticing the following. I launch any of two your scenario and press "T" (x10 time accelearation). After that the car starts moving backwards and steer chaotically.
 
Maybe I'm doing something forbidden, but I'm noticing the following. I launch any of two your scenario and press "T" (x10 time accelearation). After that the car starts moving backwards and steer chaotically.
The KSC runway does have a mild slope and it does slowly roll backwards. The wheel friction models unfortunately rely on add_force to work which doesn't play nicely with time acceleration. I'm amazed it doesn't go into orbit under 10X acceleration.

It may be possible to add a dead band around 0 lateral velocity where add_force isn't called, which might permit the vessel to achieve landed status. But the brakes are also add_force elements, so it's not so easy.
 
Thunder Chicken updated Lua Script VW Thing with a new update entry:

Air Breathing Otto Cycle Engine and Organizational Improvements

Added a simple thermodynamic model of an Otto cycle spark ignition engine which provides realistic power and fuel consumption for a VW 1600 cc air-cooled engine. The only inputs needed are the engine displacement and compression ratio.

Other code changes are mostly organizational with some code broken out into modules. Some minor bugs were squashed.

I eventually want to clean up the mesh and add a dashboard and a steering wheel for better immersion.

Read the rest of this update entry...
 
Hi Thunder Chicken,
Thank you for the continued work on this, it's an interesting one!
I've missed a few updates but have v5 now.
I'm having real trouble steering the Thing cos the wheels are responding far too slowly to "rudder" input.
It's like driving on an ice-rink ?
Why is this -- Have I got to set something up in .cfg ?
 
Hi Thunder Chicken,
Thank you for the continued work on this, it's an interesting one!
I've missed a few updates but have v5 now.
(y)
I'm having real trouble steering the Thing cos the wheels are responding far too slowly to "rudder" input.
It's like driving on an ice-rink ?
Why is this -- Have I got to set something up in .cfg ?
I would need to know the circumstances where you are seeing this occur.

The wheel steering direction must be changed gradually like a normal car or otherwise the wheel skids. You can't treat it like a flight control surface where you can move it stop to stop quickly.

If you go very fast and and put in a large steering input, it will skid. If you do this while accelerating, there will be less normal force on the front wheels and they will skid easier. If you hit the brakes while skidding and steer into the skid that should allow the wheels to grab.
 
(y)

I would need to know the circumstances where you are seeing this occur.

The wheel steering direction must be changed gradually like a normal car or otherwise the wheel skids. You can't treat it like a flight control surface where you can move it stop to stop quickly.

If you go very fast and and put in a large steering input, it will skid. If you do this while accelerating, there will be less normal force on the front wheels and they will skid easier. If you hit the brakes while skidding and steer into the skid that should allow the wheels to grab.
It happens at any speed, even very low (3/4 mph) Obviously gets worse faster one goes.
Seems like it's permently in skid mode at whatever speed.
If display cross hairs they ocillate left n right quickly until about 25 mph when they slow down considerably.

Not sure I agree that direction changes should be slow.
Actual car steering is very sensitive, and "centres" itself much quicker than the Thing (stronger caster action).

Another minor point, why cut engine when using brake (spacebar)?
Could it be possible to reduce thrust equivalent to road speed when using the brake?
(I know that's not realistic with an automatic (unless it's like a Nissan Micra which gives engine braking), but going to zero thrust is kinda anoying.
Maybe you've got the full simulator kit (steering wheel, throttle n brake pedals) you lucky person ! :giggle:
 
It happens at any speed, even very low (3/4 mph) Obviously gets worse faster one goes.
Seems like it's permently in skid mode at whatever speed.
I am not seeing that on my end. Below about 20 mph it sticks to the pavement fine. Above that you need to be careful with large and/or rapid steering inputs as you will skid.
If display cross hairs they ocillate left n right quickly until about 25 mph when they slow down considerably.
The velocity vector indicator in the HUD isn't really useful in this surface vehicle. Go to an external view and watch the car move relative to the ground, or hit V and watch the wheel motion relative to the ground as you drive.
Not sure I agree that direction changes should be slow.
Actual car steering is very sensitive, and "centres" itself much quicker than the Thing (stronger caster action).
Your skidding problem will get worse if you increase the rate at which the tire pivots to steer.
Another minor point, why cut engine when using brake (spacebar)?
Could it be possible to reduce thrust equivalent to road speed when using the brake?
(I know that's not realistic with an automatic (unless it's like a Nissan Micra which gives engine braking), but going to zero thrust is kinda annoying.
Because I was annoyed when the car would start moving again after I stopped it with the brake. :) I guess it comes down to which effect annoys you the least. I don't typically drive my real car pressing both the accelerator and brake simultaneously. Shutting off the thrust can be commented out in the brake code if you like.
Maybe you've got the full simulator kit (steering wheel, throttle n brake pedals) you lucky person ! :giggle:
Nope, I only have a laptop keyboard and number pad.

You can edit the Lua script files to change the performance if you like. They are just text files, no compiling of modules needed. Orbiter just reads them and interprets them into methods understood by Orbiter.
 
  • Like
Reactions: JMW
Thunder Chicken updated Lua Script VW Thing with a new update entry:

Works with Orbiter 2024...mostly

So I checked my VWThing against Orbiter 2024 and found that it works quite well, but there does seem to be a bug with the visuals. When I apply the brakes with the spacebar, the car body visuals as seen from the cockpit disappear, and they reappear when I release the brakes. I have no idea why this is occurring.

I don't know if this is a bug in Orbiter 2024 or a bug in my script that is coming to light in Orbiter 2024. If someone can confirm that they see this behavior in their installs I'd...

Read the rest of this update entry...
 
Back
Top