Skip to content

Commit 084d469

Browse files
ahcordeazeeySteveMacenski
authored
Initial support to the new Gazebo (ros-navigation#3634)
* Initial support to the new Gazebo Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Added feedback Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Fixed build Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Added feeback Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Fixed physics tag Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Fixed physics tag Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Fix copyright and urdf Signed-off-by: Alejandro Hernández Cordero <[email protected]> * min range cannot be zero Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Simplify files Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Added feedback Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Added feedback Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Fix Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Try to reduce load Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Removed cast shadows Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Use Gazebo plugins instead of gz_ros2_control Signed-off-by: Alejandro Hernández Cordero <[email protected]> * update dependency Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Removed dependency Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Removed ros2_control and use ogre Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Use param file to configure bridge Signed-off-by: Alejandro Hernández Cordero <[email protected]> * Use sdf model and change to ogre instead of ogre2 for sensors Signed-off-by: Addisu Z. Taddese <[email protected]> * Support Garden and later, performance improvements Signed-off-by: Addisu Z. Taddese <[email protected]> * Use xacro for world file (ros-navigation#2) Signed-off-by: Addisu Z. Taddese <[email protected]> * Reviewer feedback Signed-off-by: Addisu Z. Taddese <[email protected]> * Add comment explaining temp file Signed-off-by: Addisu Z. Taddese <[email protected]> * Fix linter Signed-off-by: Addisu Z. Taddese <[email protected]> * Update nav2_bringup/worlds/gz_world_only.sdf.xacro Co-authored-by: Addisu Z. Taddese <[email protected]> Signed-off-by: Steve Macenski <[email protected]> --------- Signed-off-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Addisu Z. Taddese <[email protected]> Signed-off-by: Addisu Z. Taddese <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Co-authored-by: Addisu Z. Taddese <[email protected]> Co-authored-by: Addisu Z. Taddese <[email protected]> Co-authored-by: Steve Macenski <[email protected]>
1 parent 998c4cf commit 084d469

File tree

6 files changed

+1047
-0
lines changed

6 files changed

+1047
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Copyright (C) 2023 Open Source Robotics Foundation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
from ament_index_python.packages import get_package_share_directory
18+
19+
from launch import LaunchDescription
20+
from launch.actions import AppendEnvironmentVariable
21+
from launch.actions import DeclareLaunchArgument
22+
from launch.conditions import IfCondition
23+
from launch.substitutions import LaunchConfiguration
24+
25+
from launch_ros.actions import Node
26+
27+
28+
def generate_launch_description():
29+
bringup_dir = get_package_share_directory('nav2_bringup')
30+
31+
namespace = LaunchConfiguration('namespace')
32+
use_simulator = LaunchConfiguration('use_simulator')
33+
robot_name = LaunchConfiguration('robot_name')
34+
robot_sdf = LaunchConfiguration('robot_sdf')
35+
pose = {'x': LaunchConfiguration('x_pose', default='-2.00'),
36+
'y': LaunchConfiguration('y_pose', default='-0.50'),
37+
'z': LaunchConfiguration('z_pose', default='0.01'),
38+
'R': LaunchConfiguration('roll', default='0.00'),
39+
'P': LaunchConfiguration('pitch', default='0.00'),
40+
'Y': LaunchConfiguration('yaw', default='0.00')}
41+
42+
# Declare the launch arguments
43+
declare_namespace_cmd = DeclareLaunchArgument(
44+
'namespace',
45+
default_value='',
46+
description='Top-level namespace')
47+
48+
declare_use_simulator_cmd = DeclareLaunchArgument(
49+
'use_simulator',
50+
default_value='True',
51+
description='Whether to start the simulator')
52+
53+
declare_robot_name_cmd = DeclareLaunchArgument(
54+
'robot_name',
55+
default_value='turtlebot3_waffle',
56+
description='name of the robot')
57+
58+
declare_robot_sdf_cmd = DeclareLaunchArgument(
59+
'robot_sdf',
60+
default_value=os.path.join(bringup_dir, 'worlds', 'gz_waffle.sdf'),
61+
description='Full path to robot sdf file to spawn the robot in gazebo')
62+
63+
pkg_nav2_bringup = get_package_share_directory('nav2_bringup')
64+
bridge = Node(
65+
package='ros_gz_bridge',
66+
executable='parameter_bridge',
67+
parameters=[
68+
{
69+
'config_file': os.path.join(
70+
pkg_nav2_bringup, 'params', 'turtlebot3_waffle_bridge.yaml'
71+
),
72+
}
73+
],
74+
output='screen',
75+
)
76+
77+
spawn_model = Node(
78+
condition=IfCondition(use_simulator),
79+
package='ros_gz_sim',
80+
executable='create',
81+
output='screen',
82+
arguments=[
83+
'-entity', robot_name,
84+
'-file', robot_sdf,
85+
'-robot_namespace', namespace,
86+
'-x', pose['x'], '-y', pose['y'], '-z', pose['z'],
87+
'-R', pose['R'], '-P', pose['P'], '-Y', pose['Y']]
88+
)
89+
90+
set_env_vars_resources = AppendEnvironmentVariable(
91+
'GZ_SIM_RESOURCE_PATH',
92+
os.path.join(get_package_share_directory('turtlebot3_gazebo'),
93+
'models'))
94+
95+
# Create the launch description and populate
96+
ld = LaunchDescription()
97+
ld.add_action(declare_namespace_cmd)
98+
ld.add_action(declare_robot_name_cmd)
99+
ld.add_action(declare_robot_sdf_cmd)
100+
ld.add_action(declare_use_simulator_cmd)
101+
102+
ld.add_action(set_env_vars_resources)
103+
104+
ld.add_action(bridge)
105+
ld.add_action(spawn_model)
106+
return ld

0 commit comments

Comments
 (0)