In this project, you are provided with a quadrotor simulator written in Matlab. The simulator implements dynamics model of quadrotor and relies on the numerical solver ode45.
Your tasks include:
You will need to implement controller in controller.m. The input of controller includes time `t`, current state vector `s` and desired state vector `s_des`. The output of controller is force `F` and moment `M`. Detailed derivation can be found in lecture notes and [1].
You will need to command the quadrotor through three sample trajectories: hovering, circle and diamond. All trajectory generators take time `t` and current state vector `s` as input and output desired state vector `s_des`. The duration of all trajectories should be 25 s. At least one circulation (for the last 2 trajectories) should be included. Besides, along the trajectory, the yaw angle of the quadrotor must be changing smoothly. Note: Be careful about the discontinuous point of the Euler angle, such as -180° to 180°.
Sample trajectories are shown below. Sample codes for generating such trajectories have been provided, you can directly use them. Or you can write your own trajectories, but the above requirements for the trajectories must be satisfied.
Use the script test_trajectory.m as the main entry point.
+ code
+ readonly #supposed to be read only
- quadModel_readonly.m #parameters of a 500g quadrotor
- quadEOM_readonly.m #dynamics model of quadrotor.
- run_trajectory_readonly.m #solve the equation of motion, receive desired trajectory,run your controller, iteratively. visualization is also included.
+ utils #useful functions.
- controller.m #what you need to work with. Calculate force and moment given current and desired state vector of quadrotor.
- *_trajectory.m #what you need to work with. design the trajectory for quadrotor given the path. Calculate desired state given current state vector and current time. The file trajectory_generator gives a framework just for reference.
- test_trajectory.m #main entry.
[1]: N. M, M. Daniel, L. Quentin, and K. Vijay, “The grasp multiple micro-uav testbed,” IEEE Robotics and Automation Magazine, vol. 17, no. 3, pp. 56–65, 2010.