ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Assuming you're using xacro
, one can do something like
from amenx_index_python import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import Command
from launch_ros.actions import Node
import os
def generate_launch_description():
my_xacro = os.path.join(
get_package_share_directory("PKG_NAME"),
"urdf",
"ROBOT_NAME.urdf.xacro",
)
return LaunchDescription(
[
Node(
package="joint_state_publisher",
executable="joint_state_publisher",
name="joint_state_publisher",
),
Node(
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
output="screen",
parameters=[
{
"robot_description": Command(["xacro", " ", my_xacro]),
}
],
),
]
)
Of course it is hard to know what your problem is without knowing more regarding the error output.
Note: this code was taken from a foxy pkg running on ubuntu 20.04.
2 | No.2 Revision |
Assuming you're using xacro
, one can do something like
from amenx_index_python import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import Command
from launch_ros.actions import Node
import os
def generate_launch_description():
my_xacro = os.path.join(
get_package_share_directory("PKG_NAME"),
"urdf",
"ROBOT_NAME.urdf.xacro",
)
return LaunchDescription(
[
Node(
package="joint_state_publisher",
executable="joint_state_publisher",
name="joint_state_publisher",
),
Node(
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
output="screen",
parameters=[
{
"robot_description": Command(["xacro", " ", my_xacro]),
}
],
),
]
)
Of course it is hard to know what your problem is without knowing more regarding the error output.
Note: this code was taken from a foxy pkg running on ubuntu 20.04.