diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac98831..cbeb9cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: with: import-token: ${{ secrets.GITHUB_TOKEN }} target-ros2-distro: ${{ matrix.ros_distro }} - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: colcon-logs path: ros_ws/log diff --git a/nav2_minimal_tb3_sim/configs/turtlebot3_waffle_gps_bridge.yaml b/nav2_minimal_tb3_sim/configs/turtlebot3_waffle_gps_bridge.yaml new file mode 100644 index 0000000..83d38e9 --- /dev/null +++ b/nav2_minimal_tb3_sim/configs/turtlebot3_waffle_gps_bridge.yaml @@ -0,0 +1,50 @@ +# replace clock_bridge +- topic_name: "/clock" + ros_type_name: "rosgraph_msgs/msg/Clock" + gz_type_name: "gz.msgs.Clock" + direction: GZ_TO_ROS + +# no equivalent in TB3 - add +- topic_name: "joint_states" + ros_type_name: "sensor_msgs/msg/JointState" + gz_type_name: "gz.msgs.Model" + direction: GZ_TO_ROS + +# replace odom_bridge - check gz topic name +# gz topic published by DiffDrive plugin +- topic_name: "odom" + ros_type_name: "nav_msgs/msg/Odometry" + gz_type_name: "gz.msgs.Odometry" + direction: GZ_TO_ROS + +# replace odom_tf_bridge - check gz and ros topic names +# gz topic published by DiffDrive plugin +# prefix ros2 topic with gz +- topic_name: "tf" + ros_type_name: "tf2_msgs/msg/TFMessage" + gz_type_name: "gz.msgs.Pose_V" + direction: GZ_TO_ROS + +# replace imu_bridge - check gz topic name +- topic_name: "imu/data" + ros_type_name: "sensor_msgs/msg/Imu" + gz_type_name: "gz.msgs.IMU" + direction: GZ_TO_ROS + +# replace lidar_bridge +- topic_name: "scan" + ros_type_name: "sensor_msgs/msg/LaserScan" + gz_type_name: "gz.msgs.LaserScan" + direction: GZ_TO_ROS + +# replace cmd_vel_bridge +- topic_name: "cmd_vel" + ros_type_name: "geometry_msgs/msg/Twist" + gz_type_name: "gz.msgs.Twist" + direction: ROS_TO_GZ + +# replace navsat_bridge - check gz topic name +- topic_name: "gps/fix" + ros_type_name: "sensor_msgs/msg/NavSatFix" + gz_type_name: "gz.msgs.NavSat" + direction: GZ_TO_ROS diff --git a/nav2_minimal_tb3_sim/launch/spawn_tb3_gps.launch.py b/nav2_minimal_tb3_sim/launch/spawn_tb3_gps.launch.py new file mode 100644 index 0000000..3b90c48 --- /dev/null +++ b/nav2_minimal_tb3_sim/launch/spawn_tb3_gps.launch.py @@ -0,0 +1,132 @@ +# Copyright (C) 2023 Open Source Robotics Foundation +# Copyright (C) 2024 Open Navigation LLC +# +# 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 pathlib import Path + + +from ament_index_python.packages import get_package_share_directory + +from launch import LaunchDescription +from launch.actions import AppendEnvironmentVariable +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration +from launch.substitutions.command import Command +from launch.substitutions.find_executable import FindExecutable + +from launch_ros.actions import Node + + +def generate_launch_description(): + bringup_dir = get_package_share_directory('nav2_minimal_tb3_sim') + + namespace = LaunchConfiguration('namespace') + 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_robot_name_cmd = DeclareLaunchArgument( + 'robot_name', + default_value='turtlebot3_waffle_gps', + description='name of the robot', + ) + + declare_robot_sdf_cmd = DeclareLaunchArgument( + 'robot_sdf', + default_value=os.path.join(bringup_dir, 'urdf', 'gz_waffle_gps.sdf.xacro'), + description='Full path to robot sdf file to spawn the robot in gazebo', + ) + + bridge = Node( + package='ros_gz_bridge', + executable='parameter_bridge', + namespace=namespace, + parameters=[ + { + 'config_file': os.path.join( + bringup_dir, 'configs', 'turtlebot3_waffle_gps_bridge.yaml' + ), + 'expand_gz_topic_names': True, + 'use_sim_time': True, + } + ], + output='screen', + ) + + spawn_model = Node( + package='ros_gz_sim', + executable='create', + output='screen', + namespace=namespace, + arguments=[ + '-name', + robot_name, + '-string', + Command( + [ + FindExecutable(name='xacro'), + ' ', + 'namespace:=', + LaunchConfiguration('namespace'), + ' ', + robot_sdf, + ] + ), + '-x', + pose['x'], + '-y', + pose['y'], + '-z', + pose['z'], + '-R', + pose['R'], + '-P', + pose['P'], + '-Y', + pose['Y'], + ], + ) + + set_env_vars_resources = AppendEnvironmentVariable( + 'GZ_SIM_RESOURCE_PATH', os.path.join(bringup_dir, 'models') + ) + set_env_vars_resources2 = AppendEnvironmentVariable( + 'GZ_SIM_RESOURCE_PATH', str(Path(os.path.join(bringup_dir)).parent.resolve()) + ) + + # 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(set_env_vars_resources) + ld.add_action(set_env_vars_resources2) + + ld.add_action(bridge) + ld.add_action(spawn_model) + return ld diff --git a/nav2_minimal_tb3_sim/urdf/gz_waffle_gps.sdf.xacro b/nav2_minimal_tb3_sim/urdf/gz_waffle_gps.sdf.xacro new file mode 100644 index 0000000..a04d530 --- /dev/null +++ b/nav2_minimal_tb3_sim/urdf/gz_waffle_gps.sdf.xacro @@ -0,0 +1,529 @@ + + + + + + 0.0 0.0 0.0 0.0 0.0 0.0 + + + + + + + -0.064 0 0.048 0 0 0 + + 0.001 + 0.000 + 0.000 + 0.001 + 0.000 + 0.001 + + 1.0 + + + + -0.064 0 0.048 0 0 0 + + + 0.265 0.265 0.089 + + + + + + -0.064 0 0 0 0 0 + + + package://nav2_minimal_tb3_sim/models/turtlebot3_model/meshes/waffle_base.dae + 0.001 0.001 0.001 + + + + 1 1 1 + + + + + + + true + 200 + $(arg namespace)/imu/data + imu_link + + + + + 0.0 + 2e-4 + + + + + 0.0 + 2e-4 + + + + + 0.0 + 2e-4 + + + + + + + 0.0 + 1.7e-2 + + + + + 0.0 + 1.7e-2 + + + + + 0.0 + 1.7e-2 + + + + + + + + + + true + 1 + $(arg namespace)/gps/fix + gps_link + + + + + 0.0 + 0.0 + + + + + 0.0 + 0.0 + + + + + + + + + + -0.064 0 0.121 0 0 0 + + 0.001 + 0.000 + 0.000 + 0.001 + 0.000 + 0.001 + + 0.125 + + + + -0.052 0 0.111 0 0 0 + + + 0.0508 + 0.055 + + + + + + -0.064 0 0.121 0 0 0 + + + package://nav2_minimal_tb3_sim/models/turtlebot3_model/meshes/lds.dae + 0.001 0.001 0.001 + + + + 1 1 1 + + + + + true + true + -0.064 0 0.15 0 0 0 + 5 + $(arg namespace)/scan + base_scan + + + + 360 + 1.000000 + 0.000000 + 6.280000 + + + + 0.00001 + 20.0 + 0.015000 + + + gaussian + 0.0 + 0.01 + + + + + + + + + 0.0 0.144 0.023 -1.57 0 0 + + 0.001 + 0.000 + 0.000 + 0.001 + 0.000 + 0.001 + + 0.1 + + + + 0.0 0.144 0.023 -1.57 0 0 + + + 0.033 + 0.018 + + + + + + 1 + 1 + 0.035 + 0 + 0 0 1 + + + + + 0 + 0.2 + 1e+5 + 1 + 0.01 + 0.001 + + + + + + + 0.0 0.144 0.023 0 0 0 + + + package://nav2_minimal_tb3_sim/models/turtlebot3_model/meshes/tire.dae + 0.001 0.001 0.001 + + + + 1 1 1 + + + + + + + + 0.0 -0.144 0.023 -1.57 0 0 + + 0.001 + 0.000 + 0.000 + 0.001 + 0.000 + 0.001 + + 0.1 + + + + 0.0 -0.144 0.023 -1.57 0 0 + + + 0.033 + 0.018 + + + + + + 1 + 1 + 0.035 + 0 + 0 0 1 + + + + + 0 + 0.2 + 1e+5 + 1 + 0.01 + 0.001 + + + + + + + 0.0 -0.144 0.023 0 0 0 + + + package://nav2_minimal_tb3_sim/models/turtlebot3_model/meshes/tire.dae + 0.001 0.001 0.001 + + + + 1 1 1 + + + + + + -0.177 -0.064 -0.004 0 0 0 + + 0.001 + + 0.00001 + 0.000 + 0.000 + 0.00001 + 0.000 + 0.00001 + + + + + + 0.005000 + + + + + + 0 + 0.2 + 1e+5 + 1 + 0.01 + 0.001 + + + + + + + + -0.177 0.064 -0.004 0 0 0 + + 0.001 + + 0.00001 + 0.000 + 0.000 + 0.00001 + 0.000 + 0.00001 + + + + + + 0.005000 + + + + + + 0 + 0.2 + 1e+5 + 1 + 0.01 + 0.001 + + + + + + + + + 0.069 -0.047 0.107 0 0 0 + + 0.001 + 0.000 + 0.000 + 0.001 + 0.000 + 0.001 + + 0.035 + + + 0 0.047 -0.005 0 0 0 + + + 0.008 0.130 0.022 + + + + + 0.069 -0.047 0.107 0 0 0 + + + 1 + 5 + 0.064 -0.047 0.107 0 0 0 + camera_depth_frame + + 1.047 + + 320 + 240 + + + + + + 19.4 + + + + + 0.001 + 5.0 + + + + + + + + base_footprint + base_link + 0.0 0.0 0.010 0 0 0 + + + + base_link + wheel_left_link + 0.0 0.144 0.023 -1.57 0 0 + + 0 0 1 + + + + + base_link + wheel_right_link + 0.0 -0.144 0.023 -1.57 0 0 + + 0 0 1 + + + + + base_link + caster_back_right_link + + + + base_link + caster_back_left_link + + + + base_link + base_scan + -0.064 0 0.121 0 0 0 + + 0 0 1 + + + + + base_link + camera_link + 0.064 -0.065 0.094 0 0 0 + + 0 0 1 + + + + + base_link + imu_link + 0.0 0 0.068 0 0 0 + + + + base_link + gps_link + -0.05 0 0.05 0 0 0 + + + + + wheel_left_joint + wheel_right_joint + 0.287 + 0.033 + 1 + -1 + 2 + -2 + 0.46 + -0.46 + 1.9 + -1.9 + $(arg namespace)/cmd_vel + $(arg namespace)/odom + $(arg namespace)/tf + odom + base_footprint + 30 + + + + wheel_left_joint + wheel_right_joint + $(arg namespace)/joint_states + 30 + + + + diff --git a/nav2_minimal_tb3_sim/urdf/turtlebot3_waffle_gps.urdf b/nav2_minimal_tb3_sim/urdf/turtlebot3_waffle_gps.urdf new file mode 100644 index 0000000..444b194 --- /dev/null +++ b/nav2_minimal_tb3_sim/urdf/turtlebot3_waffle_gps.urdf @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nav2_minimal_tb3_sim/worlds/tb3_empty_world.sdf.xacro b/nav2_minimal_tb3_sim/worlds/tb3_empty_world.sdf.xacro new file mode 100644 index 0000000..ed6c368 --- /dev/null +++ b/nav2_minimal_tb3_sim/worlds/tb3_empty_world.sdf.xacro @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + ogre2 + + + + + + + EARTH_WGS84 + ENU + 55.944831 + -3.186998 + 0 + 0 + + + + 0 + 0 0 10 0 0 0 + 0.8 0.8 0.8 1 + 0.8 0.8 0.8 1 + + 1000 + 0.9 + 0.01 + 0.001 + + -0.5 0.1 -0.9 + + + 1 + + + + + 0 0 1 + 100 100 + + + 10 + + + + + 0 0 1 + 100 100 + + + + 0.8 0.8 0.8 1 + 0.8 0.8 0.8 1 + 0.8 0.8 0.8 1 + + + + + + + 0 + + + + 0.003 + 1 + + + + + +