Discussion - Running ros2_control on a real robot (Making a Mobile Robot Pt 13)

I’ve been banging on this for some time and would appreciate any help that someone can offer. I’ve followed the update instructions for Humble to the best of my ability and can run everything in the simulated environment. The error comes when I try to run on the real robot. I get this error:

[ros2_control_node-3] [WARN] [1717166914.463673109] [controller_manager]: [Deprecated] Passing the robot description parameter directly to the control_manager node is deprecated. Use ‘~/robot_description’ topic from ‘robot_state_publisher’ instead.
[ros2_control_node-3] [INFO] [1717168386.815847187] [resource_manager]: Loading hardware ‘RealRobot’
[ros2_control_node-3] terminate called after throwing an instance of ‘pluginlib::LibraryLoadException’
[ros2_control_node-3] what(): According to the loaded plugin descriptions the class diffdrive_arduino/DiffDriveArduinoHardware with base class type hardware_interface::SystemInterface does not exist. Declared types are diffdrive_arduino/DiffDriveArduino fake_components/GenericSystem fake_robot/FakeRobot mock_components/GenericSystem test_hardware_components/TestSystemCommandModes test_hardware_components/TestTwoJointSystem

I build 4 wheel differential drive whit this tutorial, but i have problem with arduino diff drive because not supported for 4 wheel, can anyone help me?

Hi , can some one please help me out with this. Im getting this output when i run the launch_robot.launch.py (using the humble branch along with buzzology repo)

[ros2_control_node-3] [WARN] [1719424456.132014484] [controller_manager]: [Deprecated] Passing the robot description parameter directly to the control_manager node is deprecated. Use '~/robot_description' topic from 'robot_state_publisher' instead.
[ros2_control_node-3] [INFO] [1719424456.135225674] [resource_manager]: Loading hardware 'RealRobot' 
[ros2_control_node-3] terminate called after throwing an instance of 'pluginlib::LibraryLoadException'
[ros2_control_node-3]   what():  According to the loaded plugin descriptions the class diffdrive_arduino/DiffDriveArduinoHardware with base class type hardware_interface::SystemInterface does not exist. Declared types are  diffdrive_arduino/DiffDriveArduino fake_components/GenericSystem fake_robot/FakeRobot mock_components/GenericSystem test_hardware_components/TestSystemCommandModes test_hardware_components/TestTwoJointSystem
[ros2_control_node-3] Stack trace (most recent call last):
[ros2_control_node-3] #16   Object "/usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1", at 0xffffffffffffffff, in 
[ros2_control_node-3] #15   Object "/opt/ros/humble/lib/controller_manager/ros2_control_node", at 0xaaaad1ee2c6f, in 
[ros2_control_node-3] #14   Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffff95a474cb, in __libc_start_main
[ros2_control_node-3] #13   Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffff95a473fb, in 
[ros2_control_node-3] #12   Object "/opt/ros/humble/lib/controller_manager/ros2_control_node", at 0xaaaad1ee2767, in 
[ros2_control_node-3] #11   Object "/opt/ros/humble/lib/libcontroller_manager.so", at 0xffff960f24cb, in controller_manager::ControllerManager::ControllerManager(std::shared_ptr<rclcpp::Executor>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::NodeOptions const&)
[ros2_control_node-3] #10   Object "/opt/ros/humble/lib/libcontroller_manager.so", at 0xffff960ee5f7, in controller_manager::ControllerManager::init_resource_manager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[ros2_control_node-3] #9    Object "/opt/ros/humble/lib/libhardware_interface.so", at 0xffff958b7077, in hardware_interface::ResourceManager::load_urdf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool)
[ros2_control_node-3] #8    Object "/opt/ros/humble/lib/libhardware_interface.so", at 0xffff958b56ab, in 
[ros2_control_node-3] #7    Object "/opt/ros/humble/lib/libhardware_interface.so", at 0xffff958c9ef3, in 
[ros2_control_node-3] #6    Object "/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30", at 0xffff95ca2e03, in __cxa_throw
[ros2_control_node-3] #5    Object "/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30", at 0xffff95ca2b1f, in std::terminate()
[ros2_control_node-3] #4    Object "/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30", at 0xffff95ca2abb, in 
[ros2_control_node-3] #3    Object "/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30", at 0xffff95ca62db, in __gnu_cxx::__verbose_terminate_handler()
[ros2_control_node-3] #2    Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffff95a4712f, in abort
[ros2_control_node-3] #1    Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffff95a5a67b, in raise
[ros2_control_node-3] #0    Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffff95a9f200, in 
[ros2_control_node-3] Aborted (Signal sent by tkill() 10495 1000)
[ERROR] [ros2_control_node-3]: process has died [pid 10495, exit code -6, cmd '/opt/ros/humble/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_p6dnjvqp --params-file /home/rosbot/aria_ws/install/articubot_one/share/articubot_one/config/my_controllers.yaml'].

i did a topic echo and it seems like my joystick is sending input and the bot is receiving the necessary twist msg . But the bot doesn’t move can someone please help me out with this??

Hello sir,

Thank you for the great tutorials.

I am using raspberry pi 5 model and therefore I have install Ubuntu 24.04 and ROS2 rolling in my Pi. I am currently in “Using ros2_control to drive our robot” video and up to now it’s all good.

P.S. I had to go through the motor driver code in arduino nano and found out that whenever I give a motor value ( o 255 255), the corresponding pins in the arduino nano will be high for a moment and again go back to 0. Therefore I commented out line 360 to 363 on ROSArduinoBridge code. After that it worked as expected. That is something I wanted to tell if someone having a same issue as me.

When I try to build the diffdrive_arduino package I got an issue about not having base_interface.hpp in hardware interface. When I read this discussion this is because I am using a new version of ROS2. Therefore I use this link to install diffdrive_arduino package : GitHub - RedstoneGithub/diffdrive_arduino: A simple ROS Control Hardware Interface for differential drive control of robot whose motors are connected via an Arduino (or similar microcontroller). as someone mention in the discussion and it built successfully.

The problem comes when I try to control it using teleop twist keyboard.
When I launch the launhc_robot.launch.py file, it launched successfully in Pi. Then after I run teleop twist keyboard in my dev machine I got the following error.

[rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:
‘Fast CDR exception deserializing message of type rmw_dds_common::msg::dds_::ParticipantEntitiesInfo_., at ./src/type_support_common.cpp:118’
with this new error message:
‘‘Bad alloc’ exception deserializing message of type rmw_dds_common::msg::dds_::ParticipantEntitiesInfo_., at ./src/type_support_common.cpp:123’
rcutils_reset_error() should be called after error handling to avoid this.
<<<
>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

‘‘Bad alloc’ exception deserializing message of type rmw_dds_common::msg::dds_::ParticipantEntitiesInfo_., at ./src/type_support_common.cpp:123’
with this new error message:
‘Fast CDR exception deserializing message of type rmw_dds_common::msg::dds_::ParticipantEntitiesInfo_., at ./src/type_support_common.cpp:118’
rcutils_reset_error() should be called after error handling to avoid this.

I have no idea what cause this error. If someone could help me out, I really appreciate it.

Thank you

Hi, I’m having trouble trying to launch the real robot launch file, I get this error about robot_publisher. I saw someone else had the exact same problem in the past but never got a response, what can I do to fix the problem? the error in question:

[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2024-07-09-02-35-49-118585-tato-corp-3174
[INFO] [launch]: Default logging verbosity is set to INFO
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=PackageNotFoundError("package 'twist_mux' not found, searching: ['/home/ubuntu/detta_ws/install/tato_bot', '/home/ubuntu/detta_ws/install/diffdrive_arduino', '/home/ubuntu/detta_ws/install/serial', '/opt/ros/foxy']")>
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py", line 50, in get_package_prefix
    content, package_prefix = get_resource('packages', package_name)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/resources.py", line 48, in get_resource
    raise LookupError(
LookupError: Could not find the resource 'twist_mux' of type 'packages'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
    visit_all_entities_and_collect_futures(entity, self.__context))
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  [Previous line repeated 1 more time]
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
    sub_entities = entity.visit(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
    return self.execute(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 453, in execute
    ret = super().execute(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 823, in execute
    self.__expand_substitutions(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 668, in __expand_substitutions
    cmd = [perform_substitutions(context, x) for x in self.__cmd]
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 668, in <listcomp>
    cmd = [perform_substitutions(context, x) for x in self.__cmd]
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
    return ''.join([context.perform_substitution(sub) for sub in subs])
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
    return ''.join([context.perform_substitution(sub) for sub in subs])
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_context.py", line 232, in perform_substitution
    return substitution.perform(self)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/executable_in_package.py", line 76, in perform
    package_prefix = super().perform(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 79, in perform
    result = self.find(package)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 96, in find
    return get_package_prefix(package_name)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py", line 52, in get_package_prefix
    raise PackageNotFoundError(
ament_index_python.packages.PackageNotFoundError: "package 'twist_mux' not found, searching: ['/home/ubuntu/detta_ws/install/tato_bot', '/home/ubuntu/detta_ws/install/diffdrive_arduino', '/home/ubuntu/detta_ws/install/serial', '/opt/ros/foxy']"
Task exception was never retrieved
future: <Task finished name='Task-8' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=RuntimeError('Signal event received before subprocess transport available.')>
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
    visit_all_entities_and_collect_futures(entity, self.__context))
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
    sub_entities = entity.visit(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
    return self.execute(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/opaque_function.py", line 75, in execute
    return self.__function(context, *self.__args, **self.__kwargs)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 443, in __on_signal_process_event
    raise RuntimeError('Signal event received before subprocess transport available.')
RuntimeError: Signal event received before subprocess transport available.
[INFO] [robot_state_publisher-1]: process started with pid [3178]
[robot_state_publisher-1] Parsing robot urdf xml string.
[robot_state_publisher-1] Link base_footprint had 0 children
[robot_state_publisher-1] Link chassis had 4 children
[robot_state_publisher-1] Link camera_link had 1 children
[robot_state_publisher-1] Link camera_link_optical had 0 children
[robot_state_publisher-1] Link laser_frame had 0 children
[robot_state_publisher-1] Link left_caster_wheel had 0 children
[robot_state_publisher-1] Link right_caster_wheel had 0 children
[robot_state_publisher-1] Link left_wheel had 0 children
[robot_state_publisher-1] Link right_wheel had 0 children
[robot_state_publisher-1] [INFO] [1720506950.444877888] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1720506950.445267630] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1720506950.445339852] [robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1720506950.445376500] [robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-1] [INFO] [1720506950.445409815] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1720506950.445440260] [robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1720506950.445469500] [robot_state_publisher]: got segment left_caster_wheel
[robot_state_publisher-1] [INFO] [1720506950.445498575] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1720506950.445527408] [robot_state_publisher]: got segment right_caster_wheel
[robot_state_publisher-1] [INFO] [1720506950.445556834] [robot_state_publisher]: got segment right_wheel
[ERROR] [robot_state_publisher-1]: process[robot_state_publisher-1] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [robot_state_publisher-1]: sending signal 'SIGTERM' to process[robot_state_publisher-1]
[ERROR] [robot_state_publisher-1]: process has died [pid 3178, exit code -15, cmd '/opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher --ros-args --params-file /tmp/launch_params_xhapja7u'].

hi
i am using ros2 humble can anyone tell me if there is any diff drive arduino hardware interface available for ros2 humble?