sorry if the title seems vague. English is not my first language and I dont know what to search to find the answer to my problem.
I will preface this by explaining the purpose of this question. I have a robot that I know the position of (x,y) through odomotery. and I also have an IMU that returns the robot's yaw angle with respect to the positive x axis of the map. In this map are objects, that I need to rotate the robot to face them. I will attach an image of how It would look like. Some sample cases
My problem is I cannot find a generalized way to cover all cases of robot's position and yaw with respect to the object and map. If someone can point me in the right direction or tell me how I could solve this I would be very thankful