diff --git a/src/sherpa/CMakeLists.txt b/src/sherpa/CMakeLists.txt index 1a82335..bc8f733 100644 --- a/src/sherpa/CMakeLists.txt +++ b/src/sherpa/CMakeLists.txt @@ -31,3 +31,4 @@ install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY config DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY urdf DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY worlds DESTINATION share/${PROJECT_NAME}/) +install(DIRECTORY materials DESTINATION share/${PROJECT_NAME}/) diff --git a/src/sherpa/launch/asd.launch.py b/src/sherpa/launch/asd.launch.py new file mode 100644 index 0000000..dc55e12 --- /dev/null +++ b/src/sherpa/launch/asd.launch.py @@ -0,0 +1,123 @@ +import os.path + +from ament_index_python.packages import get_package_share_directory + +from launch import LaunchDescription +from launch.actions import ExecuteProcess, IncludeLaunchDescription, SetEnvironmentVariable +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare +from ament_index_python.packages import get_package_share_directory +from launch.substitutions import Command + +def generate_launch_description(): + + ld = LaunchDescription() + + pkg_name = 'sherpa' + pkg_share = get_package_share_directory(pkg_name) + pkg_prefix = os.path.dirname(pkg_share) + + world_path = os.path.join(pkg_share, 'worlds', 'asd_course.world') + xacro_file = os.path.join(pkg_share, 'urdf', 'sherpa.xacro') + + # create nodes + + gz_env = SetEnvironmentVariable( + name='GZ_SIM_RESOURCE_PATH', + value=[pkg_prefix] + ) + + gz = ExecuteProcess( + cmd=[ + 'ros2', 'launch', 'ros_gz_sim', 'gz_sim.launch.py', + f'gz_args:=-r {world_path}' + ], + output='screen' + ) + + state_publisher = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + name='robot_state_publisher', + output='screen', + parameters=[{ + 'robot_description': Command(['xacro ', xacro_file]) + }] + ) + + controller = Node( + package='controller_manager', + executable='spawner', + arguments=['ackermann_controller'], + #output='screen' + ) + + joint_state_broadcaster = Node( + package='controller_manager', + executable='spawner', + arguments=['joint_state_broadcaster', '--controller-manager', '/controller_manager'], + parameters=[{'use_sim_time': True}], + #output='screen' + ) + + static_tf = Node( + package='tf2_ros', + executable='static_transform_publisher', + name='static_tf_base_to_lidar', + arguments=[ + '0', '0', '0', + '0', '0', '0', + 'velodyne', + 'lidar_link', + ] + ) + + robot = ExecuteProcess( + cmd=[ + 'ros2', 'run', 'ros_gz_sim', 'create', + '-name', 'sherpa', + '-topic', 'robot_description', + '-x', '0', '-y', '0', '-z', '2' + ], + output='screen' + ) + + twist_stamper = Node( + package="twist_stamper", + executable="twist_stamper", + remappings=[ + ('/cmd_vel_out', '/ackermann_controller/reference'), + ], + output='screen' + ) + + gz_bridge = Node( + package="ros_gz_bridge", + executable="parameter_bridge", + arguments=[ + "--ros-args", + "-p", + f"config_file:={os.path.join(pkg_share, 'config', 'gz_bridge.yaml')}", + ] + ) + + + rviz2 = Node( + package='rviz2', + executable='rviz2', + arguments=['-d', f"{os.path.join(get_package_share_directory('sherpa'), 'config', 'sherpa.rviz')}"] + ) + + ld.add_action(gz_env) + ld.add_action(gz) + ld.add_action(state_publisher) + ld.add_action(static_tf) + ld.add_action(robot) + ld.add_action(gz_bridge) + ld.add_action(joint_state_broadcaster) + ld.add_action(controller) + ld.add_action(twist_stamper) + ld.add_action(rviz2) + + return ld diff --git a/src/sherpa/materials/textures/track.png b/src/sherpa/materials/textures/track.png new file mode 100755 index 0000000..4834418 Binary files /dev/null and b/src/sherpa/materials/textures/track.png differ diff --git a/src/sherpa/urdf/components/camera.xacro b/src/sherpa/urdf/components/camera.xacro index 3fe1e5b..6f5e35a 100644 --- a/src/sherpa/urdf/components/camera.xacro +++ b/src/sherpa/urdf/components/camera.xacro @@ -31,7 +31,7 @@ 800 800 - R8G8B8 + L8 0.02 diff --git a/src/sherpa/urdf/sherpa.xacro b/src/sherpa/urdf/sherpa.xacro index fa76fb5..dbd2d9c 100644 --- a/src/sherpa/urdf/sherpa.xacro +++ b/src/sherpa/urdf/sherpa.xacro @@ -25,7 +25,7 @@ - + diff --git a/src/sherpa/worlds/asd_course.world b/src/sherpa/worlds/asd_course.world new file mode 100644 index 0000000..cdcb25a --- /dev/null +++ b/src/sherpa/worlds/asd_course.world @@ -0,0 +1,170 @@ + + + + + + + 0 0 20 0 0 0 + 0.8 0.8 0.8 1.0 + 0.8 0.8 0.8 1.0 + + 1000 + 0.9 + 0.05 + 0.01 + + false + + + false + + + + + ogre2 + + + + + + + + + + + + + + 3D View + false + docked + + + ogre2 + scene + 0.4 0.4 0.4 + 0.5 0.8 0.95 + + + prius_hybrid + 0.5 + 0.5 5 2 + + + + + + + World control + false + false + 72 + 121 + 1 + + floating + + + + + + + true + true + true + + + + + + + World stats + false + false + 110 + 290 + 1 + + floating + + + + + + + true + true + true + true + + + + + docked + + front_camera + + + + + docked + + /cmd_vel + + + + + true + + + + + 0 0 1 + 200 200 + + + + + + 50 + + + + + + false + + + 0 0 1 + 35 35 + + + + + + file://sherpa/materials/textures/track.png + + + 1 1 1 1 + 1 1 1 1 + + + 0 0 0 0 0 0 + + 0 0 0 0 0 0 + 1 + + 1 + 0 + 0 + 1 + 0 + 1 + + + + 0 0 0 0 0 0 + false + + +