0
$\begingroup$

Rosanswers logo

I use ROS2 Dashing on ubuntu 18.04 64bits.

I run:

sam@sam-ub1804:~/ros2_overlay_ws$ ros2 launch sam_create_urdf_box_shown_with_rviz2 robot_state_publisher.launch.py
[INFO] [launch]: All log files can be found below /home/sam/.ros/log/2019-12-10-19-12-32-653587-sam-ub1804-5493
[INFO] [launch]: Default logging verbosity is set to INFO
urdf_file_name : sam_box_robot.urdf
[INFO] [robot_state_publisher-1]: process started with pid [5513]
[robot_state_publisher-1] Initialize urdf model from file: /home/sam/ros2_dashing_overlay_ws/install/sam_create_urdf_box_shown_with_rviz2/share/sam_create_urdf_box_shown_with_rviz2/urdf/sam_box_robot.urdf
[robot_state_publisher-1] Parsing robot urdf xml string.
[robot_state_publisher-1] got segment base_link

and

sam@sam-ub1804:~/ros2_dashing_overlay_ws$ ros2 launch sam_create_urdf_box_shown_with_rviz2 rviz2.launch.py
[INFO] [launch]: All log files can be found below /home/sam/.ros/log/2019-12-10-19-12-39-826543-sam-ub1804-5520
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rviz2-1]: process started with pid [5540]
[rviz2-1] Fontconfig warning: "/etc/fonts/conf.d/41-arphic-ukai.conf", line 16: Having multiple <family> in <alias> isn't supported and may not work as expected
[rviz2-1] Fontconfig warning: "/etc/fonts/conf.d/41-arphic-ukai.conf", line 16: Having multiple <family> in <alias> isn't supported and may not work as expected
[rviz2-1] Fontconfig warning: "/etc/fonts/conf.d/41-arphic-ukai.conf", line 16: Having multiple <family> in <alias> isn't supported and may not work as expected
[rviz2-1] Fontconfig warning: "/etc/fonts/conf.d/41-arphic-ukai.conf", line 16: Having multiple <family> in <alias> isn't supported and may not work as expected
[rviz2-1] Fontconfig warning: "/etc/fonts/conf.d/41-arphic-ukai.conf", line 16: Having multiple <family> in <alias> isn't supported and may not work as expected

successfully.

However, Rviz2 could not show my urdf file with RobotModel. It says: No tf data. Actual error: Frame [base_link] does not exist

I tried to add joint_state_publisher.launch.py as previously I do in robot_state_publisher.launch.py, just change the name from robot to joint. But it says : package 'joint_state_publisher' not found

What could I do?

How to install joint_state_publisher and write its launch.py? Or how to solve this problem?

My joint_state_publisher.launch.py

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
    use_sim_time = LaunchConfiguration('use_sim_time', default='false')
    urdf_file_name = 'sam_box_robot.urdf'

    print('urdf_file_name : {}'.format(urdf_file_name))

    urdf = os.path.join(
        get_package_share_directory('sam_create_urdf_box_shown_with_rviz2'),
        'urdf',
        urdf_file_name)

    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),

        Node(
            package='joint_state_publisher',
            node_executable='joint_state_publisher',
            node_name='joint_state_publisher',
            output='screen',
            parameters=[{'use_sim_time': use_sim_time}],
            arguments=[urdf]),
    ])

Thank you~


Originally posted by sam on ROS Answers with karma: 2570 on 2019-12-10

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Finally, I solve it my myself. Than answer is I use the following code to replace joint_state_publisher:

    Node(package='dummy_sensors', node_executable='dummy_joint_states', output='screen'),

Originally posted by sam with karma: 2570 on 2019-12-11

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.