{"group":{"group":{"id":77,"name":"Fundamentals of robotics: 2D problems","lockable":true,"created_at":"2019-01-06T06:53:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"These problems are concerned with the fundamental concepts that underpin robotics: how do we represent the position and orientation of objects in space.\nThis is a graduated set of problems that test your skills for the two-dimensional case (2D) which is highly relevant to mobile robotics where we consider a robot moving on a plane.\nSome resources to help learn about this subject matter can be found at the Robot Academy, there are over 200 short video lessons.\n","is_default":false,"created_by":13332,"badge_id":94,"featured":false,"trending":false,"solution_count_in_trending_period":2,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":426,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThese problems are concerned with the fundamental concepts that underpin robotics: how do we represent the position and orientation of objects in space.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is a graduated set of problems that test your skills for the two-dimensional case (2D) which is highly relevant to mobile robotics where we consider a robot moving on a plane.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome resources to help learn about this subject matter can be found at the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://robotacademy.net.au\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRobot Academy\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, there are over 200 short video lessons.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}","description_html":"\u003cdiv style = \"text-align: start; line-height: normal; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; perspective-origin: 289.5px 97.5px; transform-origin: 289.5px 97.5px; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 21px; transform-origin: 266.5px 21px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThese problems are concerned with the fundamental concepts that underpin robotics: how do we represent the position and orientation of objects in space.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 31.5px; transform-origin: 266.5px 31.5px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThis is a graduated set of problems that test your skills for the two-dimensional case (2D) which is highly relevant to mobile robotics where we consider a robot moving on a plane.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 21px; transform-origin: 266.5px 21px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSome resources to help learn about this subject matter can be found at the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = 'https://robotacademy.net.au/'\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eRobot Academy\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, there are over 200 short video lessons.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 10.5px; transform-origin: 266.5px 10.5px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2019-05-08T20:16:30.000Z"},"current_player":null},"problems":[{"id":44819,"title":"Relative pose in 2D: problem 1","description":"We consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north.  There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\r\n\r\n*With respect to the world frame origin* , the robot's centre is at a distance of 123m in the x-direction and -74.6m in the y-direction.  The car's heading angle is exactly SSW.\r\n\r\nWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.*","description_html":"\u003cp\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north.  There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\u003c/p\u003e\u003cp\u003e\u003cb\u003eWith respect to the world frame origin\u003c/b\u003e , the robot's centre is at a distance of 123m in the x-direction and -74.6m in the y-direction.  The car's heading angle is exactly SSW.\u003c/p\u003e\u003cp\u003eWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.*\u003c/p\u003e","function_template":"function T = user_function()\r\n  % return a 3x3 matrix describing the pose\r\n  T = [];\r\nend","test_suite":"%%\r\nT = user_function\r\n\r\nassert(all(size(T)==3), 'The matrix must be 3x3');\r\nassert(isreal(T), 'The matrix must be real, not complex');\r\n\r\n%% bottom row\r\nT = user_function\r\nassert(isequal(T(3,:), [0 0 1]), 'The bottom row of the homogeneous transformation matrix is not correct')\r\n\r\n%% x coordinate\r\nT = user_function\r\nassert(isequal(T(1,3),123), 'The representation of the x-coordinate is not correct')\r\n\r\n%% y coordinate\r\nT = user_function\r\nassert(isequal(T(2,3),-74.6), 'The representation of the y-coordinate is not correct')\r\n\r\n%% valid rotation matrix\r\nT = user_function\r\nR = T(1:2,1:2);\r\nassert( abs(det(R)-1) \u003c 0.01, 'The determinant of the rotation submatrix is not correct')\r\n\r\n%% correct rotation matrix\r\nT = user_function\r\nR = T(1:2,1:2);\r\nassert( abs(atan2d(R(2,1), R(1,1)) + 112.5) \u003c 0.1, 'The rotation matrix is not correct, check your calculation of the heading SSW and whether you are using radians or degrees')","published":true,"deleted":false,"likes_count":3,"comments_count":7,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":174,"test_suite_updated_at":"2019-01-20T07:53:15.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-06T07:56:12.000Z","updated_at":"2026-03-17T12:53:16.000Z","published_at":"2019-01-06T08:55:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWith respect to the world frame origin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e , the robot's centre is at a distance of 123m in the x-direction and -74.6m in the y-direction. The car's heading angle is exactly SSW.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.*\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44824,"title":"Relative points in 2D: problem 2","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 31.5px; transform-origin: 408px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function P = user_function(T, PB)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         PB a 2x1 vector representing the coordinate of a point\r\n  % Output: P a 2x1 vector representing the coordinate of a point\r\n  P = ;\r\nend","test_suite":"%\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nPB = rand(2,1)*10-5;\r\n\r\nP = user_function(T, PB);\r\n%\r\nassert(all(size(P) == [2 1]), 'The point should be described by a 2x1 vector')\r\n%\r\nassert(isreal(P), 'The point should be described by a vector of real, not complex, numbers');\r\n%\r\nPref = R'*PB - R' * t;\r\nassert( all(abs(P-Pref) \u003c 0.001), 'The relative coordinates are not correct')\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":10,"created_by":13332,"edited_by":413679,"edited_at":"2025-12-15T20:32:55.000Z","deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":"2025-12-15T20:32:55.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:16:32.000Z","updated_at":"2026-03-17T13:29:59.000Z","published_at":"2019-01-10T01:16:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44820,"title":"Relative pose in 2D: problem 2","description":"We consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\r\nWith respect to the robot's coordinate frame, the world frame origin is at a distance of 67.2m in the x-direction and 32.4m in the y-direction, and at a bearing angle of 42 degrees.\r\nWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eWith respect to the robot's coordinate frame\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e, the world frame origin is at a distance of 67.2m in the x-direction and 32.4m in the y-direction, and at a bearing angle of 42 degrees.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function T = your_fcn_name()\r\n  % return a 3x3 matrix describing the robot's pose\r\n  T = [];\r\nend","test_suite":"%%\r\nT = your_fcn_name;\r\nassert(all(size(T)==3), 'The matrix must be 3x3');\r\nassert(isreal(T), 'The matrix must be real, not complex');\r\n\r\n%% bottom row\r\nT = your_fcn_name;\r\nassert(isequal(T(3,:), [0 0 1]), 'The bottom row of the homogeneous transformation matrix is not correct')\r\n\r\n%% x coordinate\r\nT = your_fcn_name;\r\nassert(abs(T(1,3)+71.619164)\u003c1e-4, 'The representation of the x-coordinate is not correct')\r\n\r\n%% y coordinate\r\nT = your_fcn_name;\r\nassert(abs(T(2,3)-20.88768)\u003c1e-4, 'The representation of the y-coordinate is not correct')\r\n\r\n%% valid rotation matrix\r\nT = your_fcn_name;\r\nR = T(1:2,1:2);\r\nassert( abs(det(R)-1) \u003c 0.01, 'The determinant of the rotation submatrix is not correct')\r\n\r\n%% correct rotation matrix\r\nT = your_fcn_name;\r\nR = T(1:2,1:2);\r\nassert( abs(atan2d(R(2,1), R(1,1)) + 42) \u003c 0.1, 'The rotation matrix is not correct, check your calculation of the heading SSW and whether you are using radians or degrees')\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":13332,"edited_by":26769,"edited_at":"2022-04-12T14:43:28.000Z","deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2022-04-12T14:43:28.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-06T08:01:07.000Z","updated_at":"2026-03-07T11:25:11.000Z","published_at":"2019-01-06T08:10:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWith respect to the robot's coordinate frame\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, the world frame origin is at a distance of 67.2m in the x-direction and 32.4m in the y-direction, and at a bearing angle of 42 degrees.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44823,"title":"Relative points in 2D: problem 1","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 383.5px 8px; transform-origin: 383.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function PB = user_function(T, P)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         P a 2x1 vector representing the coordinate of a point\r\n  % Output: PB a 2x1 vector representing the coordinate of a point\r\n  PB = ;\r\nend","test_suite":"%%\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nP = rand(2,1)*20-10;\r\n\r\nPB = user_function(T, P);\r\n\r\nassert(all(size(PB) == [2 1]), 'The point should be described by a 2x1 vector')\r\nassert(isreal(PB), 'The point should be described by a vector of real, not complex, numbers');\r\nPBref = R'*P - R'*t;\r\nassert( all(abs(PB-PBref) \u003c 0.001), 'The relative coordinates are not correct')\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":4,"created_by":13332,"edited_by":223089,"edited_at":"2023-04-16T17:43:18.000Z","deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2023-04-15T16:49:35.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:14:43.000Z","updated_at":"2026-03-07T17:15:55.000Z","published_at":"2020-03-14T23:40:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44823,"title":"Relative points in 2D: problem 1","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 383.5px 8px; transform-origin: 383.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function PB = user_function(T, P)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         P a 2x1 vector representing the coordinate of a point\r\n  % Output: PB a 2x1 vector representing the coordinate of a point\r\n  PB = ;\r\nend","test_suite":"%%\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nP = rand(2,1)*20-10;\r\n\r\nPB = user_function(T, P);\r\n\r\nassert(all(size(PB) == [2 1]), 'The point should be described by a 2x1 vector')\r\nassert(isreal(PB), 'The point should be described by a vector of real, not complex, numbers');\r\nPBref = R'*P - R'*t;\r\nassert( all(abs(PB-PBref) \u003c 0.001), 'The relative coordinates are not correct')\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":4,"created_by":13332,"edited_by":223089,"edited_at":"2023-04-16T17:43:18.000Z","deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2023-04-15T16:49:35.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:14:43.000Z","updated_at":"2026-03-07T17:15:55.000Z","published_at":"2020-03-14T23:40:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44824,"title":"Relative points in 2D: problem 2","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 31.5px; transform-origin: 408px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function P = user_function(T, PB)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         PB a 2x1 vector representing the coordinate of a point\r\n  % Output: P a 2x1 vector representing the coordinate of a point\r\n  P = ;\r\nend","test_suite":"%\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nPB = rand(2,1)*10-5;\r\n\r\nP = user_function(T, PB);\r\n%\r\nassert(all(size(P) == [2 1]), 'The point should be described by a 2x1 vector')\r\n%\r\nassert(isreal(P), 'The point should be described by a vector of real, not complex, numbers');\r\n%\r\nPref = R'*PB - R' * t;\r\nassert( all(abs(P-Pref) \u003c 0.001), 'The relative coordinates are not correct')\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":10,"created_by":13332,"edited_by":413679,"edited_at":"2025-12-15T20:32:55.000Z","deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":"2025-12-15T20:32:55.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:16:32.000Z","updated_at":"2026-03-17T13:29:59.000Z","published_at":"2019-01-10T01:16:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44820,"title":"Relative pose in 2D: problem 2","description":"We consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\r\nWith respect to the robot's coordinate frame, the world frame origin is at a distance of 67.2m in the x-direction and 32.4m in the y-direction, and at a bearing angle of 42 degrees.\r\nWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eWith respect to the robot's coordinate frame\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e, the world frame origin is at a distance of 67.2m in the x-direction and 32.4m in the y-direction, and at a bearing angle of 42 degrees.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function T = your_fcn_name()\r\n  % return a 3x3 matrix describing the robot's pose\r\n  T = [];\r\nend","test_suite":"%%\r\nT = your_fcn_name;\r\nassert(all(size(T)==3), 'The matrix must be 3x3');\r\nassert(isreal(T), 'The matrix must be real, not complex');\r\n\r\n%% bottom row\r\nT = your_fcn_name;\r\nassert(isequal(T(3,:), [0 0 1]), 'The bottom row of the homogeneous transformation matrix is not correct')\r\n\r\n%% x coordinate\r\nT = your_fcn_name;\r\nassert(abs(T(1,3)+71.619164)\u003c1e-4, 'The representation of the x-coordinate is not correct')\r\n\r\n%% y coordinate\r\nT = your_fcn_name;\r\nassert(abs(T(2,3)-20.88768)\u003c1e-4, 'The representation of the y-coordinate is not correct')\r\n\r\n%% valid rotation matrix\r\nT = your_fcn_name;\r\nR = T(1:2,1:2);\r\nassert( abs(det(R)-1) \u003c 0.01, 'The determinant of the rotation submatrix is not correct')\r\n\r\n%% correct rotation matrix\r\nT = your_fcn_name;\r\nR = T(1:2,1:2);\r\nassert( abs(atan2d(R(2,1), R(1,1)) + 42) \u003c 0.1, 'The rotation matrix is not correct, check your calculation of the heading SSW and whether you are using radians or degrees')\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":13332,"edited_by":26769,"edited_at":"2022-04-12T14:43:28.000Z","deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2022-04-12T14:43:28.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-06T08:01:07.000Z","updated_at":"2026-03-07T11:25:11.000Z","published_at":"2019-01-06T08:10:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. There is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWith respect to the robot's coordinate frame\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, the world frame origin is at a distance of 67.2m in the x-direction and 32.4m in the y-direction, and at a bearing angle of 42 degrees.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a 3x3 matrix homogeneous transformation matrix that expresses the pose of the robot frame {B} with respect to the world frame {O}.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44823,"title":"Relative points in 2D: problem 1","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 383.5px 8px; transform-origin: 383.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function PB = user_function(T, P)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         P a 2x1 vector representing the coordinate of a point\r\n  % Output: PB a 2x1 vector representing the coordinate of a point\r\n  PB = ;\r\nend","test_suite":"%%\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nP = rand(2,1)*20-10;\r\n\r\nPB = user_function(T, P);\r\n\r\nassert(all(size(PB) == [2 1]), 'The point should be described by a 2x1 vector')\r\nassert(isreal(PB), 'The point should be described by a vector of real, not complex, numbers');\r\nPBref = R'*P - R'*t;\r\nassert( all(abs(PB-PBref) \u003c 0.001), 'The relative coordinates are not correct')\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":4,"created_by":13332,"edited_by":223089,"edited_at":"2023-04-16T17:43:18.000Z","deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2023-04-15T16:49:35.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:14:43.000Z","updated_at":"2026-03-07T17:15:55.000Z","published_at":"2020-03-14T23:40:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is described by a 2x1 coordinate vector P with respect to the world coordinate frame. What is the coordinate of the landmark with respect to the robot?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44824,"title":"Relative points in 2D: problem 2","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 31.5px; transform-origin: 408px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function P = user_function(T, PB)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         PB a 2x1 vector representing the coordinate of a point\r\n  % Output: P a 2x1 vector representing the coordinate of a point\r\n  P = ;\r\nend","test_suite":"%\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nPB = rand(2,1)*10-5;\r\n\r\nP = user_function(T, PB);\r\n%\r\nassert(all(size(P) == [2 1]), 'The point should be described by a 2x1 vector')\r\n%\r\nassert(isreal(P), 'The point should be described by a vector of real, not complex, numbers');\r\n%\r\nPref = R'*PB - R' * t;\r\nassert( all(abs(P-Pref) \u003c 0.001), 'The relative coordinates are not correct')\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":10,"created_by":13332,"edited_by":413679,"edited_at":"2025-12-15T20:32:55.000Z","deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":"2025-12-15T20:32:55.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:16:32.000Z","updated_at":"2026-03-17T13:29:59.000Z","published_at":"2019-01-10T01:16:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a 2x1 coordinate vector P. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44825,"title":"Relative points in 2D: problem 3","description":"The 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T.  A landmark point is observed by the robot, as a bearing angle relative to its x-axis (in degrees and increasing counter clockwise) and a range.  What is the coordinate of the landmark with respect to the world coordinate frame?","description_html":"\u003cp\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T.  A landmark point is observed by the robot, as a bearing angle relative to its x-axis (in degrees and increasing counter clockwise) and a range.  What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/p\u003e","function_template":"function PB = user_function(T, bearing, range)\r\n  % Input:  T a 3x3 homogeneous transformation matrix\r\n  %         bearing a scalar angle\r\n  %         range a scalar distance\r\n  % Output: PB a 2x1 vector representing the coordinate of a point\r\n  P = ;\r\nend","test_suite":"th = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\nPB = rand(2,1)*10-5;\r\nbearing = rand*360-180;\r\nrange = rand*20+5;\r\n\r\nP = user_function(T, bearing, range);\r\n%%\r\nassert(all(size(P) == [2 1]), 'The point should be described by a 2x1 vector')\r\n%%\r\nassert(isreal(P), 'The point should be described by a vector of real, not complex, numbers');\r\n%%\r\nPB = range*[cosd(bearing); sind(bearing)];\r\nPref = R'*PB - R' * t;\r\nassert( all(abs(P-Pref) \u003c 0.001), 'The relative coordinates are not correct')\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T01:23:18.000Z","updated_at":"2026-03-07T18:50:42.000Z","published_at":"2019-01-10T01:23:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe 2D pose of a robot, with respect to a world coordinate frame {O}, is described by a 3x3 homogenous transform matrix T. A landmark point is observed by the robot, as a bearing angle relative to its x-axis (in degrees and increasing counter clockwise) and a range. What is the coordinate of the landmark with respect to the world coordinate frame?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44837,"title":"Composing relative poses in 2D: problem 1","description":"We consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. \r\n\r\nThere is a playing field with a reference frame denoted by {F}.  The rigid-body displacement from {O} to {F} is given by the homogenous transformation |TF| .\r\n\r\nThere are two robots (robot 1 and robot 2) on the playing field, with attached body-fixed coordinate frame {B} and {C} respectively with their origins at the centre of the robot. The x-axis of each robot's frame points in the robot's forward direction.  \r\n\r\nThe rigid-body displacement of robot 1 with respect to the world frame is estimated by GPS to be the homogenous transformation |TB| .  The displacement of robot 2 with respect to robot 1 is estimated by a novel radar sensor and is given by the homogenous transformation |TBC| .\r\n\r\nWhere is robot 2 with respect to the field?","description_html":"\u003cp\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north.\u003c/p\u003e\u003cp\u003eThere is a playing field with a reference frame denoted by {F}.  The rigid-body displacement from {O} to {F} is given by the homogenous transformation \u003ctt\u003eTF\u003c/tt\u003e .\u003c/p\u003e\u003cp\u003eThere are two robots (robot 1 and robot 2) on the playing field, with attached body-fixed coordinate frame {B} and {C} respectively with their origins at the centre of the robot. The x-axis of each robot's frame points in the robot's forward direction.\u003c/p\u003e\u003cp\u003eThe rigid-body displacement of robot 1 with respect to the world frame is estimated by GPS to be the homogenous transformation \u003ctt\u003eTB\u003c/tt\u003e .  The displacement of robot 2 with respect to robot 1 is estimated by a novel radar sensor and is given by the homogenous transformation \u003ctt\u003eTBC\u003c/tt\u003e .\u003c/p\u003e\u003cp\u003eWhere is robot 2 with respect to the field?\u003c/p\u003e","function_template":"function TFC = user_function(TF, TB, TBC)\r\n  % Input:  TF a 3x3 homogeneous transformation matrix\r\n  %         TB a 3x3 homogeneous transformation matrix\r\n  %         TBC a 3x3 homogeneous transformation matrix\r\n  %         P a 2x1 vector representing the coordinate of a point\r\n  % Output: TFC a 3x3 homogeneous transformation matrix\r\n  %\r\n  TFC = ;\r\nend","test_suite":"th = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nTF = [R t; 0 0 1];\r\n\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nTB = [R t; 0 0 1];\r\n\r\nth = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nTBC = [R t; 0 0 1];\r\n\r\n\r\n%%\r\nT = user_function(TF, TB, TBC)\r\n\r\nassert(all(size(T)==3), 'The matrix must be 3x3');\r\nassert(isreal(T), 'The matrix must be real, not complex');\r\n\r\n%% bottom row\r\nT = user_function(TF, TB, TBC)\r\nassert(isequal(T(3,:), [0 0 1]), 'The bottom row of the homogeneous transformation matrix is not correct')\r\n\r\n%% valid rotation matrix\r\nT = user_function(TF, TB, TBC)\r\nR = T(1:2,1:2);\r\nassert( abs(det(R)-1) \u003c 0.01, 'The determinant of the rotation submatrix is not correct')\r\n\r\n%% correct value\r\nT = user_function(TF, TB, TBC)\r\nTref = inv(TB*TBC)*TF*T;\r\nassert( norm(Tref-eye(3,3)) \u003c 1e-6, 'The homogeneous transform value is not correct')","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":64,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-20T08:11:47.000Z","updated_at":"2026-03-08T02:06:59.000Z","published_at":"2019-01-20T08:33:16.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is a playing field with a reference frame denoted by {F}. The rigid-body displacement from {O} to {F} is given by the homogenous transformation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eTF\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e .\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are two robots (robot 1 and robot 2) on the playing field, with attached body-fixed coordinate frame {B} and {C} respectively with their origins at the centre of the robot. The x-axis of each robot's frame points in the robot's forward direction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe rigid-body displacement of robot 1 with respect to the world frame is estimated by GPS to be the homogenous transformation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eTB\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e . The displacement of robot 2 with respect to robot 1 is estimated by a novel radar sensor and is given by the homogenous transformation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eTBC\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e .\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhere is robot 2 with respect to the field?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44831,"title":"Composing relative poses in 2D: problem 2","description":"We consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north. \r\n\r\nThere is a playing field with a reference frame denoted by {F}.  The rigid-body displacement from {O} to {F} is given by the homogenous transformation |TF| .\r\n\r\nThere is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.  The rigid-body displacement displacement of {B} relative to {F} is given by the homogenous transformation |TB| .\r\n\r\nThe robot carries a laser scanner which reports the range and bearing of landmarks with respect to its coordinate frame {S} with zero bearing angle corresponding to its x-axis.  The scanner is displaced from the centre of the robot and the displacement of frame {S} relative to {B} is given by the homogenous transformation |TS| .\r\n\r\nThere is a landmark with position described by a coordinate vector P with respect to the world coordinate frame {O}.\r\n\r\nWhat is the range and bearing of the landmark as observed by the laser scanner?","description_html":"\u003cp\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north.\u003c/p\u003e\u003cp\u003eThere is a playing field with a reference frame denoted by {F}.  The rigid-body displacement from {O} to {F} is given by the homogenous transformation \u003ctt\u003eTF\u003c/tt\u003e .\u003c/p\u003e\u003cp\u003eThere is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction.  The rigid-body displacement displacement of {B} relative to {F} is given by the homogenous transformation \u003ctt\u003eTB\u003c/tt\u003e .\u003c/p\u003e\u003cp\u003eThe robot carries a laser scanner which reports the range and bearing of landmarks with respect to its coordinate frame {S} with zero bearing angle corresponding to its x-axis.  The scanner is displaced from the centre of the robot and the displacement of frame {S} relative to {B} is given by the homogenous transformation \u003ctt\u003eTS\u003c/tt\u003e .\u003c/p\u003e\u003cp\u003eThere is a landmark with position described by a coordinate vector P with respect to the world coordinate frame {O}.\u003c/p\u003e\u003cp\u003eWhat is the range and bearing of the landmark as observed by the laser scanner?\u003c/p\u003e","function_template":"function [bearing, range] = user_function(TF, TB, TS, P)\r\n  % Input:  TF a 3x3 homogeneous transformation matrix\r\n  %         TB a 3x3 homogeneous transformation matrix\r\n  %         TS a 3x3 homogeneous transformation matrix\r\n  %         P a 2x1 vector representing the coordinate of a point\r\n  % Output: bearing, a scalar angle\r\n  %         range, a scalar distance\r\n  bearing = ;\r\n  range = ;\r\nend","test_suite":"th = 2*pi*rand - pi;\r\nt = rand(2,1)*60-30;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nTF = [R t; 0 0 1];\r\n\r\nth = 2*pi*rand - pi;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nTB = [R t; 0 0 1];\r\n\r\nth = 30*pi/180;\r\nt = [0.5; -0.3];\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nTS = [R t; 0 0 1];\r\n\r\nP = rand(2,1) * 500 - 250;\r\n\r\nPref = inv(TF * TB * TS) * [P; 1];\r\n[bearingRef,rangeRef] = cart2pol( Pref(1), Pref(2) );\r\n\r\n[bearing, range] = user_function(TF, TB, TS, P);\r\n\r\n%%\r\nassert(isscalar(bearing) \u0026 isreal(bearing), 'Bearing angle must be a real scalar')\r\n%%\r\nassert(isscalar(range) \u0026 isreal(range), 'Range must be a real scalar')\r\n%%\r\nassert(abs(bearing-bearingRef) \u003c 0.001, 'Bearing angle is not correct')\r\n%%\r\nassert(abs(range-rangeRef) \u003c 0.001, 'Range is not correct')\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2019-01-10T10:52:52.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T10:46:31.000Z","updated_at":"2026-03-08T02:54:18.000Z","published_at":"2019-01-10T10:52:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe consider a world reference frame denoted by {0} which has its x-axis pointing east and its y-axis pointing north.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is a playing field with a reference frame denoted by {F}. The rigid-body displacement from {O} to {F} is given by the homogenous transformation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eTF\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e .\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is a robot with an attached body-fixed coordinate frame {B} whose origin is in the centre of the robot, and whose x-axis points in the robot's forward direction. The rigid-body displacement displacement of {B} relative to {F} is given by the homogenous transformation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eTB\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e .\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe robot carries a laser scanner which reports the range and bearing of landmarks with respect to its coordinate frame {S} with zero bearing angle corresponding to its x-axis. The scanner is displaced from the centre of the robot and the displacement of frame {S} relative to {B} is given by the homogenous transformation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eTS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e .\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is a landmark with position described by a coordinate vector P with respect to the world coordinate frame {O}.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the range and bearing of the landmark as observed by the laser scanner?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44838,"title":"Pose from bearing angles in 2D","description":"A robot moving on the plane has a sensor that measures the bearing angle to two mapped landmarks, that is, the world frame coordinates of the landmarks are known and represented by position vectors |P1| and |P2| .  The bearing angles to the landmarks, with respect to the x-axis of the robot's coordinate frame are |th1| and |th2| respectively.  The robot's forward direction is parallel to its x-axis and its heading angle, with respect to magnetic north is |thb| .\r\n\r\nDetermine the pose of the robot expressed as a homogeneous transformation matrix with respect to the world coordinate frame.  In surveying this is known as a resection problem.","description_html":"\u003cp\u003eA robot moving on the plane has a sensor that measures the bearing angle to two mapped landmarks, that is, the world frame coordinates of the landmarks are known and represented by position vectors \u003ctt\u003eP1\u003c/tt\u003e and \u003ctt\u003eP2\u003c/tt\u003e .  The bearing angles to the landmarks, with respect to the x-axis of the robot's coordinate frame are \u003ctt\u003eth1\u003c/tt\u003e and \u003ctt\u003eth2\u003c/tt\u003e respectively.  The robot's forward direction is parallel to its x-axis and its heading angle, with respect to magnetic north is \u003ctt\u003ethb\u003c/tt\u003e .\u003c/p\u003e\u003cp\u003eDetermine the pose of the robot expressed as a homogeneous transformation matrix with respect to the world coordinate frame.  In surveying this is known as a resection problem.\u003c/p\u003e","function_template":"function T = user_function(P1, P2, th1, th2, thb)\r\n% Input:  P1 a 2x1 vector representing the coordinate of a point\r\n%         P2 a 2x1 vector representing the coordinate of a point\r\n%         th1 bearing, a scalar angle\r\n%         th2 bearing, a scalar angle\r\n%         thb heading, a scalar angle\r\n% Output: T a 3x3 homogeneous transformation matrix\r\n  T = ;\r\nend","test_suite":"%\r\nP1 = [10 20]';\r\nP2 = [20 20]';\r\nP = rand(2,1)*5 + [5 5]';\r\nthb = rand*0.2;\r\nx = P1 - P;\r\nth1 = atan2(x(2), x(1)) - thb;\r\nx = P2 - P;\r\nth2 = atan2(x(2), x(1)) - thb;\r\n\r\nT = user_function(P1, P2, th1, th2, thb);\r\n\r\n%% test size and complexity\r\nassert(all(size(T)==3), 'The matrix must be 3x3');\r\nassert(isreal(T), 'The matrix must be real, not complex');\r\n\r\n%% bottom row\r\nassert(isequal(T(3,:), [0 0 1]), 'The bottom row of the homogeneous transformation matrix is not correct')\r\n\r\n%% x coordinate\r\nassert(abs(T(1,3)-P(1))\u003c1e-4, 'The representation of the x-coordinate is not correct')\r\n\r\n%% y coordinate\r\nassert(abs(T(2,3)-P(2))\u003c1e-4, 'The representation of the y-coordinate is not correct')\r\n\r\n%% valid rotation matrix\r\nR = T(1:2,1:2);\r\nassert( abs(det(R)-1) \u003c 1e-4, 'The determinant of the rotation submatrix is not correct')\r\n\r\n%% correct rotation matrix\r\nR = T(1:2,1:2);\r\nassert( abs(atan2(R(2,1), R(1,1)) - thb) \u003c 1e-4, 'The rotation matrix is not correct, check your calculation of the heading SSW and whether you are using radians or degrees')\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-21T00:32:56.000Z","updated_at":"2026-02-15T06:52:16.000Z","published_at":"2019-01-21T00:37:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA robot moving on the plane has a sensor that measures the bearing angle to two mapped landmarks, that is, the world frame coordinates of the landmarks are known and represented by position vectors\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eP1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eP2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e . The bearing angles to the landmarks, with respect to the x-axis of the robot's coordinate frame are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eth1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eth2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e respectively. The robot's forward direction is parallel to its x-axis and its heading angle, with respect to magnetic north is\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ethb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e .\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDetermine the pose of the robot expressed as a homogeneous transformation matrix with respect to the world coordinate frame. In surveying this is known as a resection problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44828,"title":"Pose interpolation in 2D","description":"Consider two poses represented by homogeneous transformation matrices: |T1| and |T2|.  Write an algorithm to interpolate between these poses according to 0 \u003c= |s| \u003c= 1.  When s=0 the algorithm should return |T1| and when |s| =1 it should return |T2| .  For intermediate values of |s| it should return a proper homogeneous transformation matrix.  Orientation angle should increase in a positive (counter clockwise) direction.","description_html":"\u003cp\u003eConsider two poses represented by homogeneous transformation matrices: \u003ctt\u003eT1\u003c/tt\u003e and \u003ctt\u003eT2\u003c/tt\u003e.  Write an algorithm to interpolate between these poses according to 0 \u0026lt;= \u003ctt\u003es\u003c/tt\u003e \u0026lt;= 1.  When s=0 the algorithm should return \u003ctt\u003eT1\u003c/tt\u003e and when \u003ctt\u003es\u003c/tt\u003e =1 it should return \u003ctt\u003eT2\u003c/tt\u003e .  For intermediate values of \u003ctt\u003es\u003c/tt\u003e it should return a proper homogeneous transformation matrix.  Orientation angle should increase in a positive (counter clockwise) direction.\u003c/p\u003e","function_template":"function T = user_function(T1, T2, s)\r\n  % Input:  T1 a 3x3 homogeneous transformation matrix, initial pose\r\n  %         T2 a 3x3 homogeneous transformation matrix, final pose\r\n  %         s  a scalar between 0 and 1\r\n  % Outout: T  a 3x3 homogeneous transformation matrix, interpolated pose\r\n  T = ;\r\nend","test_suite":"th1 = 2*pi*rand - pi;\r\nt1 = rand(2,1)*20-10;\r\nR1 = [cos(th1) -sin(th1); sin(th1) cos(th1)];\r\nT1 = [R1 t1; 0 0 1];\r\nth2 = 2*pi*rand - pi;\r\nt2 = rand(2,1)*20-10;\r\nR2 = [cos(th2) -sin(th2); sin(th2) cos(th2)];\r\nT2 = [R2 t2; 0 0 1];\r\ns = 0.2 + rand*0.5;\r\n\r\nTi0 = user_function(T1, T2, 0);\r\nTi1 = user_function(T1, T2, 1);\r\nTis = user_function(T1, T2, s);\r\n\r\n\r\n\r\n%%\r\nassert(all(size(Ti0)==3), 's=0: the matrix must be 3x3');\r\n%\r\nassert(isreal(Ti0), 's=0: the matrix must be real, not complex');\r\n% bottom row\r\nassert(isequal(Ti0(3,:), [0 0 1]), 's=0: the bottom row of the homogeneous transformation matrix is not correct')\r\n%\r\nassert( max(max(abs(Ti0-T1))) \u003c 0.0001, 's=0: the interpolated value for s=0 is not correct');\r\n% translation\r\nassert(norm(Ti0(1:2,3)-t1) \u003c 0.0001, 's=0: the translation component is not correct')\r\n% determinant\r\nassert(abs(det(Ti0)-1) \u003c 1e-6, 's=0: the rotation submatrix is not proper')\r\n%\r\nth = atan2(Ti0(2,1), Ti0(1,1));\r\ndth = th - th1;\r\nassert(abs(dth) \u003c 0.0001, 's=0: the rotation submatrix is not correct')\r\n\r\n%%\r\nassert(all(size(Ti1)==3), 's=1: the matrix must be 3x3');\r\n%\r\nassert(isreal(Ti1), 's=1: the matrix must be real, not complex');\r\n% bottom row\r\nassert(isequal(Ti1(3,:), [0 0 1]), 's=1: the bottom row of the homogeneous transformation matrix is not correct')\r\n% translation\r\nassert(norm(Ti1(1:2,3)-t2) \u003c 0.0001, 's=1: the translation component is not correct')\r\n%% determinant\r\nassert(abs(det(Ti1)-1) \u003c 1e-6, 's=1: the rotation submatrix is not proper')\r\n% rotation\r\nth = atan2(Ti1(2,1), Ti1(1,1));\r\ndth = th - th2;\r\nassert(abs(dth) \u003c 0.0001, 's=1: the rotation submatrix is not correct')\r\n\r\n\r\n%%\r\nassert(all(size(Tis)==3), 's=%f: the matrix must be 3x3', s);\r\nassert(isreal(Tis), 's=%f: the matrix must be real, not complex', s);\r\n% bottom row\r\nassert(isequal(Tis(3,:), [0 0 1]), 's=%f: the bottom row of the homogeneous transformation matrix is not correct', s)\r\n% determinant\r\nassert(abs(det(Tis)-1) \u003c 1e-6, 's=%f: the rotation submatrix is not proper', s)\r\n\r\n\r\n% translation\r\nTD = inv(T1) * T2;\r\nTDi = inv(T1) * Tis;\r\ndx = TD(1,3)*s - TDi(1,3);\r\ndy = TD(2,3)*s - TDi(2,3);\r\nassert(abs(dx) \u003c 0.0001, 's=%f: the x-translation component is not correct', s)\r\nassert(abs(dy) \u003c 0.0001, 's=%f: the y-translation component is not correct', s)\r\n% rotation matrix\r\nLDi = logm(TDi);\r\ndrot = LDi(2,1)  + th1*s - th2*s;\r\nwhile drot \u003e pi\r\n    drot = drot - 2*pi;\r\nend\r\nwhile drot \u003c -pi\r\n    drot = drot + 2*pi;\r\nend\r\nassert(abs(drot) \u003c 0.0001, 's=%f: the rotation submatrix is not correct')\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":28,"test_suite_updated_at":"2019-01-21T22:44:17.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T06:21:41.000Z","updated_at":"2026-02-15T06:56:03.000Z","published_at":"2019-01-10T06:42:31.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider two poses represented by homogeneous transformation matrices:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eT1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eT2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Write an algorithm to interpolate between these poses according to 0 \u0026lt;=\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u0026lt;= 1. When s=0 the algorithm should return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eT1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and when\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e =1 it should return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eT2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e . For intermediate values of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e it should return a proper homogeneous transformation matrix. Orientation angle should increase in a positive (counter clockwise) direction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44830,"title":"Twists in 2D","description":"So far we have represented the pose of an object in the plane using a homogeneous transformation, a 3x3 matrix belonging to the special Euclidean group SE(2), which is also a Lie group.\r\n\r\nAn alternative, and compact, representation of pose is as a twist, a 3-vector comprising the unique elements of the corresponding 3x3 matrix in the Lie algebra se(2).  The matrix exponential of the Lie algebra matrix is a Lie group matrix.\r\n\r\nGiven a homogeneous transformation, return the corresponding twist as a column vector with the translational elements first.  ","description_html":"\u003cp\u003eSo far we have represented the pose of an object in the plane using a homogeneous transformation, a 3x3 matrix belonging to the special Euclidean group SE(2), which is also a Lie group.\u003c/p\u003e\u003cp\u003eAn alternative, and compact, representation of pose is as a twist, a 3-vector comprising the unique elements of the corresponding 3x3 matrix in the Lie algebra se(2).  The matrix exponential of the Lie algebra matrix is a Lie group matrix.\u003c/p\u003e\u003cp\u003eGiven a homogeneous transformation, return the corresponding twist as a column vector with the translational elements first.\u003c/p\u003e","function_template":"function tw = user_function(T)\r\n  % Input: T a 3x3 homogeneous transformation matrix\r\n  % Outout: tw a 3x1 twist vector with translational elements first\r\n  tw = ;\r\nend","test_suite":"th = 2*pi*rand;\r\nt = rand(2,1)*20-10;\r\nR = [cos(th) -sin(th); sin(th) cos(th)];\r\nT = [R t; 0 0 1];\r\n\r\ntw = user_function(T);\r\n%%\r\nassert(all(size(tw)==[3 1]), 'The twist must be a 3-element column vector');\r\n%%\r\nassert(isreal(tw), 'The twist must be real, not complex');\r\n\r\n%%\r\nTT = expm([0 -tw(3) tw(1); tw(3) 0 tw(2); 0 0 0]);\r\nassert(norm(abs(TT-T)) \u003c 1e-6, 'The twist is not correct')\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":13332,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2019-01-10T07:12:32.000Z","rescore_all_solutions":false,"group_id":77,"created_at":"2019-01-10T06:47:50.000Z","updated_at":"2026-02-15T06:57:38.000Z","published_at":"2019-01-10T07:12:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo far we have represented the pose of an object in the plane using a homogeneous transformation, a 3x3 matrix belonging to the special Euclidean group SE(2), which is also a Lie group.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAn alternative, and compact, representation of pose is as a twist, a 3-vector comprising the unique elements of the corresponding 3x3 matrix in the Lie algebra se(2). The matrix exponential of the Lie algebra matrix is a Lie group matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a homogeneous transformation, return the corresponding twist as a column vector with the translational elements first.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}