-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support to the new Gazebo #3634
Merged
SteveMacenski
merged 32 commits into
ros-navigation:main
from
ahcorde:ahcorde/initial_support/gazebo
Jun 5, 2024
Merged
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
c52b2b0
Initial support to the new Gazebo
ahcorde fd50e02
Added feedback
ahcorde 2500c8c
Fixed build
ahcorde 5215768
Added feeback
ahcorde d3c421a
Fixed physics tag
ahcorde 975bc78
Fixed physics tag
ahcorde 469c2a2
Fix copyright and urdf
ahcorde 34f466e
min range cannot be zero
ahcorde 01babc9
Simplify files
ahcorde 00b5885
Merge remote-tracking branch 'origin/main' into ahcorde/initial_suppo…
ahcorde 792569a
Added feedback
ahcorde 960fdd7
Added feedback
ahcorde 5a3e06c
Fix
ahcorde b17def8
Try to reduce load
ahcorde b413994
Removed cast shadows
ahcorde ed65b71
Use Gazebo plugins instead of gz_ros2_control
ahcorde 41d7f4e
update dependency
ahcorde 9a36ecd
Removed dependency
ahcorde 027f113
Merge remote-tracking branch 'origin/main' into ahcorde/initial_suppo…
ahcorde 564cf39
Removed ros2_control and use ogre
ahcorde 4b8b006
Merge remote-tracking branch 'origin/main' into ahcorde/initial_suppo…
ahcorde ddb760d
Use param file to configure bridge
ahcorde 076f1f0
Use sdf model and change to ogre instead of ogre2 for sensors
azeey 04912e6
Merge branch 'main' into support_gz-sim
azeey b2deaee
Support Garden and later, performance improvements
azeey 43ef810
Merge pull request #1 from azeey/support_gz-sim
ahcorde 1cc1474
Use xacro for world file (#2)
azeey 6a462be
Reviewer feedback
azeey 225f1f3
Add comment explaining temp file
azeey 1d8634d
Fix linter
azeey 5bf14e2
Merge branch 'main' into ahcorde/initial_support/gazebo
SteveMacenski cc5bde0
Update nav2_bringup/worlds/gz_world_only.sdf.xacro
SteveMacenski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
# Copyright (C) 2023 Open Source Robotics Foundation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, ExecuteProcess | ||
from launch.actions import SetEnvironmentVariable | ||
from launch.conditions import IfCondition | ||
from launch.substitutions import Command, LaunchConfiguration | ||
from launch_ros.actions import Node | ||
|
||
|
||
def generate_launch_description(): | ||
bringup_dir = get_package_share_directory('nav2_bringup') | ||
|
||
namespace = LaunchConfiguration('namespace') | ||
use_simulator = LaunchConfiguration('use_simulator') | ||
use_sim_time = LaunchConfiguration('use_sim_time') | ||
robot_name = LaunchConfiguration('robot_name') | ||
robot_sdf = LaunchConfiguration('robot_sdf') | ||
pose = {'x': LaunchConfiguration('x_pose', default='-2.00'), | ||
'y': LaunchConfiguration('y_pose', default='-0.50'), | ||
'z': LaunchConfiguration('z_pose', default='0.01'), | ||
'R': LaunchConfiguration('roll', default='0.00'), | ||
'P': LaunchConfiguration('pitch', default='0.00'), | ||
'Y': LaunchConfiguration('yaw', default='0.00')} | ||
|
||
# Declare the launch arguments | ||
declare_namespace_cmd = DeclareLaunchArgument( | ||
'namespace', | ||
default_value='', | ||
description='Top-level namespace') | ||
|
||
declare_use_simulator_cmd = DeclareLaunchArgument( | ||
'use_simulator', | ||
default_value='True', | ||
description='Whether to start the simulator') | ||
|
||
declare_use_sim_time_cmd = DeclareLaunchArgument( | ||
'use_sim_time', | ||
default_value='true', | ||
description='Use simulation (Gazebo) clock if true') | ||
|
||
declare_robot_name_cmd = DeclareLaunchArgument( | ||
'robot_name', | ||
default_value='turtlebot3_waffle', | ||
description='name of the robot') | ||
|
||
declare_robot_sdf_cmd = DeclareLaunchArgument( | ||
'robot_sdf', | ||
default_value=os.path.join(bringup_dir, 'urdf', 'gz_turtlebot3_waffle.urdf'), | ||
description='Full path to robot sdf file to spawn the robot in gazebo') | ||
|
||
clock_bridge = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_bridge', executable='parameter_bridge', | ||
name='clock_bridge', | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time | ||
}], | ||
arguments=['/clock' + '@rosgraph_msgs/msg/Clock' + '[ignition.msgs.Clock'] | ||
) | ||
|
||
lidar_bridge = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
name='lidar_bridge', | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time | ||
}], | ||
arguments=[['/scan' + '@sensor_msgs/msg/LaserScan[ignition.msgs.LaserScan']], | ||
) | ||
|
||
imu_bridge = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
name='imu_bridge', | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time | ||
}], | ||
arguments=[['/imu' + '@sensor_msgs/msg/Imu[ignition.msgs.IMU']], | ||
) | ||
|
||
odom_bridge = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
name='odom_bridge', | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time | ||
}], | ||
arguments=[['/odom' + '@nav_msgs/msg/Odometry[ignition.msgs.Odometry']], | ||
) | ||
|
||
odom_tf_bridge = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
name='odom_tf_bridge', | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time | ||
}], | ||
arguments=[['/tf' + '@tf2_msgs/msg/TFMessage[ignition.msgs.Pose_V']], | ||
) | ||
|
||
cm_vel_bridge = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
name='cm_vel_bridge', | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time | ||
}], | ||
arguments=[['/cmd_vel' + '@geometry_msgs/msg/Twist]ignition.msgs.Twist']], | ||
) | ||
|
||
# load_joint_state_broadcaster = ExecuteProcess( | ||
# condition=IfCondition(use_simulator), | ||
# cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', | ||
# 'joint_state_broadcaster'], | ||
# output='screen' | ||
# ) | ||
# | ||
# load_diffdrive_controller = ExecuteProcess( | ||
# condition=IfCondition(use_simulator), | ||
# cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', | ||
# 'diffdrive_controller'], | ||
# output='screen' | ||
# ) | ||
|
||
spawn_model = Node( | ||
condition=IfCondition(use_simulator), | ||
package='ros_gz_sim', | ||
executable='create', | ||
output='screen', | ||
arguments=[ | ||
'-entity', robot_name, | ||
'-string', Command(['xacro', ' ', robot_sdf]), | ||
'-robot_namespace', namespace, | ||
'-x', pose['x'], '-y', pose['y'], '-z', pose['z'], | ||
'-R', pose['R'], '-P', pose['P'], '-Y', pose['Y']] | ||
) | ||
|
||
env_vars = os.getenv('IGN_GAZEBO_RESOURCE_PATH', default="") | ||
env_vars += ':' + \ | ||
os.path.join(get_package_share_directory('turtlebot3_gazebo'), 'models') \ | ||
+ ':' + \ | ||
os.path.join(get_package_share_directory( | ||
'turtlebot3_gazebo'), '..') | ||
|
||
set_env_vars_resources = SetEnvironmentVariable('IGN_GAZEBO_RESOURCE_PATH', env_vars) | ||
|
||
# Create the launch description and populate | ||
ld = LaunchDescription() | ||
ld.add_action(declare_namespace_cmd) | ||
ld.add_action(declare_robot_name_cmd) | ||
ld.add_action(declare_robot_sdf_cmd) | ||
ld.add_action(declare_use_simulator_cmd) | ||
ld.add_action(declare_use_sim_time_cmd) | ||
|
||
ld.add_action(set_env_vars_resources) | ||
|
||
ld.add_action(clock_bridge) | ||
ld.add_action(lidar_bridge) | ||
ld.add_action(imu_bridge) | ||
ld.add_action(spawn_model) | ||
ld.add_action(odom_bridge) | ||
ld.add_action(odom_tf_bridge) | ||
ld.add_action(cm_vel_bridge) | ||
# ld.add_action(load_joint_state_broadcaster) | ||
# ld.add_action(load_diffdrive_controller) | ||
return ld |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
ignition
orgz
? I thought this PR was forgarden
, notfortress
. We would like to use this in ArduPilot. There's a few other places.