# Calculate the Vehicle corner points given localization

I am trying to calculate the corner points of the vehicle given the details below:

• Localization data from rear axle of the vehicle
• Length and Width of the vehicle
• Heading of the vehicle ENU

Could anybody help me calculate the 4 corner points of the vehicle?

• calculate the corner based on the offset from your sensor position on the vehicle! – Max N Sep 17 at 9:54
• Is there a any mathematical formulae to get the corner points ? – KK2491 Sep 17 at 11:10

Your vehicle heading is some angle, and the corner is some distance from the rear axle. The best coordinate system to use for angles and distances is polar. So, start with a vehicle layout like:

I'm only going to go over one corner (the rest is your work to do :-)), but consider the front passenger-side corner (top view), from the center of the rear axle. You could measure the corner to be some $$$$ from the center, but the easier way to handle it would be as an $$$$ from the rear center.

Unless the car body is deforming, your $$r$$ and $$\theta$$ remain constant. Now, whenever you get a new heading $$\phi$$, you can add that to your "default" angle $$\theta$$. That is, $$\theta$$ is driven by your vehicle's geometry, $$\phi$$ is driven by your vehicle's heading. You wind up with:

$$x = r\cos\left(\theta + \phi\right) \\ y = r\sin\left(\theta + \phi\right)$$

You need to be careful with the combination of $$\theta$$ and $$\phi$$ - how the angles are added will depend on how you choose to define your angles. If you were lay a compass rose over the vehicle image I've drawn, my definition of $$\theta$$ would be from the "East" and increasing positive counter-clockwise. Compass angles, though, start with zero at the North and increase positive in the clockwise direction.

The easiest way to handle this would be to define your own $$\theta$$ using the same angular conventions as your heading, because then you really can just sum the two angles and get your corners. You may (will probably) need to redefine which trig functions are used if you're changing the angular definitions.

Please give this a shot and, if you've still got questions, please feel free to ask them here! Small follow-ups can be handled in comments, but if there's a big change in scope then please start a new question (you can link to this question in the new post).

• Thanks Chuck for the excellent explanation. I will try to implement the same and get back to you if any queries. – KK2491 Sep 21 at 11:15
• @KK2491 - Happy to help :) Good luck, sounds like it's part of a fun project :) – Chuck Sep 21 at 12:16