Rviz2_common and rviz2_default_plugins not found error in "How to visualize sensor data in ROS2" live class rosject

Hello
I am trying to work on “How to visualize sensor data in ROS2” live class rosject.
I was following all the instructions but there is rospack error that rviz2_common and rviz2_default_plugins not found.
I also tried sourcing setup.bash again but is didnt work.
I was able to start gazebo and rviz solo while running roscore on other terminal but rviz2 cannot be operated solo also.
The rosject is in ROS2 dashing
When I run apt-cache policy ros-dashing-rviz2, it shows normally but when I run rospack find rviz2, I was not able to find rviz2
Here is the error message when I do ros2 launch my_package simulation.launch.py

user:~/ros2_ws$ ros2 launch my_package simulation.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2023-12-07-06-38-19-490980-3_xterm-27365
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [27393]
[INFO] [gzclient -2]: process started with pid [27394]
[INFO] [dolly_follow-3]: process started with pid [27395]
[INFO] [rviz2-4]: process started with pid [27396]
[gzclient -2] ++ ls /usr/bin/gzclient-9.0.0
[gzclient -2] + gzclient_path=/usr/bin/gzclient-9.0.0
[gzclient -2] + DISPLAY=:2
[gzclient -2] + /usr/bin/gzclient-9.0.0
[rviz2-4] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-user’
[rviz2-4] [rospack] Error: package ‘rviz_common’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] [rospack] Error: package ‘rviz_common’ not found
[rviz2-4] [librospack]: error while executing command
[gzserver-1] gzserver: symbol lookup error: /opt/ros/dashing/lib/libgazebo_ros_init.so: undefined symbol: _ZN10gazebo_ros9ThrottlerC1Ed
[ERROR] [gzserver-1]: process has died [pid 27393, exit code 127, cmd 'gzserver /home/user/ros2_ws/install/dolly_gazebo/share/dolly_gazebo/worlds/dolly_empty.world -s libgazebo_ros_init.so -s libgazebo_ros_factory.so '].
[rviz2-4] [rospack] Error: package ‘rviz_common’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] [rospack] Error: package ‘rviz_default_plugins’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] [rospack] Error: package ‘rviz_default_plugins’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] [rospack] Error: package ‘rviz_common’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] [rospack] Error: package ‘rviz_common’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] [rospack] Error: package ‘rviz_common’ not found
[rviz2-4] [librospack]: error while executing command
[rviz2-4] /opt/ros/dashing/lib/rviz2/rviz2: symbol lookup error: /opt/ros/dashing/lib/librviz_common.so: undefined symbol: _ZNK12class_loader23MultiLibraryClassLoader27getAllAvailableClassLoadersEv
[ERROR] [rviz2-4]: process has died [pid 27396, exit code 127, cmd ‘/opt/ros/dashing/lib/rviz2/rviz2’].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[dolly_follow-3] [INFO] [rclcpp]: signal_handler(signal_value=2)
[ERROR] [gzclient -2]: process has died [pid 27394, exit code -2, cmd 'gzclient '].
[INFO] [dolly_follow-3]: process has finished cleanly [pid 27395]

Please help, thank you

Hi, can you post your launch file , if possible . So as to further help you out. You working with ROS 2 . So no ros master “roscore” is needed. Try open a new terminal and cd into the workspace , source the workspace , make sure your workspace is built properly and relaunch the node again. You could also source the distro version of ros 2 and try all the commands. Since you working with dashing .

  • source /opt/ros/dashing/setup.bash

Regards,

Davies.O

I’ve already tried sourcing ROS and ws and it didnt work.
I also tried deleting and reinstalling the rosject itself.
here is the launch file

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Launch Gazebo with a world that has Dolly, as well as the follow node."""

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.substitutions import ThisLaunchFileDir


def generate_launch_description():

    pkg_gazebo_ros = get_package_share_directory('gazebo_ros')
    pkg_dolly_gazebo = get_package_share_directory('dolly_gazebo')
    pkg_my_package = get_package_share_directory('my_package')

    # Gazebo launch
    gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(pkg_gazebo_ros, 'launch', 'gazebo.launch.py'),
        )
    )

    # Follow node
    follow = Node(
        package='my_package',
        node_executable='dolly_follow',
        output='screen',
        remappings=[
            ('cmd_vel', '/dolly/cmd_vel'),
            ('laser_scan', '/dolly/laser_scan')
        ]
    )

    # RViz
    rviz = Node(
        package='rviz2',
        node_executable='rviz2',
        condition=IfCondition(LaunchConfiguration('rviz'))
    )

    return LaunchDescription([
        DeclareLaunchArgument(
          'world',
          default_value=[os.path.join(pkg_dolly_gazebo, 'worlds', 'dolly_empty.world'), ''],
          description='SDF world file'),
          DeclareLaunchArgument('rviz', default_value='true',
                              description='Open RViz.'),

        gazebo,
        follow,
        rviz

    ])

I think it may be problem of rosject itself

Hi @sappari00 ,

I had spent some time trying the “How to visualize sensor data in ROS2” live class rosject myself and I found myself having the same issue as you.

I had chanced upon a similar problem via this post Rviz_common not found while launching rviz2

It appears that this rosject ros 2 might be using the Crystal distro instead of dashing.

After I source crystal distro, I was able to run the launch file without the problem that you had mentioned:
source /opt/ros/crystal/setup.bash

Hopefully this answer solves your problem.

Regards,
Jing Jie

Thanks! that helped for me.
Since they wrote that the rosject was using dashing, I had no idea that I had to source crystal.
Thank you for your help

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.