|
- from launch import LaunchDescription
- from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
-
- from launch_ros.actions import Node
- from launch_ros.substitutions import FindPackageShare
-
- def generate_launch_description():
-
- robot_description_content = Command([
- PathJoinSubstitution([FindExecutable(name="xacro")]),
- " ",
- PathJoinSubstitution(
- [
- FindPackageShare("hexapod_robot"),
- "urdf",
- "hexapod_robot.urdf.xacro"
- ]
- )
- ]
- )
- robot_description = {"robot_description": robot_description_content}
-
- rviz_node = Node(
- package="rviz2",
- executable="rviz2",
- arguments=['-d', PathJoinSubstitution([FindPackageShare("hexapod_robot"), "config", "hexapod_robot.rviz"])],
- name="rviz2",
- output="screen",
- )
-
- robot_state_publisher_node = Node(
- package="robot_state_publisher",
- executable="robot_state_publisher",
- parameters=[{
- 'robot_description': robot_description_content
- }]
- )
-
- joint_state_publisher_gui = Node(
- package="joint_state_publisher_gui",
- executable="joint_state_publisher_gui"
- )
-
- nodes = [
- rviz_node,
- robot_state_publisher_node,
- joint_state_publisher_gui
-
- ]
-
- return LaunchDescription(nodes)
-
|