Sign in to follow this  
lucky6969b

How to define a function for a problem?

Recommended Posts

If I have a certain set of criterion,
say 2 fixed positions, the turning radius of the vehicle, the size and the speed of the vehicle

I want to calculate 2 other positions in terms of some constraints, such as the surrounding blockers
The goal of the function is the minimize the cost of the turn.

What is the correct way to define this function?
Thanks

Edited by lucky6969b

Share this post


Link to post
Share on other sites

The correct way is the same as always: Input the values you know already, and output the values you want but don't know yet.

But more seriously, you haven't provided us with enough information to solve the problem.  What is your vehicle?  How does it behave?  What properties of the vehicle can you control?  What are the properties of blockers?  What is the purpose of the 2 other positions?  What are your "some other constraints"?

Edited by Nypyren

Share this post


Link to post
Share on other sites

Hello,
I want to animate a so-called 3-point (or 4-point) parking problem.
The vehicle will drive forward to a certain way point, take a rear drive and drive up again...
You know, you sometimes get some weird parking lot in the street...
Thanks
Jack

Share this post


Link to post
Share on other sites

So, If I understand correctly, you have a vehicle that behaves like a car,  you want to perform the manoeuvre known as "parallel parking",  and you don't know how to calculate the middle part which is a sort of S-curve path (since the first and last parts are just simple straight-line travel).

I would start with looking at using a Bezier curve to calculate the path.  The rest is just basic integration of acceleration over time as the vehicle follows the curve.  The interesting thing is how to calculate the control points from the position of the blockers.

Share this post


Link to post
Share on other sites

Since car physics are approximately reversible, I would start by pretending the car is in the final parked position, and determine the path it will take to get out of the parking spot.

Let's create points:

  1. The point in the street where you drive forward to before beginning to back up and turn.
  2. The point where you need to begin reversing your car's rotation to get parallel with the curb.
  3. The point where you're parallel with the curb between the two other parked cars, but you're too close to the one behind you.
  4. The point after you've pulled forward a bit to center yourself between the blockers.

Let's find these points in reverse by simulating your vehicle's normal driving physics:

  • 4. You want your car to be approximately the same distance between the car in front and in back.
  • 3. Starting from the final parked position, back up until you're almost touching the car behind you.
  • 2. Crank the steering wheel as far as it goes towards the street (left if you're driving in America, right if you're driving in the UK, etc).  Drive the car forward while turning until both front corners of your car are further away from the curb than the rear corners of the forward blocker.
  • 1. Crank the steering wheel the opposite direction and drive forward until you're parallel to the street lane.

To park, drive to these points in order 1->4.  To leave, drive in order 4->1.

Edited by Nypyren

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this