matlab代写- rotation and mobile robot


Rotation and Mobile Robot

In this homework, you will learn about rotation and mobile robot. You will have to show your derivation and implement some algorithms. For implementation, you MUST use Matlab.

Problem 1 – Rotation (40 pts)

In this problem, you will experiment with two different ways of performing rotation.

Problem 1.1 (10pts)

Implement a Matlab function for rotating a 3D point around an axis of rotation

prot = rotateAxis(v, θ, p)

Here v is a 3 × 1 vector for the axis of rotation, θ is the angle of rotation in radian. p, prot are both 3 × 1 column vectors. prot is obtained by rotating p an angle θ around the axis v. In this question, suppose you do not know about quaternion. You cannot use quaternion for this question.

Problem 1.2 (15pts)

Implement a Matlab function for rotating a 3D point using quaternion.

prot = rotateQuat(q, p)

Here q is 4 × 1 vector representing an unit quaternion (q = (w, [v1, v2, v3])), and p, prot are both 3 × 1

column vectors. prot is obtained by rotating p using quaternion q.

Problem 1.3 (15pts)

Derive the rotation matrix R for the rotation that is represented by an unit quaternion q = (w, [v1, v2, v3]). for this rotation. The elements of rotation matrix should be expressed in terms of w, v1, v2, v3. Show your derivation on paper.

Problem 2 – Racing Robot (60pts + 15 bonus)

In this problem, you need to implement a control policy for an automatic differential drive robot to reach a target destination. There is no map and the location of the target is unknown. However, the target destination is at the end of a paved path, and the robot can reach the destination by following the path. The robot’s stating position is at the other end of the path. An example is given in Figure 1.

Path property. We will use pixel as the distance unit. The path is guaranteed to be within a 1000 × 1000

pixels area. The path is drawn as a black line on white background. The path does not loop or cross itself.

The width of the path is 31 pixels. Some pre-generated maps and paths are stored in maps.mat. See main.m for usage example. If you want to create your own maps for your own development and testing, you might find the function m_createMaps.m useful.

Sensors. Your robot has one area light sensor, as shown in Figure . The sensor returns the average reading value in a 21 × 21 area. The sensor value can be a number from 0 to 1. A value of 0 means the sensor is completely inside the black line. A value of 1 means the sensor is completely outside the black line.




Finish line

Figure 1: The amazing race with differential drive robot.

Robot Environment. We have provided you a robot environment DDRobotEnv.m You can look at this function to understand what it does but you should not modify it. File main.m is an example of how we will evaluate your policy. We have provided several maps for you to test your control policy (see maps.mat). We will use a different set of maps to grade your solution.

Control policy. The robot can be controlled by specifying the desired rotational speeds for the left and the right wheels of the robot. The wheels can rotate in both directions, so the speed can a positive or a negative value. The range of the speed is [−1, 1]. The speeds can be controlled by specifying the desired speeds; however, the actual speeds cannot be changed too fast. The actually speeds cannot be changed by more than

0.1 in each time step. For example, if the current speed is 0.7, and the desired speed is set to -0.5, then the actual speed is 0.6. In this question, you need to implement the policy that specify the desired speeds by implementing the Matlab function:

[desLwSpeed, desRwSpeed] = raceP olicy(obs) (1) The input to the function is obs which is the sensor value. The output of the policy is the desired velocity for

the left and the right wheels of the robot.

The amazing race. We will evaluate your policy on some test paths. The evaluation criteria are: 1) does the robot reach the destination, and 2) how long does it take to reach the destination. The top three solutions will receive 15, 10, and 5 bonus points.

Debugging hint. The function run of the DDRobotEnv can be run iteratively step by step.

Call:, 1000, 2) for step by step execution. Call:, 1000, 1) for full execution.

What to submit?

You will need to submit both your code and your answers to questions on Blackboard. Put the answer file and your code in a folder named: SUBID FirstName LastName (e.g., 10947XXXX lionel messi). Zip this folder and submit the zip file on Blackboard. Your submission must be a zip file, i.e, SUBID FirstName

The answer file should be named: answers.pdf, and it should contain the derivation for Problem 1.3. The re- quired Matlab functions are: rotateM at (Problem 1.1), rotateQuat (Problem 1.2), and raceP olicy (Prob- lem 2).

You MUST use Matlab for this homework. To help us grade, you must use the function names/arguments we have specified. We will deduct points or return your work if you fail to adhere to our naming conventions. Note that helper functions are fine, but the main function calls should be identical to the prototypes we provide. Do not use subdirectories.

If you are new to Matlab, try google for a Matlab tutorial. This might be a good one: http://www.



添加客服微信: abby12468