• Non ci sono risultati.

Simulations on Simulink and Unity

Simulation Results

4.2 Simulations on Simulink and Unity

For these simulations the schema of the model is a little bit different. The blocks of the plant is implemented on Unity. Unity has a physics engine that allows to have more realistic results with respect to the ones obtained with the plant implemented on Simulink. The sensor and the EKF blocks are not used. It simulates an ideal situation where all the states are known and the noise is not present. The signal of the actuators passes through ROS to go in Unity. Then the odometry passes through ROS to go to Simulink. It is useful to use ROS because when in future works the guidance and the controller will be deployed on the autopilot they will be converted in ROS nodes using the code generation feature of

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.94: Case with local minimum problem with RRT*FNDAPF: trajectory in the DE plane

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.95: Case with local minimum problem with RRT*FNDAPF: trajectory in the DN plane

Simulink.

There are some differences with respect to the guidance and the controller blocks of the previous model:

- a Simulation Pace block is added, which allows to control the speed of the simulation.

If the simulation in Simulink runs too fast with respect to Unity, this block forces the simulation on Simulink to decrease its speed.

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.96: Case with local minimum problem with RRT*FNDAPF: trajectory in NED

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.97: Case with local minimum problem with RRT*FNDAPF: velocity along D axis

- The actuator block is thus modified:

F1(pwm1) = (2.382 ∗ 10−6)pwm21(3.628 ∗ 10−3)pwm1+ 1.177 F2(pwm2) = (2.382 ∗ 10−6)pwm22(3.628 ∗ 10−3)pwm2+ 1.177 F1(pwm3) = (2.382 ∗ 10−6)pwm23(3.628 ∗ 10−3)pwm3+ 1.177 F1(pwm4) = (2.382 ∗ 10−6)pwm24(3.628 ∗ 10−3)pwm4+ 1.177

and for the yaw angle control the yaw command is directly used.

For these simulations the reference frame used is the SEZ. The same simulations of the previous environment are made and the video of the results are in the repository. The

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.98: Case with local minimum problem with RRT*FNDAPF: velocity along N axis

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.99: Case with local minimum problem with RRT*FNDAPF: velocity along E axis

results are worse than those obtained from simulink but the drone still reaches the goal avoiding the obstacles so they are positive. In these simulations, a PID controller is used because the SMC has too much chattering and it was unusable. In the future work, a Super Twisting Sliding Mode Controller (STSMC) could be implemented. It is a sliding mode of the second order so the chattering is reduced with this controller. The PID controller is a reason why these simulations are less accurate. In fact, also for the simulations on simulink the ones with the PID were less accurate than the ones with the SMC.

Regarding the simulations with the RRT*FNDAPF two problems surrounded:

- The first one is the delay on the position with respect to the reference. This one is present also in the simulations with the APF but for the APF the time of the

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.100: Case with local minimum problem with RRT*FNDAPF: Euler angles

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.101: Case with local minimum problem with RRT*FNDAPF: thrust produced

simulation is not important. In simulations with the RRT*FNDAPF, when the time designed by the trajectory planner is over, the speed reference becomes null so the drone does not reach the goal. To avoid this problem, a control is added at the trajectory generator. If the time of the maneuver is over and the drone is not in a tollerance radius from the goal, a supplementary reference speed is added. This new reference speed decreases while the drone is approaching the goal.

- The second one is the asincronization between the dynamic of the quadrotor and the path planning. When the drone reaches a waypoint and points to a new goal, the path planning begins to calculate the new path. In this moment the simulink model is blocked for some seconds depending on the size of the environment of the drone. If

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.102: Case with local minimum problem with RRT*FNDAPF: moments produced

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.103: Case with dynamic obstacles with RRT*FNDAPF: trajectory in the NE plane

the drone has some residual speed, it will move without control thanks to this speed.

To mitigate this previous problem is used: in the final portion of the path, the drone, thanks to the delay, will reduce its speed because the reference is null. However, this trick increases the time of the simulation.

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.104: Case with dynamic obstacles with RRT*FNDAPF: trajectory in the DE plane

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.105: Case with dynamic obstacles with RRT*FNDAPF: trajectory in the DN plane

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.106: Case with dynamic obstacles with RRT*FNDAPF: trajectory in NED

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.107: Case with dynamic obstacles with RRT*FNDAPF: velocity along D axis

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.108: Case with dynamic obstacles with RRT*FNDAPF: velocity along N axis

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.109: Case with dynamic obstacles with RRT*FNDAPF: velocity along E axis

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.110: Case with dynamic obstacles with RRT*FNDAPF: Euler angles

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.111: Case with dynamic obstacles with RRT*FNDAPF: thrust lm produced

(a) Simulation with the PID (b) Simulation with the SMC

Figure 4.112: Case with dynamic obstacles problem with RRT*FNDAPF: moments pro-duced

Documenti correlati