1

I am using an Adafruit Ultimate breakout GPS USB. https://www.adafruit.com/product/4279?gclid=Cj0KCQjwssyJBhDXARIsAK98ITTDdKhCzX3KkFkdfPbXoeVsUwJXsmBFKA08icBE94jmvCzC7N6u3xEaAgeQEALw_wcB I installed the required libraries in both ROS and python and built the Catkin_make but I am getting errors while running. Any help is appreciated. My environment is Jetson AGX Ubuntu 18.04

bot@bot-desktop:~$ stty -F /dev/ttyUSB0
speed 115200 baud; line = 0;
-brkint -imaxbel
bot@bot-desktop:~$ rosrun nmea_navsat_driver nmea_serial_driver _port:=/dev/ttyUSB0 _baud:=115200
Traceback (most recent call last):
  File "/home/bot/catkin_ws/src/nmea_navsat_driver/scripts/nmea_serial_driver", line 35, in <module>
    import libnmea_navsat_driver.nodes.nmea_serial_driver
  File "/home/bot/catkin_ws/src/nmea_navsat_driver/src/libnmea_navsat_driver/nodes/nmea_serial_driver.py", line 40, in <module>
    from libnmea_navsat_driver.driver import RosNMEADriver
  File "/home/bot/catkin_ws/src/nmea_navsat_driver/src/libnmea_navsat_driver/driver.py", line 41, 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 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)
BlueSky
  • 41
  • 2

1 Answers1

0

Issues like this can be caused by python version problem. Within ROS this usually happens when trying to run python2 and python3 at the same time. Try changing your python scripts from #! /usr/bin/env python to #! /usr/bin/env python2.7

If you're targeting python3 make sure you are building for that specifically like so

catkin_make --cmake-args \
            -DCMAKE_BUILD_TYPE=Release \
            -DPYTHON_EXECUTABLE=/usr/bin/python3 \
            -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \
            -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
BTables
  • 4,413
  • 2
  • 11
  • 30
  • It still did not work as expected. I added #! /usr/bin/env python2.7 in this script /home/bot/catkin_ws/src/nmea_navsat_driver/scripts/nmea_serial_driver and run ROSRUN again and found the same error. @BTables – BlueSky Sep 08 '21 at 08:21