Post Reply 
Perfect Parking
03-27-2024, 01:11 AM
Post: #1
Perfect Parking
From The Geometry of Perfect Parking:

Quote:How much extra length (above the length of your car) do you need to parallel park?

The length of the parking space must be at least the length of my car plus

\(
\sqrt{(r^2 - \ell^2) + (\ell + k)^2 - \left( \sqrt{r^2 - \ell^2} -w \right)^2} - \ell - k
\)

where \(r\) is the radius of my car’s kerb-to-kerb turning circle,
\(\ell\) is my car’s wheel-base (the distance between the centres of the front wheel and the corresponding back wheel),
\(k\) is the distance from the centre of the front wheel to the front of the car,
and \(w\) is the width of one of the parked cars:
the one near the front of my car once I’ve parked.

I came up with the following program for the HP-42S, which should work with most HP calculators:
Code:
00 { 33-Byte Prgm }
01▸LBL "PARKING"
02 X<>Y
03 R↑
04 X↑2
05 X<>Y
06 R↑
07 +
08 X<>Y
09 LASTX
10 X↑2
11 -
12 ENTER
13 SQRT
14 R↑
15 -
16 X↑2
17 -
18 X<>Y
19 X↑2
20 +
21 SQRT
22 X<>Y
23 -
24 END

Example

\(
\begin{align}
r &= 5.4\text{m} \\
\ell &= 2.6\text{m} \\
k &= 1.3\text{m} \\
w &= 1.7\text{m} \\
\end{align}
\)

5.4 ENTER
2.6 ENTER
1.3 ENTER
1.7 XEQ "PARKING"

1.4303

Can you do better?



This is the same program for the HP-15C:
Code:
   001 {       34 } X<=>Y
   002 {    43 33 } g R^
   003 {    43 11 } g x^2
   004 {       34 } X<=>Y
   005 {    43 33 } g R^
   006 {       40 } +
   007 {       34 } X<=>Y
   008 {    43 36 } g LSTx
   009 {    43 11 } g x^2
   010 {       30 } -
   011 {       36 } ENTER
   012 {       11 } sqrt(x)
   013 {    43 33 } g R^
   014 {       30 } -
   015 {    43 11 } g x^2
   016 {       30 } -
   017 {       34 } X<=>Y
   018 {    43 11 } g x^2
   019 {       40 } +
   020 {       11 } sqrt(x)
   021 {       34 } X<=>Y
   022 {       30 } -
Find all posts by this user
Quote this message in a reply
03-27-2024, 04:36 PM (This post was last modified: 03-27-2024 07:56 PM by SlideRule.)
Post: #2
RE: Perfect Parking
The attached PDF excerpt from Springer Tracts in Advanced Robotics, Intelligent Mobile Robot Navigation Volume 16, Chapter 6. Intelligent System for Parallel Parking of Cars & Tractor-Trailers, pp. 167-172 expostulates a similar argument / presentation with equations, formulas & illustrations.
[attachment=13400]

6.3 Autonomous Parking in Cart and Cart-Like Vehicles
  Fig. 6.5 Parallel parking definition
    (6.7)
  6.3.1 Collision Avoidance
    (6.8)
    (6.9)
  Fig.6.6 Possible collisions in parallel parking
  Fig. 6.7 Collision-free area for cart and parallel parking
    (6.10)
  Fig. 6.8 Set of Collision-free maneuvers
  6.3.2 Fuzzy Selection System

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
04-14-2024, 06:11 PM
Post: #3
RE: Perfect Parking
All right, I'll bite. Your expression can be rearranged to

√[A² + w(2√[r² - l²]-w)] - A, A = k + l

The best I can do so far with 50g User RPL (Numeric Approx mode) is

Code:

«
UNROT OVER + 4. ROLLD
SQ ROT SQ SWAP – √
2. * OVER – *
OVER SQ + √ SWAP –
»

at 70.5 bytes with a single-character program name. Interesting that the 50g code is about twice the size of your 42S version.
Find all posts by this user
Quote this message in a reply
04-15-2024, 06:19 AM
Post: #4
RE: Perfect Parking
(03-27-2024 01:11 AM)Thomas Klemm Wrote:  Can you do better?

No, not using only basic stack commands like you did. I tried ;-)
Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
04-15-2024, 06:22 AM
Post: #5
RE: Perfect Parking
Here's what I came up with using your formula:
Code:
00 { 35-Byte Prgm }
01▸LBL "PARKING"
02 X<>Y
03 R↑
04 X↑2
05 X<>Y
06 R↑
07 +
08 X<>Y
09 LASTX
10 X↑2
11 -
12 SQRT
13 ENTER
14 +
15 R↑
16 X<>Y
17 R↑
18 -
19 ×
20 X<>Y
21 X↑2
22 +
23 SQRT
24 X<>Y
25 -
26 END

But alas, it takes 2 more bytes.

I also tried using local variables:
Code:
\<< \-> r l k w
  \<< l k + DUP SQ r SQ l SQ - \v/ DUP + w - w * + \v/ SWAP -
  \>>
\>>

Of course it takes more bytes than your solution.
Find all posts by this user
Quote this message in a reply
04-16-2024, 11:04 AM
Post: #6
RE: Perfect Parking
The way I drive, the answer is easy!

L = length of car

The formula is 5 * L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)