How to install joint_state_publisher on my computer

Hi! I’ve tried to visualize urdf model in rviz2 on my computer as it is written in tutorial. However, there is not explained how to install joint state publisher. I tried some commands but they weren’t useful. Can somebody send a reliable way to install this package?

Hello @Jef ,

The easiest way would be to install it through the binaries:

sudo apt update
sudo apt install ros-humble-joint-state-publisher

Thank you. Should I install it in my home directory or in a specific ros2 workspace which I use for my projects?

Hi @Jef ,

Welcome to this Community!

You do not have to install it in a specific directory or workspace. sudo apt install ... command will install the respective packages on the Linux system as a whole. It will be installed in the appropriate installation directories. You do not have to worry about where to install it.

Just run the two commands stated above on a Linux Terminal.
Also, ros2-humble version does not work with Ubuntu 20.04. It works only with Ubuntu 22.04. So if you are using any LXD emulator to run ros2-humble on your computer, you must make sure you have the emulator running before you proceed with the installation.

Hope this helps.

Regards,
Girish

Your advice have been helpful and I managed to install it. But, when I try to run command
ros2 run joint_state_publisher_gui joint_state_publisher_gui it says that package joint_state_publisher_gui isn’t found.

Hi @Jef ,

I guess you are forgetting to source your ROS2 workspace.

Try doing this:

source /opt/ros/humble/setup.bash
source <your_path_to_ros2_ws>/install/setup.bash # (optional)
ros2 run joint_state_publisher_gui joint_state_publisher_gui

Let us know if you got it working or not.

Regards,
Girish

I haven’t forgotten to source my workspace. When I want to run publisher it only recognize joint_state_publisher but not joint_state_publisher_gui
When I did your steps, No executable found is written on terminal.

I think I’ve found the solution. The pkg joint_state_publisher_gui wasn’t intsalled instantly with joint_state_publisher.
sudo apt install ros-humble-joint-state-publisher-gui

Thank everyone for help!

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