How to source carla ros bridge 0.9.7 with another python3 ros package?

asked 2020-07-30 08:47:33 -0500

jester gravatar image

I have a workspace where I have run a Python3 code.

import tf
>>> impport tf
File "<stdin>", line 1
impport tf


       ^
SyntaxError: invalid syntax
>>> import tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 38, in <module>
from tf2_py import *
File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>
from ._tf2 import *
ImportError: dynamic module does not define module export function (PyInit__tf2)

I found a way how to install tf for python3 (https://answers.ros.org/question/3262...) So I added these nodes to my current ws:

sudo apt install python3-catkin-pkg-modules python3-rospkg-modules python3-empy

 cd ~/current_ws
catkin_make
source devel/setup.bash
wstool init
wstool set -y src/geometry2 --git https://github.com/ros/geometry2 -v 0.6.5
wstool up
rosdep install --from-paths src --ignore-src -y -r

I installed the CARLA ROS bridge via https://github.com/carla-simulator/ro...

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 81061A1A042F527D &&
sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-ros-bridge-melodic/ bionic main"
sudo apt update &&
sudo apt install carla-ros-bridge-melodic

At the end I sourced both repositories:

source /opt/carla-ros-bridge/melodic/setup.bash
source ~/current_ws/devel/setup.bash

I cannot start the carla ros bridge with

roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch

-->Error: carla_ros_bridge not found

How to solve this?

edit retag flag offensive close merge delete