UniversalRobots / Universal_Robots_ROS2_Gazebo_Simulation

BSD 3-Clause "New" or "Revised" License
54 stars 24 forks source link

Doesn't work on Galactic #15

Closed prasuchit closed 2 years ago

prasuchit commented 2 years ago

Hi,

I just compiled the package successfully and ran this command:

ros2 launch ur_simulation_gazebo ur_sim_control.launch.py

Ended up with a lot of errors starting with an import error.

[spawn_entity.py-6]   warnings.warn(
[spawn_entity.py-6] Traceback (most recent call last):
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/python3.8/site-packages/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support
[spawn_entity.py-6]     return importlib.import_module(module_name, package=pkg_name)
[spawn_entity.py-6]   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
[spawn_entity.py-6]     return _bootstrap._gcd_import(name[level:], package, level)
[spawn_entity.py-6]   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
[spawn_entity.py-6]   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
[spawn_entity.py-6]   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
[spawn_entity.py-6]   File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
[spawn_entity.py-6]   File "<frozen importlib._bootstrap>", line 556, in module_from_spec
[spawn_entity.py-6]   File "<frozen importlib._bootstrap_external>", line 1166, in create_module
[spawn_entity.py-6]   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[spawn_entity.py-6] ImportError: /opt/ros/galactic/lib/libgazebo_msgs__rosidl_generator_c.so: undefined symbol: geometry_msgs__msg__Vector3__Sequence__are_equal
[spawn_entity.py-6] 
[spawn_entity.py-6] During handling of the above exception, another exception occurred:
[spawn_entity.py-6] 
[spawn_entity.py-6] Traceback (most recent call last):
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/gazebo_ros/spawn_entity.py", line 365, in <module>
[spawn_entity.py-6]     main()
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/gazebo_ros/spawn_entity.py", line 360, in main
[spawn_entity.py-6]     exit_code = spawn_entity_node.run()
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/gazebo_ros/spawn_entity.py", line 223, in run
[spawn_entity.py-6]     success = self._spawn_entity(entity_xml, initial_pose, self.args.spawn_service_timeout)
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/gazebo_ros/spawn_entity.py", line 270, in _spawn_entity
[spawn_entity.py-6]     client = self.create_client(SpawnEntity, '%s/spawn_entity' % self.args.gazebo_namespace)
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/node.py", line 1407, in create_client
[spawn_entity.py-6]     check_is_valid_srv_type(srv_type)
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/type_support.py", line 51, in check_is_valid_srv_type
[spawn_entity.py-6]     check_for_type_support(srv_type)
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/type_support.py", line 29, in check_for_type_support
[spawn_entity.py-6]     msg_or_srv_type.__class__.__import_type_support__()
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/python3.8/site-packages/gazebo_msgs/srv/_spawn_entity.py", line 355, in __import_type_support__
[spawn_entity.py-6]     module = import_type_support('gazebo_msgs')
[spawn_entity.py-6]   File "/opt/ros/galactic/lib/python3.8/site-packages/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_support
[spawn_entity.py-6]     raise UnsupportedTypeSupport(pkg_name)
[spawn_entity.py-6] rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'gazebo_msgs'
[ERROR] [spawn_entity.py-6]: process has died [pid 3073, exit code 1, cmd '/opt/ros/galactic/lib/gazebo_ros/spawn_entity.py -entity ur -topic robot_description --ros-args -r __node:=spawn_ur'].

Kindly help. Thanks.

prasuchit commented 2 years ago

I was finally able to fix it!

For anyone else facing this problem, I'm running within a docker and after a lot of research online, I found that doing

sudo apt-get dist-upgrade

inside the docker then, exiting the docker env and doing a

docker-compose down && docker-compose up -d

launch the docker env again and inside, do:

sudo apt-get update

updated a ton of packages and fixed the above error for me.