The motion of the robot in XY-c oordinate is provided by the following equations:x(t+1)=x(i)+v*∆t* cos(pheta(i))
- y(i+1)=y(i)+v*∆t* sin(pheta(i))
- x,y represent the coordinate in jQuery224015580500307876655_1597722484936 and jQuery2240954084251016825_1597722593688 directions, respectively;
- - pheta represents the heading angle;
- - v represents the translational velocity;
- - r represents the angular velocity;
- - ∆t represents the discretization step size.
In this question we suppose ∆t=1 (sec).
Write a function called MobileRobot_Motion.m that simulates the motion of robot for 30 sec and finally illustrates the robot's motion path in XY-coordinate.
The inputs to this function are the following information:
- Initial position of the robot in x- and y- coordinate (i.e., x(1) , y(1)); - Initial heading of the robot in range of −45o ≤ pheta(1) ≤ 45o
- Translational velocity in range of 0.1 ≤ v ≤ 3;
- Angular velocity in range of 0.1 ≤r ≤ 3;
for x(1)=0 , y(1)=0,pheta(1)=10,v=1 ,r=2
MobileRobot_Motion (0,0,10,1,2) illustrates the following path for the motion of the robot in XY-coordinate:
You should provide documentation for your function (see lecture note, page 23-25).
- To implement the equation of motion given above, you can use the same technique you have used for implementing the cooling equationin Exercise5, Workshop 3.
- In your code, you should consider the validity of the arguments, especiallyfor the input variables given in the certain ranges. See examples of lecture 4, page 14 and 22.
- Be aware that MATLAB default for trigonometric functions is radian, i.e.: sin(), cos () are based on radian. You should use the equivalent functions if your calculations are based on degree (see MATLAB help).
- You should simulate the equation of motion for 30 sec; this is very similar to what you have done for cooling equation in Workshop 3: simulating for 100 minutes.
- See documentation of plot() by typing doc plot in the command window for different options such as Marker and Color so that you can generate a similar figure to one given above.