Compare commits

..

No commits in common. "bc74df94485e88f9d2ec74c778a85740712cd04b" and "c642f2b3e7ed869f5ed9c82d8d1bf39deec65bea" have entirely different histories.

8 changed files with 18 additions and 222 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1024 KiB

View File

@ -31,7 +31,7 @@ The rest of this readme is structured as follows. In [Section 2](#implementation
The multi-purpose control framework presented in this repository consists of four main components. These components are intended to make the implementation as modular as possible, facilitating extensions to certain components without having to alter the overall structure of the framework. An illustration of the components and their interaction is displayed below. The multi-purpose control framework presented in this repository consists of four main components. These components are intended to make the implementation as modular as possible, facilitating extensions to certain components without having to alter the overall structure of the framework. An illustration of the components and their interaction is displayed below.
<p align="center"> <p align="center">
<img src="Images/MPC_Framework.svg" width="100%"> <img src="Images/MPC_Framework.png">
</p> </p>
### Map ### Map

View File

@ -156,7 +156,7 @@ class Map:
if __name__ == '__main__': if __name__ == '__main__':
map = Map('maps/real_map.png') map = Map('real_map.png')
# map = Map('maps/sim_map.png') # map = Map('sim_map.png')
plt.imshow(np.flipud(map.data), cmap='gray') plt.imshow(np.flipud(map.data), cmap='gray')
plt.show() plt.show()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -656,7 +656,7 @@ if __name__ == '__main__':
if path == 'Sim_Track': if path == 'Sim_Track':
# Load map file # Load map file
map = Map(file_path='maps/sim_map.png', origin=[-1, -2], resolution=0.005) map = Map(file_path='sim_map.png', origin=[-1, -2], resolution=0.005)
# Specify waypoints # Specify waypoints
wp_x = [-0.75, -0.25, -0.25, 0.25, 0.25, 1.25, 1.25, 0.75, 0.75, 1.25, wp_x = [-0.75, -0.25, -0.25, 0.25, 0.25, 1.25, 1.25, 0.75, 0.75, 1.25,
@ -687,7 +687,7 @@ if __name__ == '__main__':
elif path == 'Real_Track': elif path == 'Real_Track':
# Load map file # Load map file
map = Map(file_path='maps/real_map.png', origin=(-30.0, -24.0), map = Map(file_path='real_map.png', origin=(-30.0, -24.0),
resolution=0.06) resolution=0.06)
# Specify waypoints # Specify waypoints
@ -727,9 +727,8 @@ if __name__ == '__main__':
print('Invalid path!') print('Invalid path!')
exit(1) exit(1)
ub, lb, border_cells = \ ub, lb, border_cells = reference_path.update_path_constraints(0,
reference_path.update_path_constraints(0, reference_path.n_waypoints, reference_path.n_waypoints, 0.1, 0.01)
0.1, 0.01)
SpeedProfileConstraints = {'a_min': -0.1, 'a_max': 0.5, SpeedProfileConstraints = {'a_min': -0.1, 'a_max': 0.5,
'v_min': 0, 'v_max': 1.0, 'ay_max': 4.0} 'v_min': 0, 'v_max': 1.0, 'ay_max': 4.0}
reference_path.compute_speed_profile(SpeedProfileConstraints) reference_path.compute_speed_profile(SpeedProfileConstraints)

View File

@ -17,8 +17,7 @@ if __name__ == '__main__':
if sim_mode == 'Sim_Track': if sim_mode == 'Sim_Track':
# Load map file # Load map file
map = Map(file_path='maps/sim_map.png', origin=[-1, -2], map = Map(file_path='sim_map.png', origin=[-1, -2], resolution=0.005)
resolution=0.005)
# Specify waypoints # Specify waypoints
wp_x = [-0.75, -0.25, -0.25, 0.25, 0.25, 1.25, 1.25, 0.75, 0.75, 1.25, wp_x = [-0.75, -0.25, -0.25, 0.25, 0.25, 1.25, 1.25, 0.75, 0.75, 1.25,
@ -35,7 +34,7 @@ if __name__ == '__main__':
circular=True) circular=True)
# Add obstacles # Add obstacles
use_obstacles = True use_obstacles = False
if use_obstacles: if use_obstacles:
obs1 = Obstacle(cx=0.0, cy=0.0, radius=0.05) obs1 = Obstacle(cx=0.0, cy=0.0, radius=0.05)
obs2 = Obstacle(cx=-0.8, cy=-0.5, radius=0.08) obs2 = Obstacle(cx=-0.8, cy=-0.5, radius=0.08)
@ -58,7 +57,7 @@ if __name__ == '__main__':
elif sim_mode == 'Real_Track': elif sim_mode == 'Real_Track':
# Load map file # Load map file
map = Map(file_path='maps/real_map.png', origin=(-30.0, -24.0), map = Map(file_path='real_map.png', origin=(-30.0, -24.0),
resolution=0.06) resolution=0.06)
# Specify waypoints # Specify waypoints
@ -133,18 +132,18 @@ if __name__ == '__main__':
# Until arrival at end of path # Until arrival at end of path
while car.s < reference_path.length: while car.s < reference_path.length:
# Get control signals # get control signals
u = mpc.get_control() u = mpc.get_control()
# Simulate car # drive car
car.drive(u) car.drive(u)
# Log car state # log
x_log.append(car.temporal_state.x) x_log.append(car.temporal_state.x)
y_log.append(car.temporal_state.y) y_log.append(car.temporal_state.y)
v_log.append(u[0]) v_log.append(u[0])
# Increment simulation time # Increase simulation time
t += car.Ts t += car.Ts
# Plot path and drivable area # Plot path and drivable area

View File

@ -1,11 +1,13 @@
import numpy as np import numpy as np
from abc import abstractmethod from abc import abstractmethod
try: try:
from abc import ABC from abc import ABC
except: except:
# for Python 2.7 # for Python 2.7
from abc import ABCMeta from abc import ABCMeta
class ABC(object): class ABC(object):
__metaclass__ = ABCMeta __metaclass__ = ABCMeta
pass pass