Skip to content

Commit 9d5be9f

Browse files
committed
component file
1 parent 3c3a3ac commit 9d5be9f

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

husarion_ugv_controller/launch/controller.launch.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,24 @@
3434

3535

3636
def generate_launch_description():
37-
husarion_ugv_desctiption_pkg = FindPackageShare("husarion_ugv_description")
3837
husarion_ugv_controller_common_dir = PathJoinSubstitution(
3938
["/config", "husarion_ugv_controller"]
4039
)
4140

41+
robot_model = LaunchConfiguration("robot_model")
42+
robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
43+
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
44+
45+
robot_description_pkg = PythonExpression(["'", robot_model, "_description'"])
46+
robot_description_common_dir = PathJoinSubstitution(["/config", robot_description_pkg])
47+
48+
declare_robot_model_arg = DeclareLaunchArgument(
49+
"robot_model",
50+
default_value=robot_model_dict[robot_model_env],
51+
description="Specify robot model",
52+
choices=["lynx", "panther"],
53+
)
54+
4255
battery_config_path = LaunchConfiguration("battery_config_path")
4356
declare_battery_config_path_arg = DeclareLaunchArgument(
4457
"battery_config_path",
@@ -53,7 +66,7 @@ def generate_launch_description():
5366
declare_components_config_path_arg = DeclareLaunchArgument(
5467
"components_config_path",
5568
default_value=PathJoinSubstitution(
56-
[husarion_ugv_desctiption_pkg, "config", "components.yaml"]
69+
[robot_description_common_dir, "config", "components.yaml"]
5770
),
5871
description=(
5972
"Additional components configuration file. Components described in this file "
@@ -99,16 +112,6 @@ def generate_launch_description():
99112
choices=["True", "true", "False", "false"],
100113
)
101114

102-
robot_model = LaunchConfiguration("robot_model")
103-
robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
104-
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
105-
declare_robot_model_arg = DeclareLaunchArgument(
106-
"robot_model",
107-
default_value=robot_model_dict[robot_model_env],
108-
description="Specify robot model",
109-
choices=["lynx", "panther"],
110-
)
111-
112115
use_sim = LaunchConfiguration("use_sim")
113116
declare_use_sim_arg = DeclareLaunchArgument(
114117
"use_sim",
@@ -122,14 +125,14 @@ def generate_launch_description():
122125
"wheel_config_path",
123126
default_value=PathJoinSubstitution(
124127
[
125-
FindPackageShare(husarion_ugv_desctiption_pkg),
128+
FindPackageShare(robot_description_pkg),
126129
"config",
127130
PythonExpression(["'", wheel_type, ".yaml'"]),
128131
]
129132
),
130133
description=(
131134
"Path to wheel configuration file. By default, it is located in "
132-
"'husarion_ugv_description/config/{wheel_type}.yaml'. You can also specify the path "
135+
"'panther_description/config/{wheel_type}.yaml'. You can also specify the path "
133136
"to your custom wheel configuration file here. "
134137
),
135138
)
@@ -160,7 +163,7 @@ def generate_launch_description():
160163
" ",
161164
PathJoinSubstitution(
162165
[
163-
FindPackageShare(husarion_ugv_desctiption_pkg),
166+
FindPackageShare(robot_description_pkg),
164167
"urdf",
165168
robot_description_file,
166169
]

0 commit comments

Comments
 (0)