ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

error "from tf2_msgs.srv ImportError: No module named srv "

asked 2021-01-31 17:35:58 -0500

mateusguilherme gravatar image

updated 2021-01-31 20:48:37 -0500

Hello

I am getting the following error:

Traceback (most recent call last):
  File "/home/pi/catkin_ws/src/auto_docking/scripts/autoDocking.py", line 17, in <module>
    from tf.transformations import quaternion_from_euler
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf/__init__.py", line 30, in <module>
    from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 40, in <module>
    from .buffer import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/buffer.py", line 34, in <module>
    from tf2_msgs.srv import FrameGraph, FrameGraphResponse
ImportError: No module named srv

It seems that my ros has lost some tf2 library but I don't know how to reinstall it. I'm wearing a pi with raspibian and Ros Melodic

the problem appears to have arisen after I copied this package (https://github.com/ros/geometry2) to my catkin workspace and run "catkin make" which resulted in failure. Or the problem arose after I ran the command "sudo apt-get install ros-tf2-msgs" and then "sudo apt-get purge ros-tf2-msgs". It was the only different things I did

any suggestion?

thanks

edit retag flag offensive close merge delete

Comments

Have you tried sudo apt install --reinstall ros-melodic-tf2-msgs?

gvdhoorn gravatar image gvdhoorn  ( 2021-02-01 03:17:57 -0500 )edit

the command "sudo apt install --reinstall ros-melodic-tf2-msgs" resulted in "Unable to locate package ros-melodic-tf2-msgs". So I ran the command "sudo apt install --reinstall ros-tf2-msgs" but the problem persisted.

mateusguilherme gravatar image mateusguilherme  ( 2021-02-01 06:44:48 -0500 )edit

the command "sudo apt install --reinstall ros-melodic-tf2-msgs" resulted in "Unable to locate package ros-melodic-tf2-msgs"

that package does exists, I just verified it the command in a Docker container. How did you install Melodic?

So I ran the command "sudo apt install --reinstall ros-tf2-msgs" but the problem persisted.

That package is not part of ROS Melodic, and you really don't want to start mixing these with a regular ROS install.

See wikiUpstreamPackages.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-01 06:52:29 -0500 )edit

I installed ROS some time ago and I don't remember. Everything was working and I did something wrong. I remember I had difficulty installing ROS MELODIC on the raspibian Buster. I think I followed this installation tutorial: "https://www.hackster.io/dmitrywat/ros..."

mateusguilherme gravatar image mateusguilherme  ( 2021-02-01 07:01:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-01 09:38:45 -0500

mateusguilherme gravatar image

I discovered the problem, when I installed the package (https://github.com/ros/geometry2) unsuccessfully on my catkin workspace, a folder called "tf2_msgs" appeared in / home / pi / catkin_ws / devel / lib / python2 .7 / dist-packages with incomplete files. It was only necessary to remove it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-01-31 17:35:58 -0500

Seen: 905 times

Last updated: Feb 01 '21