Skip to content

Commit 634197c

Browse files
Merge branch 'main' into test/add_unit_test_to_ndt_scan_matcher
2 parents a9cdf6e + 1ca97cf commit 634197c

File tree

33 files changed

+445
-1474
lines changed

33 files changed

+445
-1474
lines changed

.github/workflows/build-and-test-differential.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,40 @@ jobs:
7474

7575
- name: Show disk space after the tasks
7676
run: df -h
77+
78+
clang-tidy-differential:
79+
runs-on: ubuntu-latest
80+
container: ghcr.io/autowarefoundation/autoware-openadk:latest-prebuilt-cuda
81+
steps:
82+
- name: Check out repository
83+
uses: actions/checkout@v3
84+
with:
85+
fetch-depth: 0
86+
87+
- name: Show disk space before the tasks
88+
run: df -h
89+
90+
- name: Remove exec_depend
91+
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
92+
93+
- name: Get modified packages
94+
id: get-modified-packages
95+
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
96+
97+
- name: Get modified files
98+
id: get-modified-files
99+
uses: tj-actions/changed-files@v35
100+
with:
101+
files: |
102+
**/*.cpp
103+
**/*.hpp
104+
105+
- name: Run clang-tidy
106+
if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }}
107+
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
108+
with:
109+
rosdistro: humble
110+
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
111+
target-files: ${{ steps.get-modified-files.outputs.all_changed_files }}
112+
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
113+
build-depends-repos: build_depends.repos

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
#include <autoware_internal_msgs/msg/published_time.hpp>
2121
#include <std_msgs/msg/header.hpp>
2222

23+
#include <cstring>
2324
#include <functional>
2425
#include <map>
2526
#include <string>
27+
#include <utility>
2628

2729
namespace tier4_autoware_utils
2830
{
@@ -31,9 +33,9 @@ class PublishedTimePublisher
3133
{
3234
public:
3335
explicit PublishedTimePublisher(
34-
rclcpp::Node * node, const std::string & publisher_topic_suffix = "/debug/published_time",
36+
rclcpp::Node * node, std::string publisher_topic_suffix = "/debug/published_time",
3537
const rclcpp::QoS & qos = rclcpp::QoS(1))
36-
: node_(node), publisher_topic_suffix_(publisher_topic_suffix), qos_(qos)
38+
: node_(node), publisher_topic_suffix_(std::move(publisher_topic_suffix)), qos_(qos)
3739
{
3840
}
3941

@@ -45,16 +47,16 @@ class PublishedTimePublisher
4547
// if the publisher is not in the map, create a new publisher for published time
4648
ensure_publisher_exists(gid_key, publisher->get_topic_name());
4749

48-
const auto & pub_published_time_ = publishers_[gid_key];
50+
const auto & pub_published_time = publishers_[gid_key];
4951

5052
// Check if there are any subscribers, otherwise don't do anything
51-
if (pub_published_time_->get_subscription_count() > 0) {
53+
if (pub_published_time->get_subscription_count() > 0) {
5254
PublishedTime published_time;
5355

5456
published_time.header.stamp = stamp;
5557
published_time.published_stamp = rclcpp::Clock().now();
5658

57-
pub_published_time_->publish(published_time);
59+
pub_published_time->publish(published_time);
5860
}
5961
}
6062

@@ -66,16 +68,16 @@ class PublishedTimePublisher
6668
// if the publisher is not in the map, create a new publisher for published time
6769
ensure_publisher_exists(gid_key, publisher->get_topic_name());
6870

69-
const auto & pub_published_time_ = publishers_[gid_key];
71+
const auto & pub_published_time = publishers_[gid_key];
7072

7173
// Check if there are any subscribers, otherwise don't do anything
72-
if (pub_published_time_->get_subscription_count() > 0) {
74+
if (pub_published_time->get_subscription_count() > 0) {
7375
PublishedTime published_time;
7476

7577
published_time.header = header;
7678
published_time.published_stamp = rclcpp::Clock().now();
7779

78-
pub_published_time_->publish(published_time);
80+
pub_published_time->publish(published_time);
7981
}
8082
}
8183

control/mpc_lateral_controller/param/lateral_controller_defaults.param.yaml

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
/**:
22
ros__parameters:
33
# -- system --
4-
traj_resample_dist: 0.1 # path resampling interval [m]
5-
use_steer_prediction: false # flag for using steer prediction (do not use steer measurement)
6-
admissible_position_error: 5.0 # stop mpc calculation when error is larger than the following value
7-
admissible_yaw_error_rad: 1.57 # stop mpc calculation when error is larger than the following value
4+
traj_resample_dist: 0.1 # path resampling interval [m]
5+
use_steer_prediction: false # flag for using steer prediction (do not use steer measurement)
6+
admissible_position_error: 5.0 # stop mpc calculation when error is larger than the following value
7+
admissible_yaw_error_rad: 1.57 # stop mpc calculation when error is larger than the following value
88

99
# -- path smoothing --
10-
enable_path_smoothing: false # flag for path smoothing
10+
enable_path_smoothing: false # flag for path smoothing
1111
path_filter_moving_ave_num: 25 # param of moving average filter for path smoothing
12-
curvature_smoothing_num_traj: 15 # point-to-point index distance used in curvature calculation (for trajectory): curvature is calculated from three points p(i-num), p(i), p(i+num)
13-
curvature_smoothing_num_ref_steer: 15 # point-to-point index distance used in curvature calculation (for steer command reference): curvature is calculated from three points p(i-num), p(i), p(i+num)
12+
curvature_smoothing_num_traj: 15 # point-to-point index distance used in curvature calculation (for trajectory): curvature is calculated from three points p(i-num), p(i), p(i+num)
13+
curvature_smoothing_num_ref_steer: 15 # point-to-point index distance used in curvature calculation (for steer command reference): curvature is calculated from three points p(i-num), p(i), p(i+num)
1414

1515
# -- trajectory extending --
16-
extend_trajectory_for_end_yaw_control: true # flag of trajectory extending for terminal yaw control
16+
extend_trajectory_for_end_yaw_control: false # flag of trajectory extending for terminal yaw control
1717

1818
# -- mpc optimization --
19-
qp_solver_type: "osqp" # optimization solver option (unconstraint_fast or osqp)
20-
mpc_prediction_horizon: 50 # prediction horizon step
21-
mpc_prediction_dt: 0.1 # prediction horizon period [s]
22-
mpc_weight_lat_error: 0.1 # lateral error weight in matrix Q
23-
mpc_weight_heading_error: 0.0 # heading error weight in matrix Q
24-
mpc_weight_heading_error_squared_vel: 0.3 # heading error * velocity weight in matrix Q
25-
mpc_weight_steering_input: 1.0 # steering error weight in matrix R
26-
mpc_weight_steering_input_squared_vel: 0.25 # steering error * velocity weight in matrix R
27-
mpc_weight_lat_jerk: 0.0 # lateral jerk weight in matrix R
28-
mpc_weight_steer_rate: 0.0 # steering rate weight in matrix R
29-
mpc_weight_steer_acc: 0.000001 # steering angular acceleration weight in matrix R
30-
mpc_low_curvature_weight_lat_error: 0.1 # lateral error weight in matrix Q in low curvature point
31-
mpc_low_curvature_weight_heading_error: 0.0 # heading error weight in matrix Q in low curvature point
32-
mpc_low_curvature_weight_heading_error_squared_vel: 0.3 # heading error * velocity weight in matrix Q in low curvature point
33-
mpc_low_curvature_weight_steering_input: 1.0 # steering error weight in matrix R in low curvature point
34-
mpc_low_curvature_weight_steering_input_squared_vel: 0.25 # steering error * velocity weight in matrix R in low curvature point
35-
mpc_low_curvature_weight_lat_jerk: 0.0 # lateral jerk weight in matrix R in low curvature point
36-
mpc_low_curvature_weight_steer_rate: 0.0 # steering rate weight in matrix R in low curvature point
37-
mpc_low_curvature_weight_steer_acc: 0.000001 # steering angular acceleration weight in matrix R in low curvature point
38-
mpc_low_curvature_thresh_curvature: 0.0 # threshold of curvature to use "low_curvature" parameter (recommend: 0.01~0.03)
39-
mpc_weight_terminal_lat_error: 1.0 # terminal lateral error weight in matrix Q to improve mpc stability
40-
mpc_weight_terminal_heading_error: 0.1 # terminal heading error weight in matrix Q to improve mpc stability
41-
mpc_zero_ff_steer_deg: 0.5 # threshold that feed-forward angle becomes zero
42-
mpc_acceleration_limit: 2.0 # limit on the vehicle's acceleration
43-
mpc_velocity_time_constant: 0.3 # time constant used for velocity smoothing
44-
mpc_min_prediction_length: 5.0 # minimum prediction length
19+
qp_solver_type: "osqp" # optimization solver option (unconstraint_fast or osqp)
20+
mpc_prediction_horizon: 50 # prediction horizon step
21+
mpc_prediction_dt: 0.1 # prediction horizon period [s]
22+
mpc_weight_lat_error: 1.0 # lateral error weight in matrix Q
23+
mpc_weight_heading_error: 0.0 # heading error weight in matrix Q
24+
mpc_weight_heading_error_squared_vel: 0.3 # heading error * velocity weight in matrix Q
25+
mpc_weight_steering_input: 1.0 # steering error weight in matrix R
26+
mpc_weight_steering_input_squared_vel: 0.25 # steering error * velocity weight in matrix R
27+
mpc_weight_lat_jerk: 0.1 # lateral jerk weight in matrix R
28+
mpc_weight_steer_rate: 0.0 # steering rate weight in matrix R
29+
mpc_weight_steer_acc: 0.000001 # steering angular acceleration weight in matrix R
30+
mpc_low_curvature_weight_lat_error: 0.1 # lateral error weight in matrix Q in low curvature point
31+
mpc_low_curvature_weight_heading_error: 0.0 # heading error weight in matrix Q in low curvature point
32+
mpc_low_curvature_weight_heading_error_squared_vel: 0.3 # heading error * velocity weight in matrix Q in low curvature point
33+
mpc_low_curvature_weight_steering_input: 1.0 # steering error weight in matrix R in low curvature point
34+
mpc_low_curvature_weight_steering_input_squared_vel: 0.25 # steering error * velocity weight in matrix R in low curvature point
35+
mpc_low_curvature_weight_lat_jerk: 0.0 # lateral jerk weight in matrix R in low curvature point
36+
mpc_low_curvature_weight_steer_rate: 0.0 # steering rate weight in matrix R in low curvature point
37+
mpc_low_curvature_weight_steer_acc: 0.000001 # steering angular acceleration weight in matrix R in low curvature point
38+
mpc_low_curvature_thresh_curvature: 0.0 # threshold of curvature to use "low_curvature" parameter (recommend: 0.01~0.03)
39+
mpc_weight_terminal_lat_error: 1.0 # terminal lateral error weight in matrix Q to improve mpc stability
40+
mpc_weight_terminal_heading_error: 0.1 # terminal heading error weight in matrix Q to improve mpc stability
41+
mpc_zero_ff_steer_deg: 0.5 # threshold that feed-forward angle becomes zero
42+
mpc_acceleration_limit: 2.0 # limit on the vehicle's acceleration
43+
mpc_velocity_time_constant: 0.3 # time constant used for velocity smoothing
44+
mpc_min_prediction_length: 5.0 # minimum prediction length
4545

4646
# -- vehicle model --
4747
vehicle_model_type: "kinematics" # vehicle model type for mpc prediction. option is kinematics, kinematics_no_delay, and dynamics
48-
input_delay: 0.24 # steering input delay time for delay compensation
49-
vehicle_model_steer_tau: 0.3 # steering dynamics time constant (1d approximation) [s]
50-
steer_rate_lim_dps_list_by_curvature: [10.0, 20.0, 30.0] # steering angle rate limit list depending on curvature [deg/s]
48+
input_delay: 0.24 # steering input delay time for delay compensation
49+
vehicle_model_steer_tau: 0.3 # steering dynamics time constant (1d approximation) [s]
50+
steer_rate_lim_dps_list_by_curvature: [40.0, 50.0, 60.0] # steering angle rate limit list depending on curvature [deg/s]
5151
curvature_list_for_steer_rate_lim: [0.001, 0.002, 0.01] # curvature list for steering angle rate limit interpolation in ascending order [/m]
52-
steer_rate_lim_dps_list_by_velocity: [40.0, 30.0, 20.0] # steering angle rate limit list depending on velocity [deg/s]
52+
steer_rate_lim_dps_list_by_velocity: [60.0, 50.0, 40.0] # steering angle rate limit list depending on velocity [deg/s]
5353
velocity_list_for_steer_rate_lim: [10.0, 15.0, 20.0] # velocity list for steering angle rate limit interpolation in ascending order [m/s]
54-
acceleration_limit: 2.0 # acceleration limit for trajectory velocity modification [m/ss]
55-
velocity_time_constant: 0.3 # velocity dynamics time constant for trajectory velocity modification [s]
54+
acceleration_limit: 2.0 # acceleration limit for trajectory velocity modification [m/ss]
55+
velocity_time_constant: 0.3 # velocity dynamics time constant for trajectory velocity modification [s]
5656

5757
# -- lowpass filter for noise reduction --
5858
steering_lpf_cutoff_hz: 3.0 # cutoff frequency of lowpass filter for steering command [Hz]
@@ -65,7 +65,7 @@
6565
keep_steer_control_until_converged: true
6666
new_traj_duration_time: 1.0
6767
new_traj_end_dist: 0.3
68-
mpc_converged_threshold_rps: 0.01 # threshold of mpc convergence check [rad/s]
68+
mpc_converged_threshold_rps: 0.01 # threshold of mpc convergence check [rad/s]
6969

7070
# steer offset
7171
steering_offset:

control/pid_longitudinal_controller/param/longitudinal_controller_defaults.param.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
enable_smooth_stop: true
66
enable_overshoot_emergency: true
77
enable_large_tracking_error_emergency: true
8-
enable_slope_compensation: false
8+
enable_slope_compensation: true
99
enable_keep_stopped_until_steer_convergence: true
1010

1111
# state transition
1212
drive_state_stop_dist: 0.5
1313
drive_state_offset_stop_dist: 1.0
14-
stopping_state_stop_dist: 0.49
14+
stopping_state_stop_dist: 0.5
1515
stopped_state_entry_duration_time: 0.1
16-
stopped_state_entry_vel: 0.1
16+
stopped_state_entry_vel: 0.01
1717
stopped_state_entry_acc: 0.1
1818
emergency_state_overshoot_stop_dist: 1.5
1919
emergency_state_traj_trans_dev: 3.0
20-
emergency_state_traj_rot_dev: 0.7
20+
emergency_state_traj_rot_dev: 0.7854
2121

2222
# drive state
2323
kp: 1.0
@@ -40,7 +40,7 @@
4040

4141
# smooth stop state
4242
smooth_stop_max_strong_acc: -0.5
43-
smooth_stop_min_strong_acc: -1.0
43+
smooth_stop_min_strong_acc: -0.8
4444
smooth_stop_weak_acc: -0.3
4545
smooth_stop_weak_stop_acc: -0.8
4646
smooth_stop_strong_stop_acc: -3.4

control/trajectory_follower_node/test/test_controller_node.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ rclcpp::NodeOptions makeNodeOptions(const bool enable_keep_stopped_until_steer_c
5656
const auto lateral_share_dir =
5757
ament_index_cpp::get_package_share_directory("mpc_lateral_controller");
5858
rclcpp::NodeOptions node_options;
59-
node_options.append_parameter_override("ctrl_period", 0.03);
60-
node_options.append_parameter_override("timeout_thr_sec", 0.5);
6159
node_options.append_parameter_override("lateral_controller_mode", "mpc");
6260
node_options.append_parameter_override("longitudinal_controller_mode", "pid");
6361
node_options.append_parameter_override(
@@ -254,8 +252,10 @@ TEST_F(FakeNodeFixture, straight_trajectory)
254252

255253
test_utils::waitForMessage(tester.node, this, tester.received_control_command);
256254
ASSERT_TRUE(tester.received_control_command);
255+
// following conditions will pass even if the MPC solution does not converge
257256
EXPECT_EQ(tester.cmd_msg->lateral.steering_tire_angle, 0.0f);
258257
EXPECT_EQ(tester.cmd_msg->lateral.steering_tire_rotation_rate, 0.0f);
258+
EXPECT_GT(tester.cmd_msg->longitudinal.speed, 0.0f);
259259
EXPECT_GT(rclcpp::Time(tester.cmd_msg->stamp), rclcpp::Time(traj_msg.header.stamp));
260260
}
261261

0 commit comments

Comments
 (0)