ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
It seems I made a simple mistake, I couldnt find the joint state publisher for foxy for some reason but after following an example of how to use it here , it seems I wasn confusing ROS1 xml with ros2 python. I made a small revision to the joint_state_publisher node and it launches properly and the robot_state_publisher node listents to it without issue:
#!/usr/bin/env python3
import os
import sys
from ament_index_python.packages import get_package_share_directory
import launch
import launch_ros.actions
def generate_launch_description():
# Load the URDF into a parameter
bringup_dir = get_package_share_directory('urdfpublisher')
urdf_path = os.path.join(bringup_dir, 'urdf', 'doggo.urdf')
urdf = open(urdf_path).read()
return launch.LaunchDescription([
launch_ros.actions.Node(
name='robot_state_publisher',
package='robot_state_publisher',
executable='robot_state_publisher',
parameters=[{'robot_description': urdf}],
),
launch_ros.actions.Node(
package='joint_state_publisher',
executable='joint_state_publisher',
arguments=(urdf_path),
),
])
def main(argv=sys.argv[1:]):
rospy.init_node('joint_state_publisher_gui')
"""Run lifecycle nodes via launch."""
ld = generate_launch_description()
ls = launch.LaunchService(argv=argv)
ls.include_launch_description(ld)
return ls.run()
if __name__ == '__main__':
main()
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [30524]
[INFO] [joint_state_publisher-2]: process started with pid [30526]
[robot_state_publisher-1] Parsing robot urdf xml string.
[robot_state_publisher-1] Link body_link had 0 children
[robot_state_publisher-1] [INFO] [1595439722.097627686] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1595439722.097767815] [robot_state_publisher]: got segment body_link