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

I found the problem it seems to be some internal problem with the Arduino uno, it works fine on the nano.

I think I will take a stab at writing new Arduino code. Josh, if you were personally to do this would you continue using Serial or would you go for something like MicroROS (keeping in mind one could no longer use the Nano if that were the case)? I use the Teensy quite a bit so perhaps Iā€™ll try something for both (Iā€™d like to learn MicroROS myself). This is out of scope so Iā€™ll start a new topic for discussion later.

Hey Josh, wanted to let you know I purchased a couple of 100RPM motors and that seemed to do the trick. Everything is now running smoothly. Those other motors were probably just too fast for the PID/encoders to handle.

BTW, is it possible to get permissions to create new topics? It doesnā€™t look like I have (unless Iā€™m not supposed to).

Nice, Iā€™m very glad that sorted it (itā€™s always disappointing when you sink money into extra hardware and it doesnā€™t help!)

Yeah, creating new topics is restricted to paid members over at Patreon however I have tried to make the bottom tier very affordable. This also gets you access to the Discord server and helps support the channel.

I havenā€™t got Patreon and Discourse synced up yet though and have to update user permissions manually, so donā€™t be afraid to remind me if needed :slight_smile:

Sounds fair. :slight_smile: I have now joined Patreon.

1 Like

Maybe the answer to this is in my face and I donā€™t see it, but Iā€™m going to ask anyway. Iā€™ve created a launch file for the physical robot after success with all the simulations. It runs and teleoperates just fine. When I open RVIZ, however, I noticed that the modelā€™s wheels are screwed up because the wheel transforms canā€™t be resolved (we used to cheat and run joint_state_publisher_gui to resolve this). This does not happen when running RVIZ with the Gazebo simulation. Is this behavior correct? Is there something I can do (besides running the JSP gui) to fix this issue?

Edit: I figured it out. I had the wheels parented to the base_link. When I changed the parent to the chassis the joints are now recognized. Iā€™m leaving this post for anyone who might have the same issue with their design.

Im having issues where my Twist msgs from teleop is having the following problems:
-not updating my robot position correctly
-unstable, moves slow sometimes and very fast other times
-when moving straight, it never updates the position except for a fixed 0.1 meter even if i keep going straight for more.
-after a few turns, it gets stuck and i cant use teleop anymore until i manually nudge the wheel.

note: the updates and revolutions are exact when im turning the wheels using my hands. the problems start when i use teleop.

and i am also confused about where to change my PID values because there are ones in the diffdrive_arduino.cpp (arduino_.setPidValues(30,20,0,100)) and ones in the arduino file, which ones should i be changing?

All the code works up until the gazebo simulation and mapping.

im using ros humble and have updates my files appropriately using your most recent video.

Any help as to where to start fixing the issue would be very very appreciateddd

FIXED!! = The issue was very very lame, even though i spent days changing the code assuming its the cause. The issue was wiring and power! the encoders and logic were getting the power from the controller because i forgot to provide it power and ground it from and to the arduino, and it caused it to keep shutting off and on and acting crazy.

Glad you got it sorted.
I was going to suggest checking that you were running the joint_state_broadcaster which is responsible for publishing the joint states when using ros2_control, which are then read by robot_state_publisher to broadcast the transforms. Including that as a note in case someone has a similar (but different!) issue to what you did :slight_smile:

Ahh yep those kiind of wiring issues can be a real pain and cause very sporadic behaviour (or kill your encoders as some people have found :frowning: ) Iā€™m glad itā€™s fixed for you though.

Re the PID values, from memory on the Foxy version you should change the hardcoded values in the cpp, and on Humble you can set them as a parameter. If you change them on the Arduino I think that will be changing the default value which is the case if diffdrive_arduino never sends an override.

(I think thatā€™s all correct, I havenā€™t looked at it for a little while)

Hi @JoshNewans
i installed RO2 Humble. I am getting this error when trying to build diffdrive_arduino with colcon build. Can you help me?

Starting >>> serial
Starting >>> articubot_one
Finished <<< articubot_one [0.88s]
Finished <<< serial [1.39s]
Starting >>> diffdrive_arduino
ā€” stderr: diffdrive_arduino
In file included from /home/robot/rasp_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:
/home/robot/rasp_ws/src/diffdrive_arduino/include/diffdrive_arduino/fake_robot.h:7:10: fatal error: hardware_interface/base_interface.hpp: No such file or directory
7 | #include ā€œhardware_interface/base_interface.hppā€
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/fake_robot.dir/build.make:76: CMakeFiles/fake_robot.dir/src/fake_robot.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:165: CMakeFiles/fake_robot.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobsā€¦
In file included from /home/robot/rasp_ws/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:
/home/robot/rasp_ws/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:7:10: fatal error: hardware_interface/base_interface.hpp: No such file or directory
7 | #include ā€œhardware_interface/base_interface.hppā€
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/diffdrive_arduino.dir/build.make:76: CMakeFiles/diffdrive_arduino.dir/src/diffdrive_arduino.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobsā€¦
gmake[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/diffdrive_arduino.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Failed <<< diffdrive_arduino [23.8s, exited with code 2]

Summary: 2 packages finished [26.4s]
1 package failed: diffdrive_arduino
1 package had stderr output: diffdrive_arduino

@JoshNewans . I installed diffdrive_arduino of GitHub - Buzzology/diffdrive_arduino: A simple ROS Control Hardware Interface for differential drive control of robot whose motors are connected via an Arduino (or similar microcontroller).. I can run teleop_twist_keyboard to drive my around. My motors can work. But when I open rviz2 for tracking, when I press some letters ā€˜iā€™ and ā€˜mā€™ on the keyboard, the robot runs circle around base_link , doesnā€™t go straight ( forward and backward). I installed ROS2 HUMBLE. Can you help me, plz?

Iā€™m a bit confuse
When using SIM mode
The file ros2_control.xacro define the differential wheel plug in for gazebo through the yaml files
the file gazebo_control.xacro define diff_drive plugin

isnā€™t redundant? what do I miss with my understanding?

@JoshNewans Hi! Firstly, amazing tutorial which clearly explains how to interface to a real robot. However, I am facing an issue when launching the real robot. The error is as below

[ros2_control_node-2] [INFO] [1694504172.944274701] [resource_manager]: Loading hardware ā€˜RealRobotā€™
[ros2_control_node-2] [INFO] [1694504172.946497851] [resource_manager]: Initialize hardware ā€˜RealRobotā€™
[ros2_control_node-2] terminate called after throwing an instance of ā€˜std::invalid_argumentā€™

I figured the error occurs in the ros2_control/hardware_interface/resource_manager.cpp file. The specific line where the error occurs I think is this:
const rclcpp_lifecycle::State new_state = hardware.initialize(hardware_info);

Iā€™m using an Arduino Mega instead. I have tested my bot with the ros_arduino_bridge package and it works fine when running miniterm. Is there a way to resolve this? Thank you!

1 Like

Hi, thank you for all your work on those videos, which I love learning from.

Iā€™m trying to create my own robot under ROS 2 Humble. It seems that I have successfully managed to use Nav2. However, I donā€™t understand how ROS 2 Control is used by Nav2. What does Nav2 Controller Server and Planner use to work? And finally, the most important question: Is there any controller from ROS 2 Control for controlling a 3-wheel omnidirectional robot?

Hey Josh,

First of all, thanks for all these great tutorials! They are helping me loads during my studies and thanks for replying. This is for a school project, so i appreciate all the help i can get.
I get the same error message as Samet_Elmaci in this thread:
Discussion - Changes for running mobile robot on Humble/Jammy - #14 by Samet_Elmaci .

Some information about my setup:
I am using ros2 humble in a docker container. I have the exact same hardware setup as you for ease of following your tutorials. I have forwarded the USB ports on the pi to the container, so i am able to get lidar data and control the motors. Therefore the container setup itself is not likely the issue.

I have cloned the repo for articubot_one (humble branch) and the error happens when i try to run the the launch_robot.launch.py. I have tried various things to fix the issue:

  • I can control the motors with miniterm.
  • I have your diffdrive_arduino pkg (humble branch).
  • I have your serial pkg (newans_ros2 branch).
  • I have tried running it both on my dev machine and the rpi.
  • Following packages are installed:
    • ros-humble-ros2-controllers
    • ros-humble-ros2-control
    • ros-humble-gazebo-ros2-control (on dev machine)
  • ros2 control works when running ā€˜launch_sim.launch.pyā€™. (I can teleop).
  • I have of course rebuild with colcon and sourced the workspace.
  • I tried referencing the serial device in the ros2_controller.xacro file both by /dev/ttyUSB0 and with /dev/serial/by-id/{the id i found for the nano}.
  • I have changed to both read, write, execute privilege for the serial port.
  • User is added to the dialout group
  • I have tried something as simple as sudo apt-get update and upgrade.

Things i am going to try:

  • I have only wired one of the motors up, so i will connect the other one as well.
  • Try foxy instead of humble.
  • Install ros directly on the machines instead of docker containers.

Error message:
devuser@pi:/overlay_ws$ ros2 launch articubot_one launch_robot.launch.py
[INFO] [launch]: All log files can be found below /home/devuser/.ros/log/2023-09-26-11-54-50-619436-pi-2661
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [2663]
[INFO] [twist_mux-2]: process started with pid [2665]
[twist_mux-2] [INFO] [1695729293.661287767] [twist_mux]: Topic handler ā€˜topics.joystickā€™ subscribed to topic ā€˜cmd_vel_joyā€™: timeout = 0.500000s , priority = 100.
[twist_mux-2] [INFO] [1695729293.669544297] [twist_mux]: Topic handler ā€˜topics.navigationā€™ subscribed to topic ā€˜cmd_velā€™: timeout = 0.500000s , priority = 10.
[twist_mux-2] [INFO] [1695729293.671005906] [twist_mux]: Topic handler ā€˜topics.trackerā€™ subscribed to topic ā€˜cmd_vel_trackerā€™: timeout = 0.500000s , priority = 20.
[robot_state_publisher-1] [INFO] [1695729293.707919896] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1695729293.708507536] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1695729293.708640478] [robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1695729293.708740736] [robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-1] [INFO] [1695729293.708833883] [robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1695729293.708923104] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1695729293.709009436] [robot_state_publisher]: got segment face_link
[robot_state_publisher-1] [INFO] [1695729293.709094694] [robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1695729293.709181637] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1695729293.709267247] [robot_state_publisher]: got segment right_wheel
[INFO] [ros2_control_node-3]: process started with pid [2700]
[INFO] [spawner-4]: process started with pid [2702]
[INFO] [spawner-5]: process started with pid [2704]
[ros2_control_node-3] [INFO] [1695729302.263149623] [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/DiffDriveArduino with base class type hardware_interface::SystemInterface does not exist. Declared types are diffdrive_arduino/DiffDriveArduinoHardware fake_components/GenericSystem mock_components/GenericSystem test_hardware_components/TestSystemCommandModes test_hardware_components/TestTwoJointSystem test_system
[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 0xaaaae2d52c6f, in
[ros2_control_node-3] #14 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffffa63274cb, in __libc_start_main
[ros2_control_node-3] #13 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffffa63273fb, in
[ros2_control_node-3] #12 Object ā€œ/opt/ros/humble/lib/controller_manager/ros2_control_nodeā€, at 0xaaaae2d52767, in
[ros2_control_node-3] #11 Object ā€œ/opt/ros/humble/lib/libcontroller_manager.soā€, at 0xffffa699cba7, in controller_manager::ControllerManager::ControllerManager(std::shared_ptrrclcpp::Executor, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, rclcpp::NodeOptions const&)
[ros2_control_node-3] #10 Object ā€œ/opt/ros/humble/lib/libcontroller_manager.soā€, at 0xffffa699bfcf, in controller_manager::ControllerManager::init_resource_manager(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)
[ros2_control_node-3] #9 Object ā€œ/opt/ros/humble/lib/libhardware_interface.soā€, at 0xffffa6197237, in hardware_interface::ResourceManager::load_urdf(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool)
[ros2_control_node-3] #8 Object ā€œ/opt/ros/humble/lib/libhardware_interface.soā€, at 0xffffa61959e3, in
[ros2_control_node-3] #7 Object ā€œ/opt/ros/humble/lib/libhardware_interface.soā€, at 0xffffa61a16b7, in
[ros2_control_node-3] #6 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffffa6582e03, in __cxa_throw
[ros2_control_node-3] #5 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffffa6582b1f, in std::terminate()
[ros2_control_node-3] #4 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffffa6582abb, in
[ros2_control_node-3] #3 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffffa65862db, in __gnu_cxx::__verbose_terminate_handler()
[ros2_control_node-3] #2 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffffa632712f, in abort
[ros2_control_node-3] #1 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffffa633a67b, in raise
[ros2_control_node-3] #0 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffffa637f200, in
[ros2_control_node-3] Aborted (Signal sent by tkill() 2700 1000)
[ERROR] [ros2_control_node-3]: process has died [pid 2700, exit code -6, cmd ā€˜/opt/ros/humble/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_navrtmcw --params-file /overlay_ws/install/articubot_one/share/articubot_one/config/my_controllers.yamlā€™].
[spawner-4] [INFO] [1695729307.338964270] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-5] [INFO] [1695729307.421576180] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [INFO] [1695729309.405147189] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-5] [INFO] [1695729309.489268521] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [INFO] [1695729311.472865011] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-5] [INFO] [1695729311.556779495] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [INFO] [1695729313.543320664] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-5] [INFO] [1695729313.625254842] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [ERROR] [1695729315.200286903] [spawner_joint_broad]: Controller manager not available
[spawner-5] [ERROR] [1695729315.279275328] [spawner_diff_cont]: Controller manager not available
[ERROR] [spawner-4]: process has died [pid 2702, exit code 1, cmd ā€˜/opt/ros/humble/lib/controller_manager/spawner joint_broad --ros-argsā€™].
[ERROR] [spawner-5]: process has died [pid 2704, exit code 1, cmd ā€˜/opt/ros/humble/lib/controller_manager/spawner diff_cont --ros-argsā€™].

Hi,
Iā€™m running directly on arduino and have the same issue.

ros2@robot:/home/robot_ws$ ros2 launch lunorobot launch_robot.launch.py
[INFO] [launch]: All log files can be found below /home/ros2/.ros/log/2023-10-03-17-12-02-039075-robot-4349
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [4350]
[robot_state_publisher-1] [INFO] [1696345922.974149735] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1696345922.974446916] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1696345922.974494767] [robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1696345922.974526341] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1696345922.974552155] [robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1696345922.974576322] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1696345922.974600988] [robot_state_publisher]: got segment right_wheel
[INFO] [ros2_control_node-2]: process started with pid [4388]
[INFO] [spawner-3]: process started with pid [4390]
[INFO] [spawner-4]: process started with pid [4392]
[ros2_control_node-2] [INFO] [1696345928.903734258] [resource_manager]: Loading hardware ā€˜RealRobotā€™
[ros2_control_node-2] terminate called after throwing an instance of ā€˜pluginlib::LibraryLoadExceptionā€™
[ros2_control_node-2] what(): According to the loaded plugin descriptions the class diffdrive_arduino/DiffDriveArduino with base class type hardware_interface::SystemInterface does not exist. Declared types are diffdrive_arduino/DiffDriveArduinoHardware fake_components/GenericSystem mock_components/GenericSystem test_hardware_components/TestSystemCommandModes test_hardware_components/TestTwoJointSystem test_system
[ros2_control_node-2] Stack trace (most recent call last):
[ros2_control_node-2] #16 Object ā€œ/usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1ā€, at 0xffffffffffffffff, in
[ros2_control_node-2] #15 Object ā€œ/opt/ros/humble/lib/controller_manager/ros2_control_nodeā€, at 0xaaaaea4c2c6f, in
[ros2_control_node-2] #14 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffff9fb674cb, in __libc_start_main
[ros2_control_node-2] #13 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffff9fb673fb, in
[ros2_control_node-2] #12 Object ā€œ/opt/ros/humble/lib/controller_manager/ros2_control_nodeā€, at 0xaaaaea4c2767, in
[ros2_control_node-2] #11 Object ā€œ/opt/ros/humble/lib/libcontroller_manager.soā€, at 0xffffa01dd717, in controller_manager::ControllerManager::ControllerManager(std::shared_ptrrclcpp::Executor, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, rclcpp::NodeOptions const&)
[ros2_control_node-2] #10 Object ā€œ/opt/ros/humble/lib/libcontroller_manager.soā€, at 0xffffa01dcb3f, in controller_manager::ControllerManager::init_resource_manager(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)
[ros2_control_node-2] #9 Object ā€œ/opt/ros/humble/lib/libhardware_interface.soā€, at 0xffff9f9d7237, in hardware_interface::ResourceManager::load_urdf(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool)
[ros2_control_node-2] #8 Object ā€œ/opt/ros/humble/lib/libhardware_interface.soā€, at 0xffff9f9d59e3, in
[ros2_control_node-2] #7 Object ā€œ/opt/ros/humble/lib/libhardware_interface.soā€, at 0xffff9f9e16b7, in
[ros2_control_node-2] #6 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffff9fdc2e03, in __cxa_throw
[ros2_control_node-2] #5 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffff9fdc2b1f, in std::terminate()
[ros2_control_node-2] #4 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffff9fdc2abb, in
[ros2_control_node-2] #3 Object ā€œ/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30ā€, at 0xffff9fdc62db, in __gnu_cxx::__verbose_terminate_handler()
[ros2_control_node-2] #2 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffff9fb6712f, in abort
[ros2_control_node-2] #1 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffff9fb7a67b, in raise
[ros2_control_node-2] #0 Object ā€œ/usr/lib/aarch64-linux-gnu/libc.so.6ā€, at 0xffff9fbbf200, in
[ros2_control_node-2] Aborted (Signal sent by tkill() 4388 1000)
[ERROR] [ros2_control_node-2]: process has died [pid 4388, exit code -6, cmd ā€˜/opt/ros/humble/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_izmqttko --params-file /home/robot_ws/install/lunorobot/share/lunorobot/config/my_controllers.yamlā€™].
[spawner-3] [INFO] [1696345932.213156760] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [INFO] [1696345932.541984436] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-3] [INFO] [1696345934.271893949] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [INFO] [1696345934.602429954] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-3] [INFO] [1696345936.328438815] [spawner_joint_broad]: Waiting for ā€˜/controller_managerā€™ node to exist
[spawner-4] [INFO] [1696345936.660799370] [spawner_diff_cont]: Waiting for ā€˜/controller_managerā€™ node to exist

Could you please help?

Hi,

Solution found for Humble version
There are 3 issues in ros2_control.xacro file:

  1. the name of the plugin should be diffdrive_arduino/DiffDriveArduinoHardware
  2. the name of the timeout parameter should be timeout_ms
  3. the sequence of the state_interface should be position then velocity, see correct xml code below:
<ros2_control name="RealRobot" type="system">
        <hardware>
            <plugin>diffdrive_arduino/DiffDriveArduinoHardware</plugin>
            <param name="left_wheel_name">left_wheel_joint</param>
            <param name="right_wheel_name">right_wheel_joint</param>
            <param name="loop_rate">30</param>
            <param name="device">/dev/ttyUSB0</param>
            <param name="baud_rate">57600</param>
            <param name="timeout_ms">1000</param>
            <param name="enc_counts_per_rev">17280</param>
        </hardware>
        <!-- Note everything below here is the same as the Gazebo one -->
        <joint name="left_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="position"/>
            <state_interface name="velocity"/>
        </joint>
        <joint name="right_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="position"/>
            <state_interface name="velocity"/>
        </joint>
    </ros2_control> 
</robot>
1 Like

Hi Josh,
I find your videos awsome!!!
Would you mind to plan a topic also using some kind of 9dof sensor (for example bno055) for better navigation? Are they really needed or SLAM is enoough?

Thank you very much!

Cheers,
Ivo

hi im new to Ros and needed some help. From the tutorials i have leard few thing and iwas able to build a 4WD diff_drive robot ( GitHub - The-Kriz/rog_ros_bot )

but was able to run the bot in sim, but didnt have the luck to make the actual bot run as i coudint figure out how to write code for the hardware part ( i only know basic arduino code )

can someone help me to convert or let me know what all i should change from the provided code for 2WD diff_drive to 4WD diff_drive

thanks you,
Kriz

HI,
It was a great lecture, thanks for sharing with us. I was able to follow most part of it, but i was unable to understand how input and output ports are connected in the hardware interface plugin.

thanks a lot for sharing with us.