Skip to content

Commit

Permalink
feat: lateral controller param (autowarefoundation#191)
Browse files Browse the repository at this point in the history
* feat: define lat_controller_param_path

* feat: change for trajectory_follower params

* add args for lat_controller_param_path
  • Loading branch information
h-ohta authored Feb 8, 2022
1 parent e5625b6 commit 3114c8a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 72 deletions.
1 change: 1 addition & 0 deletions autoware_launch/launch/autoware.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<include file="$(find-pkg-share control_launch)/launch/control.launch.py">
<!-- options for lateral_controller_mode: mpc_follower, pure_pursuit -->
<arg name="lateral_controller_mode" value="mpc_follower" />
<arg name="lat_controller_param_path" value="$(find-pkg-share control_launch)/config/trajectory_follower/$(var lateral_controller_mode).param.yaml"/>>
</include>

<!-- Autoware API -->
Expand Down
1 change: 1 addition & 0 deletions autoware_launch/launch/logging_simulator.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<include file="$(find-pkg-share control_launch)/launch/control.launch.py" if="$(var control)">
<!-- options for lateral_controller_mode: mpc_follower, pure_pursuit -->
<arg name="lateral_controller_mode" value="mpc_follower" />
<arg name="lat_controller_param_path" value="$(find-pkg-share control_launch)/config/trajectory_follower/$(var lateral_controller_mode).param.yaml"/>>
</include>
</group>

Expand Down
1 change: 1 addition & 0 deletions autoware_launch/launch/planning_simulator.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<include file="$(find-pkg-share control_launch)/launch/control.launch.py">
<!-- options for lateral_controller_mode: mpc_follower, pure_pursuit -->
<arg name="lateral_controller_mode" value="mpc_follower" />
<arg name="lat_controller_param_path" value="$(find-pkg-share control_launch)/config/trajectory_follower/$(var lateral_controller_mode).param.yaml"/>>
</include>

<!-- Autoware API -->
Expand Down
57 changes: 0 additions & 57 deletions control_launch/config/mpc_follower/mpc_follower.param.yaml

This file was deleted.

26 changes: 11 additions & 15 deletions control_launch/launch/control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,9 @@


def launch_setup(context, *args, **kwargs):
lateral_controller_mode = LaunchConfiguration("lateral_controller_mode").perform(context)
if lateral_controller_mode == "mpc_follower":
lat_controller_param_path = (
FindPackageShare("control_launch").perform(context)
+ "/config/trajectory_follower/lateral_controller.param.yaml"
)
with open(lat_controller_param_path, "r") as f:
lat_controller_param = yaml.safe_load(f)["/**"]["ros__parameters"]
elif lateral_controller_mode == "pure_pursuit":
lat_controller_param_path = (
FindPackageShare("control_launch").perform(context)
+ "/config/pure_pursuit/pure_pursuit.param.yaml"
)
with open(lat_controller_param_path, "r") as f:
lat_controller_param = yaml.safe_load(f)["/**"]["ros__parameters"]
lat_controller_param_path = LaunchConfiguration("lat_controller_param_path").perform(context)
with open(lat_controller_param_path, "r") as f:
lat_controller_param = yaml.safe_load(f)["/**"]["ros__parameters"]
lon_controller_param_path = LaunchConfiguration("lon_controller_param_path").perform(context)
with open(lon_controller_param_path, "r") as f:
lon_controller_param = yaml.safe_load(f)["/**"]["ros__parameters"]
Expand Down Expand Up @@ -316,6 +304,14 @@ def add_launch_arg(name: str, default_value=None, description=None):
)

# parameter file path
add_launch_arg(
"lat_controller_param_path",
[
FindPackageShare("control_launch"),
"/config/trajectory_follower/mpc_follower.param.yaml",
],
"path to the parameter file of lateral controller. default is `mpc_follower`",
)
add_launch_arg(
"lon_controller_param_path",
[
Expand Down

0 comments on commit 3114c8a

Please sign in to comment.