Resend my activation email : Register : Log in 
BCF: Bike Chat Forums


Motorcycle Physics

Reply to topic
Bike Chat Forums Index -> The Geek Zone Goto page 1, 2  Next
View previous topic : View next topic  
Author Message

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 13:20 - 28 Apr 2020    Post subject: Motorcycle Physics Reply with quote

On a whim I thought I'd have a little play with Unity. All the scripting is C# and it plays nicely with Visual Studio so I thought "well I'm half way there, how hard can it be?" Very Happy

A good chunk of physics - gravity, drag, etc. - is built in. So I thought I'd have a go at simulating a motorcycle Shocked

I'm starting to glaze over a little reading this:

https://en.wikipedia.org/wiki/Bicycle_and_motorcycle_dynamics

I'm thinking there could be two approaches:

1) Treat the vehicle as a single body and simulate things like suspension, wheelies & stoppies.

2) Create representations of the components - wheels, suspension, frame, etc. - which individually have relatively simple physics, bolt them all together and see what the physics engine does with it all.
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

stinkwheel
Bovine Proctologist



Joined: 12 Jul 2004
Karma :

PostPosted: 13:55 - 28 Apr 2020    Post subject: Re: Motorcycle Physics Reply with quote

Easy-X wrote:

2) Create representations of the components - wheels, suspension, frame, etc. - which individually have relatively simple physics, bolt them all together and see what the physics engine does with it all.


QWOP for motorcycles.
____________________
“Rule one: Always stick around for one more drink. That's when things happen. That's when you find out everything you want to know.
I did the 2010 Round Britain Rally on my 350 Bullet. 89 landmarks, 3 months, 9,500 miles.
 Back to top
View user's profile Send private message You must be logged in to rate posts

Lord Percy
World Chat Champion



Joined: 03 Aug 2012
Karma :

PostPosted: 14:23 - 28 Apr 2020    Post subject: Reply with quote

It would definitely be quicker to simulate all the bits on a single motorcycle shaped block, and is possible to do it with a sense of realism too.

A motorcycle has the following main forces acting on it:

1. Driving force (happening at the point where the wheel and ground are in contact)
2. Weight
3. Normal/"Reaction" force
3. Friction (happening in the opposite direction to force 1)
4. Wind Resistance (happening in the opposite direction to force 1)

You simply ("simply") need to calculate the resultant direction of motion based on each of those things (and lots of other things if you want to add realism, but best to start with as spherical a cow as possible Very Happy).

The motorbike can be a solid block, for all it cares. Everything happens in the maths.
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 14:24 - 28 Apr 2020    Post subject: Reply with quote

Maybe. A wheel is quite straightforward in itself (with regards to physical forces) but then you have the contact patch, the wheel bearing, the interaction with the forks... and that's just the front wheel!

Hmmm.... Thinking

Rather than "run before you can walk" I'll start with something a bit simpler: a unicycle simulation. Left controller stick can shift your balance (centre of gravity) and right for movement. The whole "upside down pendulum" thing.
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

weasley
World Chat Champion



Joined: 16 Oct 2010
Karma :

PostPosted: 14:36 - 28 Apr 2020    Post subject: Reply with quote

You can probably break it down to a smaller number of simplified parts and forces:

- wheels; driving (rear) and braking (both) torque, inertia/momentum, tyre-to-surface friction
- chassis/engine & rider: centre-of-mass, inertia/momentum, aero drag
- suspension; spring rates, damping rates, wheel movement direction, unsprung inertia/momentum?
- engine/transmission; torque curve at rear wheel.

S'funny, the more you think about it the more complicated it gets. Maybe start simple and then try to sub-divide each component further to refine the model.
____________________
Yamaha XJ600 | Yamaha YZF600R Thundercat | KTM 990 SMT | BMW F900XR TE
 Back to top
View user's profile Send private message You must be logged in to rate posts
- This post is not being displayed because it has a low rating (Confusing). Unhide this post / all posts.

Lord Percy
World Chat Champion



Joined: 03 Aug 2012
Karma :

PostPosted: 14:56 - 28 Apr 2020    Post subject: Reply with quote

- wrote:

By "Weight" you mean gravity, (weight is not a force),
What about the gyroscopic force keeping it upright?


No, weight is a force. Gravity is the acceleration caused by a gravitational field, and the resultant force felt by objects in the field is called weight.

F = ma
W = mg

Gyroscopic forces are the "lots of other things" I mentioned which aren't strictly necessary in the first instance. To start with you can just program something that simply goes forward and turns depending on the lean you give it.
 Back to top
View user's profile Send private message You must be logged in to rate posts

Lord Percy
World Chat Champion



Joined: 03 Aug 2012
Karma :

PostPosted: 15:04 - 28 Apr 2020    Post subject: Reply with quote

Easy-X wrote:
Maybe. A wheel is quite straightforward in itself (with regards to physical forces) but then you have the contact patch, the wheel bearing, the interaction with the forks... and that's just the front wheel!


Yep and you could include all that in the code without adding any finicky moving parts to Unity.

Something like:

Code:

double GetForce()
{
    return force - contactFriction - bearingFriction - forksInteraction; //..etc etc... subtract anything that removes energy from the system
}


But that's needless complexity for now.

Sounds like a really interesting project anyway. I started a physics thing over the weekend using SFML, having a go at simulating orbital mechanics. It's an easy one really but I've done cooler stuff in the past. My favourite was a fluid dynamics sim I made Very Happy
 Back to top
View user's profile Send private message You must be logged in to rate posts
- This post is not being displayed because it has a low rating (Off Topic). Unhide this post / all posts.

Lord Percy
World Chat Champion



Joined: 03 Aug 2012
Karma :

PostPosted: 15:09 - 28 Apr 2020    Post subject: Reply with quote

Laughing mpd gave me a downvote for correcting him Laughing

Don't even bother you thick cunt, you've ruined enough threads and you are absolutely categorically wrong here. Don't even try Laughing
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 15:21 - 28 Apr 2020    Post subject: Reply with quote

I started with a squashed sphere (bit like a wheel) added a stick and another sphere on top (vague unicycle shape) and swapped the X/Y directional translation for a propulsion/rotation sort of thing and the thing "drives" around and eventually topples over! Now I'm going to try add add a "balancing force" from the other controller stick... fascinating stuff Smile
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

bhinso
World Chat Champion



Joined: 21 Jun 2008
Karma :

PostPosted: 16:09 - 28 Apr 2020    Post subject: Reply with quote

This is my sort of thread.

Lord Percy is correct about Weight being a force so I'm not sure why the Donking.

It comes down to Vectors and Scalars. Scalars have magnitude only, Vectors have magnitude and direction.

Mass is a Scalar, it has only magnitude, eg. 100kg. It is a measure of the amount of molecules (matter) in the body.

Weight is a Vector, it is the force resulting from the application of gravity on said mass.

When astronauts go into space they become weightless but not massless. The amount of matter in their body is still the same, and they would still be injured if they crashed into things.
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

kolu
Nova Slayer



Joined: 29 Sep 2019
Karma :

PostPosted: 17:03 - 28 Apr 2020    Post subject: Reply with quote

- wrote:
Oh fuck me, here we go again... Laughing

Quote:
The weight of an object is the force of gravity on the object


Do not confuse weight with mass.
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

stinkwheel
Bovine Proctologist



Joined: 12 Jul 2004
Karma :

PostPosted: 17:12 - 28 Apr 2020    Post subject: Reply with quote

Can it do gyroscopic precession and camber thrust?
____________________
“Rule one: Always stick around for one more drink. That's when things happen. That's when you find out everything you want to know.
I did the 2010 Round Britain Rally on my 350 Bullet. 89 landmarks, 3 months, 9,500 miles.
 Back to top
View user's profile Send private message You must be logged in to rate posts

weasley
World Chat Champion



Joined: 16 Oct 2010
Karma :

PostPosted: 17:18 - 28 Apr 2020    Post subject: Reply with quote

stinkwheel wrote:
Can it do gyroscopic precession and camber thrust?

Can it do wheelies and burnouts?
____________________
Yamaha XJ600 | Yamaha YZF600R Thundercat | KTM 990 SMT | BMW F900XR TE
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 17:25 - 28 Apr 2020    Post subject: Reply with quote

Oooh! Wheel colliders Smile They have suspension (with damping) forward and sideways friction.

I stuck two under a box and if you turn the wheel left the "bike" tips right. Countersteering!
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

bhinso
World Chat Champion



Joined: 21 Jun 2008
Karma :

PostPosted: 15:28 - 29 Apr 2020    Post subject: Reply with quote

I've been Donked Sad

Which part of what I wrote do you disagree with? It's Newton's second law of motion, F=ma
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

xX-Alex-Xx
World Chat Champion



Joined: 12 Sep 2019
Karma :

PostPosted: 15:47 - 29 Apr 2020    Post subject: Reply with quote

weasley wrote:
stinkwheel wrote:
Can it do gyroscopic precession and camber thrust?

Can it do wheelies and burnouts?


Fuck that, will it blend?
____________________
DILLIGAF
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 15:50 - 29 Apr 2020    Post subject: Reply with quote

Had a good play with the physics. You can apply forces, rotational torque, change centre of mass, all sorts! TBH I think I've gone completely through the looking glass when terms like "Quaternion" and "Euler Angles" are casual parlance on the Unity forums - I can just about handle Vectors Smile

Found a nice GitHub example:

https://github.com/Kright/MotorcyclePhysics

It's not a true representation but the bike does lean as it turns. You can turn too sharp and lowside it. You can come to a stop and it wobbles and falls over. Quite satisfying how the bike dives when you brake.

Long term I'm thinking of one of those apocalyptic "endless road" type games but with bikes.
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 13:34 - 30 Apr 2020    Post subject: Reply with quote

Here's a bike that zooms about:

https://send.firefox.com/download/fee24170e02b5baa/#vVoqTV-16FWK7rKhWct05A

You'll need an XBox style controller.

Left Trigger: linked braking - 80% front, 30% back, proportional
Left Button: instant 90% front brake
Right Button: instant 50% back brake
Right Trigger: throttle, proportional
Left Stick: steering
Keyboard Backspace: reset bike (sometimes)
Keyboard C: camera change

What I'm happy with: front forks dive in quite a satisfying way Smile

What I'm not happy with: swing arm is fake. The rear wheel is actually attached to the main frame (via invisible shocks) in the same way the front wheel is. It therefore moves up and down in a straight line rather than rotating around the swing arm bearing Sad

Still working on it: the bike turns and leans and lowsides quite well <30mph. Over 30mph it starts to get tank-slap and go a bit mad. There's still lots of things to tweak though, almost anything you could think of that's in real world is here; barely scratched the surface!
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 00:40 - 01 May 2020    Post subject: Reply with quote

Fixed the swing arm. I did try and make a "real" swing arm but it was starting to get fiendishly complicated with hinges and springs. Instead I did the decent thing and cheated. I adjusted the angle of the rear (virtual) shock so the angular effect is barely noticeable. The swing arm just rotates to "look" at the rear hub. So that mean's the bike's going to be a twin-shock Smile

Might upload a new version tomorrow, depends if it's sunny out Very Happy
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

Lord Percy
World Chat Champion



Joined: 03 Aug 2012
Karma :

PostPosted: 09:25 - 01 May 2020    Post subject: Reply with quote

That's way better than I'd have expected in such a short time, cool!

Which bits did you have to do entirely yourself, and which bits were set up for you?
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 12:26 - 01 May 2020    Post subject: Reply with quote

Basically: user input + maths goes into the wheel colliders. The collider reactions go into more maths to feed back into the model (e.g. rotate the front wheel in two axis but the wheel hub in only one...)

So I have to provide the maths "glue" and the models. Unity provides the physics: "Oh, you want to apply 100Nm of torque to this motor? Let's see how that turns out..." and it weighs up drag, friction, gravity, interaction of materials, etc.

The Wheel Colliders are a "black box" convenience item which a purist would replace with hinges and springs for something like single wishbone suspension (i.e. a swing arm.)
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 16:11 - 02 May 2020    Post subject: Reply with quote

Version 2:

https://send.firefox.com/download/011bf7bd923f6a05/#JlQprkNiI1jNRf6XTMOiWQ

Quick video if you don't have a gamepad:

https://img.youtube.com/vi/QzdsUaaO_us/0.jpg

Changes:

Swing arm + rear suspension working. Admittedly the suspension is a bit exaggerated but it looks kewl Smile

Pick Up Bike is now Fire1 (XBox A)
Cam Switch is Fire2 (XBox B)
Mouse moves the camera in View 1

Right stick throws some simple torque in the mix to get a bit of lean on (or shift your weight over the front wheel)

Travelling at walking pace drops the centre of mass below the ground to simulate "foot down" but this is a cheap trick / shortcut just for now

Added a jump. Air stability is zero so you'll be lucky to land it even with some appropriate lean - you have been warned Smile
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts

Easy-X
Super Spammer



Joined: 08 Mar 2019
Karma :

PostPosted: 20:31 - 03 May 2020    Post subject: Reply with quote

The handling might be a bit shit but I'm happy with the mechanics: swing arm, suspension, steering.

Knocked this up this afternoon in Blender:

https://i.imgur.com/iIpdSOy.png?1
____________________
Husqvarna Vitpilen 401, Yamaha XSR700, Honda Rebel, Yamaha DT175, Suzuki SV650 (loan) Fazer 600, Keeway Superlight 125, 50cc turd scooter
 Back to top
View user's profile Send private message You must be logged in to rate posts
Old Thread Alert!

The last post was made 3 years, 330 days ago. Instead of replying here, would creating a new thread be more useful?
  Display posts from previous:   
This page may contain affiliate links, which means we may earn a small commission if a visitor clicks through and makes a purchase. By clicking on an affiliate link, you accept that third-party cookies will be set.

Post new topic   Reply to topic    Bike Chat Forums Index -> The Geek Zone All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Read the Terms of Use! - Powered by phpBB © phpBB Group
 

Debug Mode: ON - Server: birks (www) - Page Generation Time: 0.09 Sec - Server Load: 0.21 - MySQL Queries: 18 - Page Size: 139.91 Kb