Initial commit of duru_urdf package
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import PathJoinSubstitution
|
||||
import os
|
||||
import xacro
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
share_dir = get_package_share_directory('duru_urdf_description')
|
||||
|
||||
xacro_file = os.path.join(share_dir, 'urdf', 'duru_urdf.xacro')
|
||||
robot_description_config = xacro.process_file(xacro_file)
|
||||
robot_urdf = robot_description_config.toxml()
|
||||
|
||||
robot_state_publisher_node = Node(
|
||||
package='robot_state_publisher',
|
||||
executable='robot_state_publisher',
|
||||
name='robot_state_publisher',
|
||||
parameters=[
|
||||
{'robot_description': robot_urdf}
|
||||
]
|
||||
)
|
||||
|
||||
joint_state_publisher_node = Node(
|
||||
package='joint_state_publisher',
|
||||
executable='joint_state_publisher',
|
||||
name='joint_state_publisher'
|
||||
)
|
||||
|
||||
gazebo_server = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([
|
||||
PathJoinSubstitution([
|
||||
FindPackageShare('gazebo_ros'),
|
||||
'launch',
|
||||
'gzserver.launch.py'
|
||||
])
|
||||
]),
|
||||
launch_arguments={
|
||||
'pause': 'true'
|
||||
}.items()
|
||||
)
|
||||
|
||||
gazebo_client = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([
|
||||
PathJoinSubstitution([
|
||||
FindPackageShare('gazebo_ros'),
|
||||
'launch',
|
||||
'gzclient.launch.py'
|
||||
])
|
||||
])
|
||||
)
|
||||
|
||||
urdf_spawn_node = Node(
|
||||
package='gazebo_ros',
|
||||
executable='spawn_entity.py',
|
||||
arguments=[
|
||||
'-entity', 'duru_urdf',
|
||||
'-topic', 'robot_description'
|
||||
],
|
||||
output='screen'
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
robot_state_publisher_node,
|
||||
joint_state_publisher_node,
|
||||
gazebo_server,
|
||||
gazebo_client,
|
||||
urdf_spawn_node,
|
||||
])
|
||||
Reference in New Issue
Block a user