Skip to content

Commit 8044c88

Browse files
committed
add Gazebo world file with actors
1 parent 5feb679 commit 8044c88

36 files changed

+2079
-3993
lines changed

drl_agent_bringup/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ install(
2929
config
3030
launch
3131
scripts
32+
models
3233
worlds
3334
DESTINATION
3435
share/${PROJECT_NAME}/

drl_agent_bringup/config/gazebo_params.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

drl_agent_bringup/launch/gazebo_world.launch.py

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
from ament_index_python.packages import get_package_share_directory
66
from launch import LaunchDescription
7-
from launch.actions import DeclareLaunchArgument, ExecuteProcess
7+
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
88
from launch.conditions import IfCondition
9+
from launch.launch_description_sources import PythonLaunchDescriptionSource
910
from launch.substitutions import LaunchConfiguration
1011
from ament_index_python.packages import get_package_prefix
1112

@@ -15,22 +16,28 @@
1516
choices=['true', 'false'],
1617
description='Whether or not to launch gzclient'),
1718
DeclareLaunchArgument('world_path',
18-
default_value=[os.path.join(get_package_share_directory('drl_agent_bringup'), 'worlds', 'TD3.world')],
19+
default_value=[os.path.join(get_package_share_directory('drl_agent_bringup'), 'worlds', 'td7.world')],
1920
description='SDF world file'),
2021
]
2122

2223

2324
def generate_launch_description():
2425

25-
# Get packages description and directory
26+
"""*************************************************************************************
27+
** Get package share directories
28+
*************************************************************************************"""
2629
drl_agent_bringup_package_name = 'drl_agent_bringup'
2730
drl_agent_description_package_name = 'drl_agent_description'
2831
velodyne_description_package_name = 'velodyne_description'
2932
drl_agent_bringup_package_directory = get_package_share_directory(drl_agent_bringup_package_name)
3033
drl_agent_description_package_directory = get_package_share_directory(drl_agent_description_package_name)
3134
velodyne_description_package_directory = get_package_share_directory(velodyne_description_package_name)
35+
gazebo_ros_package_directory = get_package_share_directory('gazebo_ros')
3236

33-
# Set the Path to mesh models. NOTE: should be done before gazebo is 1st launched.
37+
"""*************************************************************************************
38+
** Set the Path to mesh models. NOTE: should be done before gazebo is 1st launched.
39+
*************************************************************************************"""
40+
drl_agent_bringup_install_dir_path = (get_package_prefix(drl_agent_bringup_package_name) + '/share')
3441
drl_agent_install_dir_path = (get_package_prefix(drl_agent_description_package_name) + '/share')
3542
velodyne_description_install_dir_path = (get_package_prefix(velodyne_description_package_name) + '/share')
3643

@@ -39,7 +46,7 @@ def generate_launch_description():
3946
drl_agent_description_models_path = os.path.join(drl_agent_description_package_directory, 'models')
4047
drl_agent_bringup_models_path = os.path.join(drl_agent_bringup_package_directory, 'models')
4148

42-
gazebo_resource_paths = [drl_agent_install_dir_path, robot_meshes_path, drl_agent_description_models_path,\
49+
gazebo_resource_paths = [drl_agent_bringup_install_dir_path, drl_agent_install_dir_path, robot_meshes_path, drl_agent_description_models_path,\
4350
drl_agent_bringup_models_path, velodyne_description_install_dir_path, velodyne_description_meshes_path]
4451
if 'GAZEBO_MODEL_PATH' in os.environ:
4552
for resource_path in gazebo_resource_paths:
@@ -57,31 +64,30 @@ def generate_launch_description():
5764
# print(str(os.environ['GAZEBO_PLUGIN_PATH']))
5865
print(border)
5966

60-
# Launch configurations
67+
"""*************************************************************************************
68+
Launch configurations and gazebo launch
69+
*************************************************************************************"""
6170
world_path = LaunchConfiguration('world_path')
6271
use_gazebo_gui = LaunchConfiguration('use_gazebo_gui')
6372

64-
# Gazebo server
65-
gazebo_params_yaml_file = os.path.join(
66-
drl_agent_bringup_package_directory, 'config', 'gazebo_params.yaml')
67-
gzserver = ExecuteProcess(
68-
cmd=['gzserver',
69-
'-s', 'libgazebo_ros_init.so',
70-
'-s', 'libgazebo_ros_factory.so',
71-
world_path,
72-
'extra-gazebo-args', '--ros-args', '--params-file', gazebo_params_yaml_file],
73-
output='screen',
73+
gzserver_cmd = IncludeLaunchDescription(
74+
PythonLaunchDescriptionSource(
75+
os.path.join(gazebo_ros_package_directory, 'launch', 'gzserver.launch.py')
76+
),
77+
launch_arguments=[
78+
('world', world_path),
79+
]
7480
)
7581

76-
# Gazebo client
77-
gzclient = ExecuteProcess(
78-
cmd=['gzclient'],
79-
output='screen',
80-
condition=IfCondition(use_gazebo_gui),
82+
gzclient_cmd = IncludeLaunchDescription(
83+
PythonLaunchDescriptionSource(
84+
os.path.join(gazebo_ros_package_directory, 'launch', 'gzclient.launch.py')
85+
),
86+
condition=IfCondition(use_gazebo_gui)
8187
)
8288

8389
ld = LaunchDescription(ARGUMENTS)
84-
ld.add_action(gzserver)
85-
ld.add_action(gzclient)
90+
ld.add_action(gzserver_cmd)
91+
ld.add_action(gzclient_cmd)
8692

8793
return ld

drl_agent_bringup/models/Chair/meshes/Chair.mtl

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)