Go2Py/deploy/launch_files/robot_description.launch.py

32 lines
1.1 KiB
Python
Raw Normal View History

from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import ThisLaunchFileDir
from launch_ros.actions import Node
from launch.substitutions import Command, FindExecutable, LaunchConfiguration
from ament_index_python.packages import get_package_share_directory
import os
2024-05-21 06:45:59 +08:00
def generate_launch_description():
go2_xacro_file = os.path.join(
get_package_share_directory("go2_description"), "xacro", "robot.xacro"
)
robot_description = Command(
[FindExecutable(name="xacro"), " ", go2_xacro_file, " DEBUG:=", 'false']
)
2024-05-21 06:45:59 +08:00
return LaunchDescription([
Node(
2024-05-21 06:45:59 +08:00
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
output="screen",
parameters=[{"robot_description": robot_description}],
remappings=[
("/joint_states", "/go2/joint_states"),
("/robot_description", "/go2/robot_description"),
2024-05-21 06:45:59 +08:00
],
),
])