File size: 2,599 Bytes
f12661e
0dbe5a4
170ed3d
458a605
f12661e
01a6d97
f12661e
 
 
 
 
 
 
 
 
 
 
 
458a605
 
f12661e
 
0dbe5a4
f12661e
0dbe5a4
458a605
f12661e
0dbe5a4
 
f12661e
 
 
 
 
 
 
 
 
 
 
 
 
 
170ed3d
 
f12661e
 
 
 
 
 
 
 
 
 
 
 
 
df1f00b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from flight_environment import FlightEnvironment
from planners.path_planner import rrt_planner
from planners.trajectory_generator import plan_trajectory_through_path, plot_trajectory
from plot_plotly import plot_cylinders

env = FlightEnvironment(50)
start = (1,2,0)
goal = (18,18,3)

# --------------------------------------------------------------------------------------------------- #
# Call your path planning algorithm here. 
# The planner should return a collision-free path and store it in the variable `path`. 
# `path` must be an N×3 numpy array, where:
#   - column 1 contains the x-coordinates of all path points
#   - column 2 contains the y-coordinates of all path points
#   - column 3 contains the z-coordinates of all path points
# This `path` array will be provided to the `env` object for visualization.

#path = [[0,0,0],[1,1,1],[2,2,2],[3,3,3]]
path = rrt_planner(env, start, goal, step_size=1)

# --------------------------------------------------------------------------------------------------- #
# 3D env plot, choose one - Plotly or Matplotlib - comment the other

# Plotly
plot_cylinders(env, path)

# Matplotlib (laggy)
#env.plot_cylinders(path)

# --------------------------------------------------------------------------------------------------- #
#   Call your trajectory planning algorithm here. The algorithm should
#   generate a smooth trajectory that passes through all the previously
#   planned path points.
#
#   After generating the trajectory, plot it in a new figure.
#   The figure should contain three subplots showing the time histories of
#   x, y, and z respectively, where the horizontal axis represents time (in seconds).
#
#   Additionally, you must also plot the previously planned discrete path
#   points on the same figure to clearly show how the continuous trajectory
#   follows these path points.

t_traj, traj = plan_trajectory_through_path(path, desired_speed=1.0, samples_per_meter=8)
plot_trajectory(t_traj, traj, path)

# --------------------------------------------------------------------------------------------------- #


# You must manage this entire project using Git. 
# When submitting your assignment, upload the project to a code-hosting platform 
# such as GitHub or GitLab. The repository must be accessible and directly cloneable. 
#
# After cloning, running `python3 main.py` in the project root directory 
# should successfully execute your program and display:
#   1) the 3D path visualization, and
#   2) the trajectory plot.
#
# You must also include the link to your GitHub/GitLab repository in your written report.