I am currently developing a robot + its ability to find, pick-up and deliver small balls in a goal. However this 2d field is filled with obstacles that i am not allowed to hit. I need to know how far i can turn before hitting an obstacle, so i can figure out my best move.
I have calculated the turn radius of my robot BUT only as if the robot was a straight line. Since the robot is a "rectangle" it will have a different turn-radius than if purely a straight line down the middle. The robot is turning around its center. There can be multiple obstacles and this is the data i have: Robot_middle(x, y) Robot_front(x, y) Robot_back(x, y) Obstacle(s)(x, y) I will attach some pictures to better explain my problem. To let you know, i have "ideas" on how to solve it, but im more looking for a equation or formula where i can insert my data. I want to know how far i can turn in each given direction based on when the robot will hit an obstacle with no more precision than 1 degree angle. Please help ive used way too long on this. Robot turning with obstacles Circle outline is not middle of robot
I had a similar problem but only to know if a point is in a rectangle, i think it will work if you reverse the logic. I took each edge of the rectangle and calculate the cross product of the vectors between the "Obstacle" and the points of the edge like so :
If you draw a triangle with these three point it will give you the orientation of the obstacle by the edge of the rectangle, and the cross product will be less or more than 0 depending on its orientation.
You could look if all of the triangle drawn are pointing inside of the area of the rectangle. If not then there is no collision.