flynneva / bno055

ROS2 driver for Bosch BNO055 using UART or I2C
https://flynneva.github.io/bno055/
BSD 3-Clause "New" or "Revised" License
85 stars 50 forks source link

Could not import 'rosidl_typesupport_c' for package 'example_interfaces' #47

Closed Scoeerg closed 1 year ago

Scoeerg commented 1 year ago

Hey,

given the following structure on my Raspberry Pi 4b running Ubuntu 20.04 Server

myworkspace
└── install
└── log
└── build
└── src
    └── bno055

and

cd $myworkspace
source /opt/ros/foxy/setup.bash
colcon build --packages-select bno055
source install/local_setup.bash
ros2 run bno055 bno055 --ros-args --params-file ./src/bno055/bno055/params/bno055_params.yaml

gives me the following error

Traceback (most recent call last):
  File "myworkspace/install/bno055/lib/bno055/bno055", line 11, in <module>
    load_entry_point('bno055==0.3.0', 'console_scripts', 'bno055')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "myworkspace/install/bno055/lib/python3.8/site-packages/bno055/bno055.py", line 37, in <module>
    from bno055.sensor.SensorService import SensorService
  File "myworkspace/install/bno055/lib/python3.8/site-packages/bno055/sensor/SensorService.py", line 43, in <module>
    from example_interfaces.srv import Trigger
ModuleNotFoundError: No module named 'example_interfaces'

Could someone replicate the error? Any advice? example_interfaces is a standard ROS2 package given by the ROS2 developers, e.g. used in their tutorials, too: see Writing A Simple Py Service And Client.

The bno055/package.xml looks fine, including as <exec_depend>example_interfaces</exec_depend>, which I would normally do as <depend>example_interfaces</depend>, but colcon says it's redundant.

github-actions[bot] commented 1 year ago

Thank you for creating your first issue on this repo! Give me some time to review and respond to your problem.

Scoeerg commented 1 year ago

Hi all,

my bad. Given the above structure, you must first install the dependencies using

cd $myworkspace
rosdep install --from-paths src -i

and the error is gone (trivial, yet might be worth adding to the readme).

cd $myworkspace
source /opt/ros/foxy/setup.bash
colcon build --packages-select bno055
source install/local_setup.bash
ros2 run bno055 bno055 --ros-args --params-file ./src/bno055/bno055/params/bno055_params.yaml

now results in

[INFO] [1666777840.226571880] [bno055]: Initializing parameters
[INFO] [1666777840.239891781] [bno055]: Parameters set to:
[INFO] [1666777840.241792409] [bno055]:     ros_topic_prefix:   "bno055/"
[INFO] [1666777840.243572059] [bno055]:     connection_type:    "uart"
[INFO] [1666777840.245370338] [bno055]:     uart_port:      "/dev/ttyUSB0"
[INFO] [1666777840.247153987] [bno055]:     uart_baudrate:      "115200"
[INFO] [1666777840.248950914] [bno055]:     uart_timeout:       "0.1"
[INFO] [1666777840.250702435] [bno055]:     frame_id:       "bno055"
[INFO] [1666777840.252489473] [bno055]:     data_query_frequency:   "100"
[INFO] [1666777840.254238864] [bno055]:     calib_status_frequency: "0.1"
[INFO] [1666777840.255990403] [bno055]:     operation_mode:     "12"
[INFO] [1666777840.257744794] [bno055]:     placement_axis_remap:   "P2"
[INFO] [1666777840.259478408] [bno055]:     acc_factor:     "100.0"
[INFO] [1666777840.261241391] [bno055]:     mag_factor:     "16000000.0"
[INFO] [1666777840.262973301] [bno055]:     gyr_factor:     "900.0"
[INFO] [1666777840.264727636] [bno055]:     set_offsets:        "False"
[INFO] [1666777840.266461509] [bno055]:     offset_acc:     "[65516, 165, 65512]"
[INFO] [1666777840.268199715] [bno055]:     radius_acc:     "1000"
[INFO] [1666777840.269983550] [bno055]:     offset_mag:     "[65460, 65182, 637]"
[INFO] [1666777840.271717089] [bno055]:     radius_mag:     "0"
[INFO] [1666777840.273476295] [bno055]:     offset_gyr:     "[2, 65535, 65535]"
[INFO] [1666777840.275228260] [bno055]:     variance_acc:       "[0.017, 0.017, 0.017]"
[INFO] [1666777840.276990003] [bno055]:     variance_angular_vel:   "[0.04, 0.04, 0.04]"
[INFO] [1666777840.278765615] [bno055]:     variance_orientation:   "[0.0159, 0.0159, 0.0159]"
[INFO] [1666777840.280537135] [bno055]:     variance_mag:       "[0.0, 0.0, 0.0]"
[INFO] [1666777840.282626520] [bno055]: Opening serial port: "/dev/ttyUSB0"...
[INFO] [1666777840.345960588] [bno055]: ROS node shutdown
[INFO] [1666777840.347831143] [bno055]: No timers to shutdown
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support
    return importlib.import_module(module_name, package=pkg_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 556, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1166, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /opt/ros/foxy/lib/libexample_interfaces__rosidl_generator_c.so: undefined symbol: rosidl_runtime_c__double__Sequence__are_equal

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "myworkspace/install/bno055/lib/bno055/bno055", line 11, in <module>
    load_entry_point('bno055==0.3.0', 'console_scripts', 'bno055')()
  File "myworkspace/install/bno055/lib/python3.8/site-packages/bno055/bno055.py", line 93, in main
    node.setup()
  File "myworkspace/install/bno055/lib/python3.8/site-packages/bno055/bno055.py", line 79, in setup
    self.sensor = SensorService(self, connector, self.param)
  File "myworkspace/install/bno055/lib/python3.8/site-packages/bno055/sensor/SensorService.py", line 63, in __init__
    self.srv = self.node.create_service(Trigger, prefix + 'calibration_request', self.calibration_request_callback)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1296, in create_service
    check_for_type_support(srv_type)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/type_support.py", line 29, in check_for_type_support
    msg_type.__class__.__import_type_support__()
  File "/opt/ros/foxy/lib/python3.8/site-packages/example_interfaces/srv/_trigger.py", line 254, in __import_type_support__
    module = import_type_support('example_interfaces')
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_supportsudo apt install ros-foxy-rosidl-typesupport-c
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  ros-foxy-rosidl-typesupport-connext-c
The following packages will be upgraded:
  ros-foxy-rosidl-typesupport-c
1 upgraded, 0 newly installed, 0 to remove and 189 not upgraded.
Need to get 21.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://packages.ros.org/ros2/ubuntu focal/main arm64 ros-foxy-rosidl-typesupport-c arm64 1.0.2-1focal.20221012.220614 [21.6 kB]
Fetched 21.6 kB in 1s (40.6 kB/s)                        
(Reading database ... 142619 files and directories currently installed.)
Preparing to unpack .../ros-foxy-rosidl-typesupport-c_1.0.2-1focal.20221012.220614_arm64.deb ...
Unpacking ros-foxy-rosidl-typesupport-c (1.0.2-1focal.20221012.220614) over (1.0.2-1focal.20220115.051647) ...
Setting up ros-foxy-rosidl-typesupport-c (1.0.2-1focal.20221012.220614) ...

    raise UnsupportedTypeSupport(pkg_name)
rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'example_interfaces'

UPDATE: it works fine on my desktop.

Scoeerg commented 1 year ago

Ok. Now, based on this ROS2 Git Issue one should run

apt-get dist-upgrade

which fixed the error! Thank you for reading everybody, I hope it helpes someone else in the future.