An implementation of real-time optimal trajectory generation bases on the minimum snap trajectory.
The algorithm is able to perform real-time optimal trajectory planning and compute the corresponding control input. The generated trajectory should be trackable, which means the initial and the final MAV states as well as the limitation of pitch angle should be taken into consideration.
Structure contains the position, the orientation and the speed on body frame.
obj.position = [x,y,z];
obj.angle = [yaw,pitch,roll];
obj.speed = [vx,vy,vz]; % body frame
The discrete time dynamic model of MAV with the maximum of angular velocity 90 degrees per second.
ts = 0.05; % sampling time is 0.05 s
u = [throttle,yaw,pitch,roll]; % control input
obj = dynamic_mav(obj,u,ts);
Generates a trajectory by minimizing the snap over time with designed consraints (e.g. initial position, velocity etc.).
[waypoints,path_c] = path_planner(obj,tgt,time)
where obj is the MAV and tgt is the target point.
This function finds the shortest trajectory satisfies the constraint that the pitch angle should be less than 20 degrees.
[waypoints,path_c,opt_time] = time_optimal_path_planner(mav,tgt,ts);
Regarding the uncertainties in real enviroment, we added disturbances to the dynamic model as well as the target's position and orientation to evaluate the robutness of our implementation.