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

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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-05 23:23:47 -0500

Josh Whitley gravatar image

By default, workspaces overlay /opt/ros/<version> so sourcing the second workspace is overwriting the first. Add --extend to your second source command and this should work. See this tutorial for more information.

PS: you shouldn't need to clone the source for tf as it can be installed as a binary package with sudo apt-get install ros-melodic-tf.

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 759 times

Last updated: Aug 05 '20