RQT doesn't work with ROS2 and asks for a roscore

asked 2021-05-26 10:26:24 -0500

max11gen gravatar image

When I follow the foxy tutorials on turtlesim, I struggle to get the rqt gui to work. In the tutorial the instructions say to just run rqt from the terminal. If I do so the empty GUI pops up. But then, when I try to follow the next instruction

After running rqt the first time, the window will be blank. No worries; just select Plugins > Services > Service Caller from the menu bar at the top.

it doesn't work. I just get an error saying

Could not find ROS master. Either start a 'roscore' or abort loading the plugin.

It seems like it is trying to use ROS 1 rqt, since afaik ROS 2 does not have a roscore anymore.

However, when I run rqt by using ros2 run rqt_gui rqt_gui it behaves exactly the same.

I have installed all ros-foxy-rqt* packages with APT.

What am I doing wrong here?

edit retag flag offensive close merge delete

Comments

Do you have an existing ROS1 installation on your computer? Are you sourcing ros1 or ros2 or both? It does sound to me like your computer is trying to use ROS1 rqt...

shonigmann gravatar image shonigmann  ( 2021-05-26 19:15:07 -0500 )edit

@shonigmann I do have a noetic installation. And as I said, I also think, that my computer is trying to use ROS1 rqt, I just don't know why. I source only Foxy, I didn't source Noetic anywhere

max11gen gravatar image max11gen  ( 2021-05-27 02:16:54 -0500 )edit

However, I just realized that there is some strange behaviour regarding ROS1. I didn't source Noetic anywhere as I said, but when I try to use roscore it works even though it shouldn't, right? It starts a roscore and then tells me /ros_distro: foxy /rosversion: 1.15.10. How does this happen? I really didn't source Noetic distro nor my catkin_ws in my .bashrc or manually or anything. Can it be sourced from somewhere else? Is there any way to check, which files have been sourced?

max11gen gravatar image max11gen  ( 2021-05-27 02:31:33 -0500 )edit

Did you perhaps add sourcing Noetic to your .bashrc?

How did you install ROS1? There are also ROS1 packages in the regular Ubuntu repositories (e.g. https://packages.ubuntu.com/focal/ros...) that install themselves in locations like /usr/bin which are searched by default / without any additional configuretion.

Mbuijs gravatar image Mbuijs  ( 2021-05-27 05:24:44 -0500 )edit

@Mbuijs No, I didn't source Noetic in my .bashrc. Well, I usually do, but I had commented that out before asking this question ;) I installed Noetic with APT, too. But when I do ls /usr/bin | grep ros, I only find rosdep, rosdistro_*, rosinstall_generator and rosversion. No roscore or such.

max11gen gravatar image max11gen  ( 2021-05-27 05:36:00 -0500 )edit

Just to be sure: after editing .bashrc, you did open a new shell, right? .bashrc is sources at startup of bash, the easiest way to have changes applied is by opening a new shell. You can double check using printenv | grep ROS. (copied from http://wiki.ros.org/ROS/Tutorials/Ins...)

Mbuijs gravatar image Mbuijs  ( 2021-05-27 06:06:01 -0500 )edit

Yes, I reopened approximately a million of shells trying to get it to work :D

max11gen gravatar image max11gen  ( 2021-05-27 06:08:04 -0500 )edit

Hm... There's definitely something strange here. I suspect some python nonsense. Could you please edit your question and add the output of the following? 1. echo $ROS_DISTRO, 2. echo $ROS_VERSION, 3. ls -l $(which roscore), 4. ls -l $(which rqt)

allenh1 gravatar image allenh1  ( 2021-05-28 09:49:27 -0500 )edit