Manipulation unit3: Action client ends up w/ "undefined symbol: rosidl double__Sequence__are_equal"

ros2 action send_goal /find_objects grasping_msgs/action/FindGraspableObjects "{plan_grasps: false}"

The above call often endes up throwing:

$ ros2 action send_goal /find_objects grasping_msgs/action/FindGraspableObjects "{plan_grasps: false}"
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/libstd_msgs__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 "/opt/ros/foxy/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.9.9', 'console_scripts', 'ros2')()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2action/command/action.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2action/verb/send_goal.py", line 54, in main
    return send_goal(args.action_name, args.action_type, args.goal, feedback_callback)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2action/verb/send_goal.py", line 95, in send_goal
    action_client = ActionClient(node, action_module, action_name)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/action/client.py", line 148, in __init__
    check_for_type_support(action_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/grasping_msgs/action/_find_graspable_objects.py", line 1221, in __import_type_support__
    module = import_type_support('grasping_msgs')
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_support
    raise UnsupportedTypeSupport(pkg_name)
rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'grasping_msgs'
Exception ignored in: <function ActionClient.__del__ at 0x7f5c273a7ee0>
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/action/client.py", line 596, in __del__
    self.destroy()
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/action/client.py", line 587, in destroy
    if self._client_handle is None:
AttributeError: 'ActionClient' object has no attribute '_client_handle'

After many searching incl. answers.ros.org#326008 and get-help.robotigniteacademy.com#19026, I tried adding stuff suggested in those threads to grasping_msgs/CMakeLists.txt (and rm -fr build install && colcon build) but I kept getting the same error.

Only workaround I’ve found so far is to wait for a few hours then I find all the running processes seemingly reset (rationale: bash history being refreshed), then it works…

Is there something that remains on the running processes that does bad stuff? Does something kept in ROS1’s rosmaster do the harm?

This workaround is ok to me, but I don’t want to miss bigger issue kept uncovered.

Also, regarding unit3, why do we need geometry2 and perception_pcl to be built from source? Were those not available in ROS2 when the tutorial was written? Those stuff add 3+ minutes to colcon build.

Hi @iisaac.saito ,

One usually gets this error when the CMakeLists.txt misses out some dependency package.

If you can post your CMakeLists.txt file, perhaps I can point you to a solution.

Regards,
Girish

As I said, I’ve tried a few things regarding CMakeLists.txt that are suggested in public and private forums I listed in my post, but the result didn’t change by that. Anyways, here it is – it’s unchanged from what you get by following the unit3 tutorial.

user:~/ros2_ws/src/perception_ros2/grasping_msgs$ more CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(grasping_msgs)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rosidl_default_runtime REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(moveit_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(shape_msgs REQUIRED)

rosidl_generate_interfaces(
  ${PROJECT_NAME}
    "action/FindGraspableObjects.action"
    "action/GraspPlanning.action"
    "msg/GraspableObject.msg"
    "msg/Object.msg"
    "msg/ObjectProperty.msg"
  DEPENDENCIES
    geometry_msgs
    moveit_msgs
    sensor_msgs
    shape_msgs
)

ament_export_dependencies(rosidl_default_runtime)
ament_package()

I’ve also tried adding:

find_package(std_msgs REQUIRED)

rosidl_generate_interfaces(
  :

  DEPENDENCIES
    :
    std_msgs

Also in package.xml:

  <depend>std_msgs</depend>

Hi @iisaac.saito ,

I went through the package and their contents. I also noted that std_msgs must be added to grasping_msgs package. You are right on that thought. I guess you should be fine after this change.

To avoid that error, you can first compile grasping_msgs package and then run the corresponding package to start the action server.
I guess the order would be as follows:

source /opt/ros/foxy/setup.bash
cd ~/ros2_ws
rm -rf ./build ./install ./log
colcon build
source install/setup.bash
ros2 run simple_grasping basic_grasping_perception_node --ros-args -p debug_topics:=true

# In another shell
ros2 action send_goal /find_objects grasping_msgs/action/FindGraspableObjects "{plan_grasps: false}"

Try this. This should probably work. Let me know what happens.

Regards,
Girish