Finding the relative orientation to a robot
23 ビュー (過去 30 日間)
古いコメントを表示
Hello! I am writing a pure pursuit algorithm and one of the caveats to pure pursuit in general is that it only really works well if the point is infront of the robot. I am wondering if there is a way to find the relative point orientation with relation to the robots position? What I mean by this is, say I have a point that is behind the robot, I know that it is going to have to make a point-turn then go to that point, now the next point is now behind that old point so the robot will have to make another point-turn. My question, is there some kind of algorithm to always be able to determine that point? For this assignment, a flag is used to determine if the robot will calculate angular velocity, have to point turn left or point turn right (values 0,1,-1). The robot starts by pointing east at the origin, I know that I could do this using just quadrant math and the actual values of points. The problem with logic that I am having is that once it turns to the left and goes to a point in the top left quadrant, that algoritm will no longer work because now a point that used to be infront of the robot, is behind it.
Please let me know if you need clarification! Thank you guys so much.
4 件のコメント
Sam Chak
2022 年 9 月 19 日
Slowly deciphering this...
You have mentioned that coordinates of the current robot location and the coordinates of the next waypoint are known. Yet, you don't know where the next waypoint is (from the robot's current coordinates).
You want to get to New York. You are now in Miami, and you know that New York is in northernmost region. But you don't know how to get there from Miami?
採用された回答
Sam Chak
2022 年 9 月 20 日
Hi @Pawel Grum
Generally, you can the transformation matrix to obtain the relative orientation. For simplicity, you can try studying the following and code them in your algorithm. You need to translate the "Direction" and "Rotation" into 2-wheel Robot's Differential Velocities.
Origin = [0 0]; % [X, Y]
Attitude0 = 0; % orientation facing north
% Heading to Waypoint 1 from Origin
WayPoint1 = [-1 1];
Robot_Pos = Origin;
Direction = WayPoint1 - Robot_Pos % Go 1 unit to the West and 1 unit to the North
Rotation = atan(Direction(1)/Direction(2))*180/pi - Attitude0 % tells robot to rotate Left
Attitude1 = Rotation % orientation facing northwest
% Heading to Waypoint 2 from Waypoint 1
WayPoint2 = [2 2];
Robot_Pos = WayPoint1;
Direction = WayPoint2 - Robot_Pos
Rotation = atan(Direction(1)/Direction(2))*180/pi - Attitude1 % tells robot to rotate Right
Attitude2 = Rotation + Attitude1 % orientation facing northeast
% Heading to Waypoint 3 from Waypoint 2
WayPoint3 = [2 -2];
Robot_Pos = WayPoint2;
Direction = WayPoint3 - Robot_Pos % use If-else logic when it happens
Rotation = 180 - Attitude2 % tells robot to rotate Right
Attitude3 = Rotation + Attitude2 % orientation facing south
% Heading to Waypoint 4 from Waypoint 3
WayPoint4 = [4 -1];
Robot_Pos = WayPoint3;
Direction = WayPoint4 - Robot_Pos
Rotation = atan(Direction(1)/Direction(2))*180/pi - Attitude3 % tells robot to rotate Left
Attitude4 = Rotation + Attitude3 % orientation facing northeast
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Robotics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!