ros / ros_comm_msgs

5 stars 23 forks source link

ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' #13

Closed clebio closed 3 years ago

clebio commented 3 years ago

On a new install of Foxy Fitzroy on Ubuntu Focal, I was trying to run roslaunch gazebo_simulation_scene gazebo_simulation_scene.launch. However, that fails with the titular error message. To simply this further, just trying to import roslaunch does the same:

$ python -c 'import roslaunch'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/roslaunch/__init__.py", line 62, in <module>
    from .scriptapi import ROSLaunch
  File "/usr/lib/python3/dist-packages/roslaunch/scriptapi.py", line 42, in <module>
    import roslaunch.parent
  File "/usr/lib/python3/dist-packages/roslaunch/parent.py", line 54, in <module>
    import roslaunch.server
  File "/usr/lib/python3/dist-packages/roslaunch/server.py", line 79, in <module>
    from rosgraph_msgs.msg import Log
ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' (/opt/ros/foxy/lib/python3.8/site-packages/rosgraph_msgs/msg/__init__.py)

This is on a new ROS setup on Ubuntu:

$ printenv | grep ROS
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=foxy

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ python -V
Python 3.8.5
kmindspark commented 3 years ago

Same issue here, is there a solution to this?

colian commented 3 years ago

Looking forward the answer too.

EthanCodesss commented 3 years ago

Same issue!!

JesseSarria commented 3 years ago

Similar issue here, but on eloquent.

NazarK0 commented 3 years ago

similar issue, but on Galactic

Udaykiran87 commented 3 years ago

did any one find answer? I am unable to play the rosbag file using ros1 bridge. When i am trying to filter out some topics then also i am not able filter out.

baharaks commented 3 years ago

Same problem with ROS Foxy.

boyarzun commented 3 years ago

Same issue with ROS Foxy.

amplexus commented 3 years ago

Same issue with ROS rolling.

keli95566 commented 3 years ago

Same problem with ROS Foxy.

hidmic commented 3 years ago

Alright, to answer everyone before closing -- though I presume you've already found out.

This repository only hosts the rosgraph_msgs package for ROS 1. The rosgraph_msgs package for ROS 2 lives in https://github.com/ros2/common_interfaces, but it doesn't hold the Log message anymore. It has been relocated to the rcl_interfaces package.

Oballon commented 3 years ago

So, how to solve this issue?

maxlu96 commented 2 years ago

roscore has been replaced in ros2, reed more here:

https://www.theconstructsim.com/ros2-in-5-mins-003-where-is-roscore-in-ros2/

whwang8 commented 2 years ago

I don't think you can use ros2 with gazebo, at least it's not the recommended version. If you look at the tutorial, it recommends ros noetic among others. Thought I'd post because I was banging my head against a while with this.

http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros

whwang8 commented 2 years ago

http://gazebosim.org/tutorials?tut=ros_wrapper_versions&cat=connect_ros

This shows which combinations of versions you can use!

maxlu96 commented 2 years ago

I don't think you can use ros2 with gazebo, at least it's not the recommended version. If you look at the tutorial, it recommends ros noetic among others. Thought I'd post because I was banging my head against a while with this.

http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros

I used ros2 foxy with Gazebo and it workes fine

t0stiman commented 2 years ago

Solution: use ros2 launch instead of roslaunch.

lisimmy commented 2 years ago

$ printenv | grep ROS ROS_VERSION=2

use ros2 xxx eg: ros2 topic list

Call ros2 <command> -h for more detailed usage.

dieter-aerit commented 1 year ago

ros2 launch rosbridge_server rosbridge_websocket_launch.xml solves it in my case.

devrajshetake commented 1 year ago

I am using ros2 launch still getting the same error.

KevinKipkorir254 commented 11 months ago

Hello found the solution Use Screenshot (21)

litouxinxin commented 4 months ago

Confirm whether your file type is .lauch or .py, and then use the ros2 lauch command to run it. ros2 launch carla_ros_bridge carla_ros_bridge.launch.py.