Skip to content

Commit cf4076c

Browse files
authored
Merge pull request #3 from KariControl/feat_gain_scheduled
Feat gain scheduled
2 parents eb69de0 + 2351079 commit cf4076c

Some content is hidden

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

54 files changed

+8364
-410
lines changed

Readme.md

Lines changed: 198 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,203 @@
1-
動作確認環境:
2-
OS:ubuntu 22.04
3-
、ROS version: ROS2 humble
1+
# Pracitical Path Following Control
42

5-
このqiitaの記事で書いたものをROS2 humbleで実装してみました:
6-
※ ヨーレート制御の部分だけ少しだけシンプルにしています。
7-
https://qiita.com/KariControl/items/78862ae6b45fcfe91126
83

9-
デモ版のソフトでは
104

11-
source run_path_following.sh
125

13-
を実行すると,下記のように一定曲率の目標パスに対して軌道追従する制御シミュレーンが実行されます。デモ版ソフトのため、目標パス計算もpath following controlのノード内で実行しています。
14-
![image](https://github.com/user-attachments/assets/990da0b5-a167-4a28-b64e-37fd6dce813a)
156

7+
8+
https://github.com/user-attachments/assets/3c09d58a-7c07-4a6a-a513-a9c25786458e
9+
10+
11+
12+
13+
14+
# What is Practical Path Following Control ?
15+
This package is a path-following control package developed under the NEDO ITS energy project [1]. It achieves high-accuracy trajectory tracking for automated driving. The system consists of a path-following controller that computes the target yaw rate based on lateral error and heading error, and a yaw-rate controller that drives the actual yaw rate to follow the target. By employing gain-scheduled control based on vehicle speed, the desired control performance is achieved across the entire speed range.
16+
17+
In addition, the package performs self-diagnostics within each control module. Each node detects conditions such as communication delays, lane departure, and wrong-way driving, and outputs warnings and errors externally. By leveraging this diagnostic information, users will be able to build highly reliable automated-driving modules on their own.
18+
19+
<img width="849" height="688" alt="image" src="https://github.com/user-attachments/assets/87611efa-20a5-41ba-bec6-90ec68f8229f" />
20+
21+
# Block diagram
22+
23+
<img width="2023" height="773" alt="image" src="https://github.com/user-attachments/assets/83d0edad-ee25-44a8-9ee7-f01b4d016727" />
24+
25+
# Version
26+
Primary modules: `path_following`, `yawrate_controller`
27+
Others: demo utilities (simulation, static planning, visualization)
28+
Tested environment: Ubuntu 22.04 + ROS 2 Humble
29+
Legacy release: `v0.1.0`
30+
31+
## Quick start (scripts)
32+
33+
Build from the repository root:
34+
bash build_setup.sh
35+
36+
Run the end-to-end demo pipeline:
37+
bash run_path_following.sh
38+
39+
Notes:
40+
- `build_setup.sh` sources ROS Humble, wipes `install/ build/ log/`, and builds with `-DCMAKE_BUILD_TYPE=Release`.
41+
- `run_path_following.sh` opens multiple terminals via `gnome-terminal` and launches: simulator → yaw-rate controller → path-following → RViz visualizer → static CSV path publisher.
42+
- Edit `run_path_following.sh` and set `path_file:=/ABS/PATH/to/trajectory.csv` to an **absolute** CSV path on your machine.
43+
- If you do not have `gnome-terminal`, either install it or run each launch command manually (see “Manual launches”).
44+
45+
46+
# Control method
47+
Each algorithm implements the methods described in the cited references; please consult the respective publications for details.
48+
49+
**Path following control method**
50+
The PATH FOLLOWING control provides both fixed-gain and gain-scheduled options, and the control mode can be switched via YAML.
51+
52+
- Yoshida, J., Sugimachi, T., Fukao (2011). Autonomous driving of a truck based on path following control. Nippon Kikai Gakkai Ronbunshu, C Hen/Transactions of the Japan Society of Mechanical Engineers, Part C .
53+
54+
**Yaw-rate control method**
55+
The yaw-rate control offers: (1) two-degree-of-freedom control using a KINEMATIC VEHICLE MODEL, (2) two-degree-of-freedom control using a DYNAMICS MODEL, and (3) gain-scheduled PI control. These modes can also be selected via YAML.
56+
57+
- KINEMATIC VEHICLE MODEL (in Japanese)
58+
Uetsuki, Y., Atsumi, T., Kurashiki, K., Sugawara, H., Oba, Y., Maeda, G., ... & Fukao, T. (2021). Automatic Steering Control of an Unmanned Transport Truck in Off-road Environments. Transactions of Society of Automotive Engineers of Japan, 52(5).
59+
60+
- DYNAMICS MODEL (in Japanese):
61+
Suzuki, M. (2022). Time Varying Feedforward Control and Data-Driven Control for Autonomous Driving Vehicle. IEEJ Transactions on Electronics, Information and Systems, 142(12), 1313-1320.
62+
63+
- gain-scheduled PI
64+
Yahagi, S., & Suzuki, M. (2023). Controller parameter tuning for gain‐scheduled vehicle yaw‐rate control: Virtual reference feedback tuning approach. Electronics Letters, 59(6), e12764.
65+
66+
Note (dynamics mode): Due to the equivalent bicycle model’s characteristics, low-speed instability can occur; consider switching to kinematic or gain-scheduled mode at low speeds and apply appropriate steering/curvature limits.
67+
68+
69+
# Diagnostics
70+
As part of the diagnostics, the path-following controller detects lane departure, heading anomalies, communication delays on each signal, and timestamp-synchronization faults. The yaw-rate controller detects excessive yaw-rate error, communication delays on each signal, and timestamp-synchronization faults.
71+
72+
**path_following**
73+
74+
Diagnostic output topic:
75+
- /geoauto/control/diag (diagnostic_msgs/DiagnosticArray)
76+
77+
Warnings/Errors:
78+
- Lane departure — WARN/ERROR
79+
80+
- Wrong direction — WARN/ERROR
81+
82+
- Time sync delay (target vs odometry) — WARN/ERROR
83+
84+
- Odometry time delay (now vs odometry) — WARN/ERROR
85+
86+
- Target time delay (now vs target) — WARN/ERROR
87+
88+
**yawrate_controller**
89+
90+
Diagnostic output topic:
91+
- /geoauto/control/diag_yaw (diagnostic_msgs/DiagnosticArray)
92+
93+
Warnings/Errors:
94+
- Large yawrate error — WARN/ERROR
95+
96+
- Time sync delay (reference vs odometry) — WARN/ERROR
97+
98+
- Yawrate delay (now vs odometry) — WARN/ERROR
99+
100+
- Reference delay (now vs reference) — WARN/ERROR
101+
102+
# Package
103+
104+
## Repository layout
105+
106+
- `build_setup.sh` — build helper
107+
- `run_path_following.sh` — multi-terminal demo launcher
108+
- `src/config/trajectory_info.csv` — sample CSV for target trajectory
109+
- `src/geoauto_msgs/` — custom messages
110+
- `src/path_following/` — primary: path-following controller
111+
- `src/yawrate_controller/` — primary: yaw-rate (steering) controller (launch: `launch/control_run.py`, params: `param/param.yaml`)
112+
- `src/demo_static_planning/` — demo: CSV path loader → target publisher (launch: `launch/static_run.py`)
113+
- `src/demo_vehicle_path_viz/` — demo: RViz visualization (launch: `launch/viz_run.py`, default config: `config/vehicle_path_viz.rviz`)
114+
- `src/demo_bicycle_magic_formula_sim/` — demo: vehicle dynamics simulator (launch: `launch/control_run.py`, params: `param/param.yaml`)
115+
116+
**Important:** For any CSV inputs and RViz config files, use **absolute paths**. Relative paths may fail. Demo launch defaults also point to absolute example paths—replace them accordingly.
117+
118+
---
119+
120+
## Interfaces
121+
122+
### Topics (as wired in code/launch)
123+
124+
**Path following (`path_following`)**
125+
- Subscribe: `geoauto/localization/odometry` (`nav_msgs/Odometry`)
126+
- Subscribe: `geoauto/planning/odom_pose` (`geoauto_msgs/OdomTargetPos`)
127+
- Publish: `geoauto/control/target_yawrate` (`geometry_msgs/TwistStamped`)
128+
- Publish: `geoauto/control/diag` (`diagnostic_msgs/DiagnosticArray`)
129+
130+
**Yaw-rate controller (`yawrate_controller`)**
131+
- Subscribe: `/geoauto/localization/odometry` (`nav_msgs/Odometry`)
132+
- Subscribe: `/geoauto/control/target_yawrate` (`geometry_msgs/TwistStamped`)
133+
- Publish: `geoauto/control/steering` (`ackermann_msgs/AckermannDriveStamped`)
134+
- Publish: `geoauto/control/diag_yaw` (`diagnostic_msgs/DiagnosticArray`)
135+
136+
**demo_static_planning** (`src/demo_static_planning/launch/static_run.py` → node params)
137+
(demo: `demo_static_planning`)**
138+
- Publish: `/geoauto/planning/trajectory` (`geoauto_msgs/OdomTargetPos`)
139+
- Publish: `/geoauto/planning/velocity` (`geometry_msgs/TwistStamped`)
140+
141+
**demo_vehicle_path_viz (demo: `demo_vehicle_path_viz`)**
142+
- Subscribe: `/geoauto/localization/odometry` (`nav_msgs/Odometry`)
143+
144+
**demo_bicycle_magic_formula_sim (demo: `demo_bicycle_magic_formula_sim`)**
145+
- Subscribe: `/geoauto/control/steering`
146+
- Publish: `/geoauto/localization/odometry`
147+
148+
---
149+
150+
## Parameters (selected)
151+
152+
**Path following** (`src/path_following/param/param.yaml`)
153+
- Fixed gain and timing: `k2`, `k3`, `time_period`, `target_velocity`, `wheel_base`
154+
- Gain scheduling: `use_gainscheduler`, `speed_bp`, `K2_tab`, `K3_tab`
155+
- Saturation: `max_yawrate`
156+
- Diagnostics thresholds: `lateral_error_warn_th`, `lateral_error_error_th`, `heading_error_warn_th`, `heading_error_error_th`, `timestamp_error_warn_th`, `timestamp_error_error_th`, `odom_time_warn_valid_th`, `odom_time_error_valid_th`, `pathinfo_time_warn_valid_th`, `pathinfo_time_error_valid_th`
157+
158+
**Yaw-rate controller** (`src/yawrate_controller/param/param.yaml`)
159+
- Mode: `controller_mode` (`0 = kinematic`, `1 = dynamic`, `2 = gain-scheduled PI`)
160+
- PI and timing: `kp`, `ki`, `dt`, `time_period`, `wheelbase`, `time_constant`
161+
- Limits: `max_steering`, `max_steering_velocity`
162+
- Gain scheduling (vs speed): `wP` (`c0,c1,c2`), `wI` (`c0,c1,c2`)
163+
- Diagnostics thresholds: `yawrate_error_warn_th`, `yawrate_error_error_th`, `timestamp_error_warn_th`, `timestamp_error_error_th`, `yawrate_delay_warn_th`, `yawrate_delay_error_th`, `reference_delay_warn_th`, `reference_delay_error_th`
164+
165+
**demo_bicycle_magic_formula_sim** (`src/demo_bicycle_magic_formula_sim/param/param.yaml`)
166+
- Frames: `frame_id`, `child_frame_id`
167+
- Topics: `cmd_topic`, `odom_topic`
168+
- Vehicle/tire: `mass`, `Iz`, `lf`, `lr`, Magic-Formula params (`mu_f`, `mu_r`, `Bf`, `Cf`, `Ef`, `Br`, `Cr`, `Er`)
169+
- Longitudinal: `tau_v`, `a_max`, `a_min`, `drag_coeff`, etc.
170+
- Limits/initial state: `steer_max`, `cmd_timeout`, `vx_eps`, `x0`, `y0`, `yaw0`, `vx0`, `vy0`, `r0`
171+
172+
**demo_vehicle_path_viz** (`src/demo_vehicle_path_viz/launch/viz_run.py` → node params)
173+
- `csv_path` (absolute path required), `odom_topic`, `frame_id`, `theta_in_degrees`, appearance and history parameters
174+
- RViz config: launch arg `rviz_cfg` (absolute path if overriding; default provided in the package: `config/vehicle_path_viz.rviz`).
175+
176+
**demo_static_planning** (`src/demo_static_planning/launch/static_run.py` → node params)
177+
- `path_file` (absolute path required), `theta_in_degrees`, `frame_id`, `child_frame_id`
178+
- Default CSV path in launch: `/home/motoya/control_ws/ROS2_Path_following_control/src/config/trajectory_info.csv`
179+
180+
---
181+
182+
## CSV format
183+
184+
Expected columns: `x, y, theta, curvature, target_velocity`
185+
`theta` can be degrees or radians (controlled by the `theta_in_degrees` parameter).
186+
Always pass CSV file paths as **absolute** paths.
187+
188+
---
189+
190+
## Versioning
191+
192+
Legacy: `v0.1.0` (old)
193+
Current: this repository (Ubuntu 22.04 / ROS 2 Humble)
194+
195+
---
196+
197+
## License
198+
199+
See each `package.xml`. Apply a top-level license file if desired.
200+
201+
# Reference
202+
203+
- [1] - ITS Energy report, 2013: https://www.nedo.go.jp/content/100095912.pdf

build_setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source /opt/ros/humble/setup.bash
2+
rm -r install/ build/ log/
3+
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
4+
#colcon build --symlink-install

0 commit comments

Comments
 (0)