Skip to content

Commit b9c3db2

Browse files
committed
feat(smart_mpc_trajectory_follower): add smart_mpc_trajectory_follower
1 parent 9f3633d commit b9c3db2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+84286
-38
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Files generated when installing smart_mpc_trajectory_follower
2+
build/
3+
*.egg-info/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(smart_mpc_trajectory_follower)
3+
4+
find_package(autoware_cmake REQUIRED)
5+
autoware_package()
6+
7+
install(PROGRAMS
8+
smart_mpc_trajectory_follower/scripts/pympc_trajectory_follower.py
9+
DESTINATION lib/${PROJECT_NAME}
10+
)
11+
ament_auto_package(
12+
INSTALL_TO_SHARE
13+
)

control/smart_mpc_trajectory_follower/README.md

+331
Large diffs are not rendered by default.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>smart_mpc_trajectory_follower</name>
5+
<version>1.0.0</version>
6+
<description>Nodes to follow a trajectory by generating control commands using smart mpc</description>
7+
8+
<!-- mpc longitudinal controller -->
9+
<maintainer email="masayuki.aino@proxima-ai-tech.com">Masayuki Aino</maintainer>
10+
11+
<license>Apache License 2.0</license>
12+
13+
<author email="masayuki.aino@proxima-ai-tech.com">Masayuki Aino</author>
14+
15+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
16+
<buildtool_depend>ament_cmake_python</buildtool_depend>
17+
<buildtool_depend>autoware_cmake</buildtool_depend>
18+
19+
<depend>autoware_adapi_v1_msgs</depend>
20+
<depend>autoware_auto_control_msgs</depend>
21+
<depend>autoware_auto_planning_msgs</depend>
22+
<depend>autoware_auto_system_msgs</depend>
23+
<depend>autoware_auto_vehicle_msgs</depend>
24+
<depend>motion_utils</depend>
25+
<depend>pybind11_vendor</depend>
26+
<depend>python3-numba</depend>
27+
<depend>python3-scipy</depend>
28+
<depend>rclcpp</depend>
29+
<depend>rclcpp_components</depend>
30+
<depend>tier4_autoware_utils</depend>
31+
32+
<exec_depend>ros2launch</exec_depend>
33+
34+
<test_depend>ament_cmake_ros</test_depend>
35+
<test_depend>ament_index_python</test_depend>
36+
<test_depend>ament_lint_auto</test_depend>
37+
<test_depend>autoware_lint_common</test_depend>
38+
<test_depend>autoware_testing</test_depend>
39+
<test_depend>ros_testing</test_depend>
40+
41+
<export>
42+
<build_type>ament_cmake</build_type>
43+
</export>
44+
</package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import glob
2+
import json
3+
import os
4+
from pathlib import Path
5+
6+
from setuptools import find_packages
7+
from setuptools import setup
8+
9+
os.system("pip3 install numba==0.58.1 --force-reinstall")
10+
os.system("pip3 install GPy")
11+
os.system("pip3 install torch")
12+
package_path = {}
13+
package_path["path"] = str(Path(__file__).parent)
14+
with open("smart_mpc_trajectory_follower/package_path.json", "w") as f:
15+
json.dump(package_path, f)
16+
build_cpp_command = "g++ -Ofast -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) "
17+
build_cpp_command += "smart_mpc_trajectory_follower/scripts/proxima_calc.cpp "
18+
build_cpp_command += (
19+
"-o smart_mpc_trajectory_follower/scripts/proxima_calc$(python3-config --extension-suffix) "
20+
)
21+
build_cpp_command += "-lrt -I/usr/include/eigen3"
22+
os.system(build_cpp_command)
23+
24+
so_path = (
25+
"scripts/"
26+
+ glob.glob("smart_mpc_trajectory_follower/scripts/proxima_calc.*.so")[0].split("/")[-1]
27+
)
28+
setup(
29+
name="smart_mpc_trajectory_follower",
30+
version="1.0.0",
31+
packages=find_packages(),
32+
package_data={
33+
"smart_mpc_trajectory_follower": ["package_path.json", so_path],
34+
},
35+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__pycache__/
2+
*.json

control/smart_mpc_trajectory_follower/smart_mpc_trajectory_follower/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
from pathlib import Path
3+
import shutil
4+
5+
import smart_mpc_trajectory_follower
6+
7+
if __name__ == "__main__":
8+
package_dir = str(Path(smart_mpc_trajectory_follower.__file__).parent)
9+
10+
remove_dirs = [
11+
package_dir + "/__pycache__",
12+
package_dir + "/scripts/__pycache__",
13+
package_dir + "/training_and_data_check/__pycache__",
14+
]
15+
for i in range(len(remove_dirs)):
16+
if os.path.isdir(remove_dirs[i]):
17+
shutil.rmtree(remove_dirs[i])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
mpc_parameter:
2+
system:
3+
mode: ilqr
4+
mpc_setting:
5+
ctrl_time_step: 0.03333
6+
mpc_freq: 3
7+
N: 50
8+
steer_ctrl_queue_size: 50
9+
steer_ctrl_queue_size_core: 15
10+
acc_ctrl_queue_size: 12
11+
nx_0: 6
12+
nu_0: 2
13+
timing_Q_c: [25]
14+
cost_parameters:
15+
Q: [0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
16+
Q_c: [1e+2, 1e+8, 1e+6, 1e+3, 1.0, 1.0, 1.0, 1.0]
17+
Q_f: [1e+2, 1e+8, 1e+2, 1e+8, 1.0, 1.0, 1.0, 1.0]
18+
R: [10.0, 1000.0]
19+
acc_lim_weight: 100.0
20+
steer_lim_weight: 100.0
21+
acc_rate_lim_weight: 10000.0
22+
steer_rate_lim_weight: 10000.0
23+
min_steer_rate_transform_for_start: 0.01
24+
power_steer_rate_transform_for_start: 5
25+
coef_steer_rate_transform_for_start: 3.0
26+
min_loose_lateral_cost: 0.00001
27+
power_loose_lateral_cost: 10
28+
threshold_loose_lateral_cost: 0.2
29+
min_loose_yaw_cost: 0.00001
30+
power_loose_yaw_cost: 1
31+
threshold_loose_yaw_cost: 0.1
32+
ilqr:
33+
ls_step: 0.9
34+
max_iter_ls: 10
35+
max_iter_ilqr: 1
36+
ilqr_tol: 0.01
37+
mppi:
38+
lam: 0.1
39+
Sigma: [1e-15, 0.01]
40+
max_iter_mppi: 1
41+
sample_num: 100
42+
mppi_tol: 0.01
43+
mppi_step: 20
44+
preprocessing:
45+
reference_horizon: 50
46+
cap_pred_error: [0.5, 2.0]
47+
use_sg_for_nominal_inputs: true
48+
sg_deg_for_nominal_inputs: 0
49+
sg_window_size_for_nominal_inputs: 10
50+
to_be_deprecated:
51+
tighten_horizon: 20
52+
min_tighten_steer_rate: 1.0
53+
power_tighten_steer_rate_by_lateral_error: 1
54+
threshold_tighten_steer_rate_by_lateral_error: 0.05
55+
power_tighten_steer_rate_by_yaw_error: 1
56+
threshold_tighten_steer_rate_by_yaw_error: 0.05
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# default parameter is set for sample_vehicle of AWF: https://github.com/autowarefoundation/sample_vehicle_launch/tree/main/sample_vehicle_description
2+
nominal_parameter:
3+
vehicle_info:
4+
wheel_base: 2.79
5+
acceleration:
6+
acc_time_delay: 0.1
7+
acc_time_constant: 0.1
8+
steering:
9+
steer_time_delay: 0.27
10+
steer_time_constant: 0.24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
trained_model_parameter:
2+
control_application:
3+
use_trained_model: false
4+
update_trained_model: false
5+
max_train_data_size: 10000
6+
error_decay: [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
7+
use_trained_model_diff: true
8+
use_sg_for_trained_model_diff: true
9+
sg_deg_for_trained_model_diff: 0
10+
sg_window_size_for_trained_model_diff: 25
11+
use_sg_for_noise: true
12+
sg_deg_for_noise: 0
13+
sg_window_size_for_noise: 15
14+
use_x_noise: false
15+
use_y_noise: false
16+
use_v_noise: false
17+
use_theta_noise: false
18+
use_acc_noise: false
19+
use_steer_noise: false
20+
smoothing:
21+
acc_sigma_for_learning: 5.0
22+
steer_sigma_for_learning: 5.0
23+
acc_des_sigma_for_learning: 5.0
24+
steer_des_sigma_for_learning: 5.0
25+
x_out_sigma_for_learning: 30.0
26+
y_out_sigma_for_learning: 30.0
27+
v_out_sigma_for_learning: 30.0
28+
theta_out_sigma_for_learning: 10.0
29+
acc_out_sigma_for_learning: 5.0
30+
steer_out_sigma_for_learning: 5.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# workspace specific settings
7+
train_drive_*.png
8+
test_feedforward_*/
9+
test_pure_pursuit_*/
10+
test_python_*/
11+
python_sim_log_*/
12+
sim_setting.json
13+
auto_test_result_*.csv
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
default, 0.00, 1.39, 2.78, 4.17, 5.56, 6.94, 8.33, 9.72, 11.11, 12.50, 13.89, 15.28, 16.67
2+
-4.0, -4.40, -4.36, -4.38, -4.12, -4.20, -3.94, -3.98, -3.80, -3.77, -3.76, -3.59, -3.50, -3.40
3+
-3.5, -4.00, -3.91, -3.85, -3.64, -3.68, -3.55, -3.42, -3.24, -3.25, -3.00, -3.04, -2.93, -2.80
4+
-3.0, -3.40, -3.37, -3.33, -3.00, -3.00, -2.90, -2.88, -2.65, -2.43, -2.44, -2.43, -2.39, -2.30
5+
-2.5, -2.80, -2.72, -2.72, -2.62, -2.41, -2.43, -2.26, -2.18, -2.11, -2.03, -1.96, -1.91, -1.85
6+
-2.0, -2.30, -2.24, -2.12, -2.02, -1.92, -1.81, -1.67, -1.58, -1.51, -1.49, -1.40, -1.35, -1.30
7+
-1.5, -1.70, -1.61, -1.47, -1.46, -1.40, -1.37, -1.29, -1.24, -1.10, -0.99, -0.83, -0.80, -0.78
8+
-1.0, -1.30, -1.28, -1.10, -1.09, -1.04, -1.02, -0.98, -0.89, -0.82, -0.61, -0.52, -0.54, -0.56
9+
-0.8, -0.96, -0.90, -0.82, -0.74, -0.70, -0.65, -0.63, -0.59, -0.55, -0.44, -0.39, -0.39, -0.35
10+
-0.6, -0.77, -0.71, -0.67, -0.65, -0.58, -0.52, -0.51, -0.50, -0.40, -0.33, -0.30, -0.31, -0.30
11+
-0.4, -0.45, -0.40, -0.45, -0.44, -0.38, -0.35, -0.31, -0.30, -0.26, -0.30, -0.29, -0.31, -0.25
12+
-0.2, -0.24, -0.24, -0.25, -0.22, -0.23, -0.25, -0.27, -0.29, -0.24, -0.22, -0.17, -0.18, -0.12
13+
0.0, 0.00, 0.00, -0.05, -0.05, -0.05, -0.05, -0.08, -0.08, -0.08, -0.08, -0.10, -0.10, -0.10
14+
0.2, 0.16, 0.12, 0.02, 0.02, 0.00, 0.00, -0.05, -0.05, -0.05, -0.05, -0.08, -0.08, -0.08
15+
0.4, 0.38, 0.30, 0.22, 0.25, 0.24, 0.23, 0.20, 0.16, 0.16, 0.14, 0.10, 0.05, 0.05
16+
0.6, 0.52, 0.52, 0.51, 0.49, 0.43, 0.40, 0.35, 0.33, 0.33, 0.33, 0.32, 0.34, 0.34
17+
0.8, 0.82, 0.81, 0.78, 0.68, 0.63, 0.56, 0.53, 0.48, 0.43, 0.41, 0.37, 0.38, 0.40
18+
1.0, 1.00, 1.08, 1.01, 0.88, 0.76, 0.69, 0.66, 0.58, 0.54, 0.49, 0.45, 0.40, 0.40
19+
1.5, 1.52, 1.50, 1.38, 1.26, 1.14, 1.03, 0.91, 0.82, 0.67, 0.61, 0.51, 0.41, 0.41
20+
2.0, 1.80, 1.80, 1.64, 1.43, 1.25, 1.11, 0.96, 0.81, 0.70, 0.59, 0.51, 0.42, 0.42

0 commit comments

Comments
 (0)