hey Josh, thanks for the amazing tutorial and the generous content in general
i see you have commented on this issue before but i can’t seem to figure it
out yet it happens on both the machine and the pi
[spawner.py-6] [INFO] [1704429643.856203298] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1704429643.945700660] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-6] [INFO] [1704429645.866817026] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1704429645.955195869] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-6] [INFO] [1704429647.880334317] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1704429647.967992784] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-6] [INFO] [1704429649.896868913] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1704429649.984468641] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-6] [ERROR] [1704429651.911524114] [spawner_joint_broad]:
Controller manager not available
[ERROR] [spawner.py-6]: process has died [pid 9922, exit code 1, cmd
‘/opt/ros/foxy/lib/controller_manager/spawner.py joint_broad --ros-args’].
[spawner.py-5] [ERROR] [1704429651.999166283] [spawner_diff_cont]: Controller
manager not available
[ERROR] [spawner.py-5]: process has died [pid 9920, exit code 1, cmd
‘/opt/ros/foxy/lib/controller_manager/spawner.py diff_cont --ros-args’].


[ Dec '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/15 "December 11,
2022  5:04am") [ ▶ Douglas_Beach
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/13)


I think I figured out the problem… I am running ROS Humble and the
Ros2_control package for humble doesn’t have
hardware_interface/base_interface.hpp anymore. [ https://github.com/ros-
controls/ros2_control/tree/humble/hardware_interface/include/hardware_interface
](https://github.com/ros-
controls/ros2_control/tree/humble/hardware_interface/include/hardware_interface)


* [ C++ ](/questions/scope:all/sort:activity-desc/tags:C++/page:1/)


    // START: This part here is for exemplary purposes - Please do not copy to your production code
    RCLCPP_INFO(
      rclcpp::get_logger("DiffBotSystemHardware"),
      "Got position state %.5f and velocity state %.5f for '%s'!", hw_positions_[i],
      hw_velocities_[i], info_.joints[i].name.c_str());
    // END: This part here is for exemplary purposes - Please do not copy to your production code
  }


Your issue here is you don’t have ` twist_mux ` installed ( ` sudo apt install
ros-foxy-twist-mux ` ).


Roberto


[ dusevitch  ](https://get-help.theconstruct.ai/u/dusevitch) May 9, 2022,
3:16pm  3


Thank you for your prompt response and suggestions, we will look into it.


###  [ eaganrodegard
](https://discourse.articulatedrobotics.xyz/u/eaganrodegard)


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.


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/52 "June  8, 2023
10:46am") [ ▶ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/48)


Could you please explain the rationale behind the specific formula used in the
` setMotorValues ` method for converting angular velocity to encoder counts
per control loop iteration?


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


![](https://get-help.robotigniteacademy.com/user_avatar/get-
help.robotigniteacademy.com/rzegers/48/7010_2.png) rzegers:


The problem was caused by referencing a wrong controller, namely `
diff_drive_controller ` instead of ` diffbot_base_controller ` (which is the
controller name defined inside the .yaml file).


##  [ ](https://discourse.articulatedrobotics.xyz#starting-serial-starting-
articubot_one-finished-articubot_one-088s-finished-serial-139s-starting-
diffdrive_arduino-stderr-diffdrive_arduino-in-file-included-from-
homerobotrasp_wssrcdiffdrive_arduinosrcfake_robotcpp1-homerobotrasp_wssrcdiffdrive_arduinoincludediffdrive_arduinofake_roboth710-fatal-
error-hardware_interfacebase_interfacehpp-no-such-file-or-directory-7-include-
hardware_interfacebase_interfacehpp-compilation-terminated-
gmake2-cmakefilesfake_robotdirbuildmake76-cmakefilesfake_robotdirsrcfake_robotcppo-
error-1-gmake1-cmakefilesmakefile2165-cmakefilesfake_robotdirall-
error-2-gmake1-waiting-for-unfinished-jobs-in-file-included-from-
homerobotrasp_wssrcdiffdrive_arduinosrcdiffdrive_arduinocpp1-homerobotrasp_wssrcdiffdrive_arduinoincludediffdrive_arduinodiffdrive_arduinoh710-fatal-
error-hardware_interfacebase_interfacehpp-no-such-file-or-directory-7-include-
hardware_interfacebase_interfacehpp-compilation-terminated-
gmake2-cmakefilesdiffdrive_arduinodirbuildmake76-cmakefilesdiffdrive_arduinodirsrcdiffdrive_arduinocppo-
error-1-gmake2-waiting-for-unfinished-jobs-
gmake1-cmakefilesmakefile2139-cmakefilesdiffdrive_arduinodirall-error-2-gmake-
makefile146-all-error-2-1) 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.


        class HardwareCommandPub : public rclcpp::Node
        {
          public:
            HardwareCommandPub() : Node("ToArduino_command_publisher")
        {
          publisher_ = this->create_publisher<trajectory_msgs::msg::JointTrajectory>("Joint_Value", 10);
        //  publisher_ = this->create_publisher<std_msgs::msg::Float32>("Joint_Value", 10);
        }

        void publishData(trajectory_msgs::msg::JointTrajectory message)
        //void publishData(std_msgs::msg::Float32 message)
        {
          publisher_->publish(message);
        }
            rclcpp::Publisher<trajectory_msgs::msg::JointTrajectory>::SharedPtr publisher_;
        //    rclcpp::Publisher<std_msgs::msg::Float32>::SharedPtr publisher_;
        };


###  [ AddyPete ](https://discourse.articulatedrobotics.xyz/u/AddyPete)


###  [ Douglas_Beach
](https://discourse.articulatedrobotics.xyz/u/Douglas_Beach)


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/19)


Yes now it work the problem was same that you have mentioned. Thank you


Regards,


[ **asked 2022-11-07 07:51:32 -0500  ** ](/questions/409067/revisions/)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[ ![ gravatar image]() ]() [ ]() (  2024-04-15 00:18:05 -0500  )  edit


The simplest way to achieve what you want is instead of referencing the
devices as ` /dev/ttyUSB0 ` or whatever, instead use ` /dev/serial/by-id/xxx `
or ` /dev/serial/by-path/xxx ` . These paths are tied to either the identifier
of the hardware, or the actual USB port it is plugged into, so as long as you
keep them in the same ports, the OS should identify them by the same path each
time!


[ ![image](https://get-
help.robotigniteacademy.com/uploads/default/original/2X/1/10fa45429233c89e9d1857ff9b352ebd2777e190.png)
image  735×198 6.98 KB  ](https://get-
help.robotigniteacademy.com/uploads/default/original/2X/1/10fa45429233c89e9d1857ff9b352ebd2777e190.png
"image")


for the diff_drive_controller, the joint_state_broadcaster launches ok.


[ Feb '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/23 "February 19,
2023  4:47pm")


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/33)


There most certainly was
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)
from launch.substitutions import Command


  ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
  std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/61 "June 11, 2023
4:53am") [ ▶ Cliff_Andrew_Oliver
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/58)


    doug@doug-desktop:~/ros2_ws$ colcon build --symlink-install
    Starting >>> serial
    Starting >>> arduino_com
    Starting >>> my_bot
    Starting >>> my_robot_controller
    Finished <<< my_bot [3.89s]
    Starting >>> robot_controller
    Finished <<< serial [4.15s]
    Starting >>> diffdrive_arduino
    --- stderr: diffdrive_arduino
    In file included from /home/doug/ros2_ws/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:
    /home/doug/ros2_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[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/diffdrive_arduino.dir/all] Error 2
    gmake[1]: *** Waiting for unfinished jobs....
    In file included from /home/doug/ros2_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:
    /home/doug/ros2_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: *** [Makefile:146: all] Error 2
    ---
    Failed   <<< diffdrive_arduino [5.76s, exited with code 2]
    Aborted  <<< my_robot_controller [10.0s]
    Aborted  <<< arduino_com [10.6s]
    Aborted  <<< robot_controller [8.27s]

    Summary: 2 packages finished [13.3s]
      1 package failed: diffdrive_arduino
      3 packages aborted: arduino_com my_robot_controller robot_controller
      1 package had stderr output: diffdrive_arduino


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/65 "June 22, 2023
8:39am") [ ▶ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/64)


[ Mar '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/28 "March 21,
2023 12:34am")


  ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
  hardware_interface::return_type write() override;


isn’t redundant? what do I miss with my understanding?


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/s/f19dbf/45.png)
](https://discourse.articulatedrobotics.xyz/u/Shai_Mizrachi)


If you _really_ want to use micro-ROS on the Arduino, it probably makes sense
to skip ros2_control completely. And that is a perfectly acceptable setup -
just not what I’ve done in my tutorials. In that case you’ll probably want to
have the Arduino receiving a ` Twist ` and handling all the diff-drive
calculations (which it seems you are doing), rather than implenting it on the
ROS side.


When I try to define a shared_ptr for a publisher with message type of
trajectory_msgs__msg_JointTrajectory I get an error message :


rclcpp::Publisher<trajectory_msgs__msg__JointTrajectory>::SharedPtr publisher_;


// Copyright 2022 PickNik Inc.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//    * Redistributions of source code must retain the above copyright
//      notice, this list of conditions and the following disclaimer.
//
//    * Redistributions in binary form must reproduce the above copyright
//      notice, this list of conditions and the following disclaimer in the
//      documentation and/or other materials provided with the distribution.
//
//    * Neither the name of the PickNik Inc. nor the names of its
//      contributors may be used to endorse or promote products derived from
//      this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
/* Author: Jafar Abdi */
#include <algorithm>
#include <cmath>
#include <iterator>
#include <limits>
#include <set>
#include <string>
#include <vector>
#include <angles/angles.h>
#include <rclcpp/executors.hpp>
#include <topic_based_ros2_control/topic_based_system.hpp>
namespace
{


[ ros2 run - symbol not found on custom msg ](/question/326008/ros2-run-
symbol-not-found-on-custom-msg/)


###  [ tiptonnet ](https://discourse.articulatedrobotics.xyz/u/tiptonnet)


[ Nov '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/87 "November 25,
2023  5:12pm")


Thank you very much!


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/57)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[ Mar '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/26 "March  3,
2023 10:14pm") [ ▶ Jon_Peroutka
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/24)


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/65)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/l/ec9cab/45.png)
](https://discourse.articulatedrobotics.xyz/u/LeoCleaner)


Here’s my setup:
Ubuntu 22.04 on a virtual machine (some issues along the way as you mentioned
but all sorted)
Completed diff drive robot with RPi4 (Ubuntu 22.04), Arduino Due (MicroRos),
L298N motor driver.


hardware_interface::return_type ros2_control_demo_hardware::DiffBotSystemHardware::write()
{
  // START: This part here is for exemplary purposes - Please do not copy to your production code
  RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Writing...");


[
![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/jeffrey_jene/45/49_2.png)
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


[ May '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/37 "May 17, 2023
11:29am") [ ▶ Betul_Duran
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/34)


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/15)


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/11)


Do you have a ` controllers.yaml ` file that you are passing in? What is
inside it? You should have the diff drive controller and joint state
broadcaster defined in there.


[ Jul '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/68 "July  4, 2023
8:23am")


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


[ rzegers  ](https://get-help.theconstruct.ai/u/rzegers) May 9, 2022, 12:10pm
2


Hi Josh,
i am trying to launch launch_robot.lauch.py but in my dev machine to try the
motors with teleop and i got this problem when launch it (Note i donot have
diffarduino_drive in my packages and when i try to have it and build it , it
give me error)
[INFO] [launch]: All log files can be found below
/home/omar/.ros/log/2023-12-30-21-04-24-680391-omarlegiony540-26297
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [26300]
[INFO] [twist_mux-2]: process started with pid [26302]
[twist_mux-2] [INFO] [1703963064.968940347] [twist_mux]: Topic handler
‘topics.joystick’ subscribed to topic ‘cmd_vel_joy’: timeout = 0.500000s ,
priority = 100.
[twist_mux-2] [INFO] [1703963064.969531345] [twist_mux]: Topic handler
‘topics.navigation’ subscribed to topic ‘cmd_vel’: timeout = 0.500000s ,
priority = 10.
[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 2 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_wheel had 0 children
[robot_state_publisher-1] Link leftb_wheel had 0 children
[robot_state_publisher-1] Link leftf_wheel had 0 children
[robot_state_publisher-1] Link right_wheel had 0 children
[robot_state_publisher-1] Link rightb_wheel had 0 children
[robot_state_publisher-1] Link rightf_wheel had 0 children
[robot_state_publisher-1] [INFO] [1703963064.974543580]
[robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1703963064.974624726]
[robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1703963064.974637111]
[robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1703963064.974645299]
[robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-1] [INFO] [1703963064.974652976]
[robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1703963064.974660158]
[robot_state_publisher]: got segment laser_frame


namespace ros2_control_demo_hardware
{


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/u/cc9497/45.png)
](https://discourse.articulatedrobotics.xyz/u/UNAIB_USMANI)


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_ptr [
rclcpp::Executor ](https://discourse.articulatedrobotics.xyz) ,
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


I am using Humble and my HW Plugin is based on the [ ros2_control_demos
](https://github.com/ros-controls/ros2_control_demos) I found that I had to
swap “position” and “velocity” name for the state_interfac, in the
command_interface, in the ros2_control.xacro file. As the plugin was expecting
Position first.
This now works for me.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/s/a5b964/45.png)
](https://discourse.articulatedrobotics.xyz/u/Sasffm)


Hi Josh ,
I’m having the same issue like others with controller manager some how is not
working .
I’ve been stuck in this for 4 days now with no luck ! any chance you recommend
something ? I echo /cmd_vel_unstamped in robot and I can see the values
passing
[spawner-4] [INFO] [1703827838.665064167] [spawner_joint_broad]: Waiting for
‘/controller_manager’ node to exist
[spawner-5] [INFO] [1703827838.785338511] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[spawner-4] [INFO] [1703827840.711671532] [spawner_joint_broad]: Waiting for
‘/controller_manager’ node to exist
[spawner-5] [INFO] [1703827840.828404607] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[spawner-4] [INFO] [1703827842.760930707] [spawner_joint_broad]: Waiting for
‘/controller_manager’ node to exist
[spawner-5] [INFO] [1703827842.877129094] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[spawner-4] [INFO] [1703827844.805368341] [spawner_joint_broad]: Waiting for
‘/controller_manager’ node to exist
[spawner-5] [INFO] [1703827844.923151119] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[spawner-4] [ERROR] [1703827846.646826040] [spawner_joint_broad]: Controller
manager not available
[spawner-5] [ERROR] [1703827846.763479498] [spawner_diff_cont]: Controller
manager not available
[ERROR] [spawner-4]: process has died [pid 7297, exit code 1, cmd
‘/opt/ros/humble/lib/controller_manager/spawner joint_broad --ros-args’].
[ERROR] [spawner-5]: process has died [pid 7299, exit code 1, cmd
‘/opt/ros/humble/lib/controller_manager/spawner diff_cont --ros-args’].


I have lidar and arduino motor control on srial ports of my robot (on usbs of
my raspberry pi). Sometimes lidar and arduino changes serial ports (lidar is
on 1 instead of 0 and arduino on 0 instead of 1)and i have to change the
configuration of both of them and recompile and start again. Is there an way
to make it automatically on the start.


![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/praveen_kumar/40/40_2.png)
Praveen_Kumar:


Sort of. You could modify it to accept a ` Twist ` and have differential drive
control, but you’d be better off fixing the other issues instead and things
should just work.


[ Feb '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/22 "February 19,
2023  8:06am") [ ▶ Enno_Stelma
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/21)


First time here? Check out the FAQ!


Hi,


Hey Josh,


###  [ Enno_Stelma ](https://discourse.articulatedrobotics.xyz/u/Enno_Stelma)


###  [ Betul_Duran ](https://discourse.articulatedrobotics.xyz/u/Betul_Duran)


The way I understand it is that diffdrive_arduino won’t work in this scenario
because it relies on ROS-Serial. I did try to use [ ros2_control_demos
](https://github.com/ros-controls/ros2_control_demos/tree/galactic) to solve
the problem but did not succeed.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/f/7c8e57/45.png)
](https://discourse.articulatedrobotics.xyz/u/FrankfurtDynamics)


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


#include "hardware_interface/types/hardware_interface_type_values.hpp"
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
#include <rclcpp_components/register_node_macro.hpp>


###  [ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/l/e99b99/45.png)
](https://discourse.articulatedrobotics.xyz/u/Lakess)


  *[
              2022-11-07 07:51:32 -0500
             ]: 2022-11-07 07:51:32 -0500
  *[
              2022-11-08 08:33:28 -0500
             ]: 2022-11-08 08:33:28 -0500
  *[
              2022-11-07 20:02:06 -0500
             ]: 2022-11-07 20:02:06 -0500
  *[
             2022-11-08 04:11:00 -0500
            ]: 2022-11-08 04:11:00 -0500
  *[
             2022-11-08 07:54:13 -0500
            ]: 2022-11-08 07:54:13 -0500
  *[
        2022-11-07 07:51:32 -0500
       ]: 2022-11-07 07:51:32 -0500
  *[
        2024-04-15 00:18:05 -0500
       ]: 2024-04-15 00:18:05 -0500


    <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>


[ Mar '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/29 "March 21,
2023  9:57pm")


This topic was automatically closed 10 days after the last reply. New replies
are no longer allowed.


Follow


Could not find a package configuration file provided by “ament_cmake” with
any of the following names:


[ Nov '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/10 "November 26,
2022  5:45pm")


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 ](https://discourse.articulatedrobotics.xyz/t/discussion-changes-
for-running-mobile-robot-on-humble-jammy/311/14) .


Add the installation prefix of “ament_cmake” to CMAKE_PREFIX_PATH or set
“ament_cmake_DIR” to a directory containing one of the above files. If
“ament_cmake” provides a separate development package or SDK, be sure it
has been installed.


}  // namespace ros2_control_demo_hardware


###  [ Devbot ](https://discourse.articulatedrobotics.xyz/u/Devbot)


###  [ Aboude_zoua ](https://discourse.articulatedrobotics.xyz/u/Aboude_zoua)


##  Comments


  for (auto i = 0u; i < hw_commands_.size(); i++)
  {
    // Simulate sending commands to the hardware
    RCLCPP_INFO(
      rclcpp::get_logger("DiffBotSystemHardware"), "Got command %.5f for '%s'!", hw_commands_[i],
      info_.joints[i].name.c_str());
  }
  RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Joints successfully written!");
  // END: This part here is for exemplary purposes - Please do not copy to your production code

  hw_cmd_pub_->publishData();  //publish to topic
  return hardware_interface::return_type::OK;
}
}  // namespace ros2_control_demo_hardware


> Any ideas why the robot is not responding to twist correctly?


#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp/macros.hpp"
#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
#include "rclcpp_lifecycle/state.hpp"
#include "ros2_control_demo_hardware/visibility_control.h"
#include "std_msgs/msg/string.hpp"


[ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/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).
](https://github.com/Buzzology/diffdrive_arduino) . 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?


What do you mean? Essentially all a ros2_control harware interface is is a C++
plugin that does that, but takes the input from ros2_control rather than your
own calculation.


    [INFO] [ros2_control_node-2]: process started with pid [4577]
    [INFO] [spawner.py-3]: process started with pid [4579]
    [INFO] [spawner.py-4]: process started with pid [4581]
    [ros2_control_node-2] [INFO] [1666217546.726356381] [DiffDriveArduino]: Configuring...
    [ros2_control_node-2] terminate called after throwing an instance of 'serial::IOException'
    [ros2_control_node-2]   what():  IO Exception (13): Permission denied, file /home/rosbot/robot_ws/src/serial/src/impl/unix.cc, line 151.
    [spawner.py-4] [INFO] [1666217547.812861551] [spawner_diff_cont]: Waiting for /controller_manager services
    [spawner.py-3] [INFO] [1666217547.840100623] [spawner_joint_broad]: Waiting for /controller_manager services
    [ERROR] [ros2_control_node-2]: process has died [pid 4577, exit code -6, cmd '/opt/ros/foxy/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_57dm5z2x --params-file /home/rosbot/robot_ws/install/articubot_one/share/articubot_one/config/my_controllers.yaml'].
    [spawner.py-4] [INFO] [1666217549.844418248] [spawner_diff_cont]: Waiting for /controller_manager services
    [spawner.py-3] [INFO] [1666217549.872518979] [spawner_joint_broad]: Waiting for /controller_manager services
    [spawner.py-4] [INFO] [1666217551.875385029] [spawner_diff_cont]: Waiting for /controller_manager services
    [spawner.py-3] [INFO] [1666217551.904104070] [spawner_joint_broad]: Waiting for /controller_manager services
    [spawner.py-4] [INFO] [1666217553.907724653] [spawner_diff_cont]: Waiting for /controller_manager services
    [spawner.py-3] [INFO] [1666217553.938034195] [spawner_joint_broad]: Waiting for /controller_manager services
    [spawner.py-4] [INFO] [1666217555.937776050] [spawner_diff_cont]: Waiting for /controller_manager services
    [spawner.py-3] [INFO] [1666217555.968601738] [spawner_joint_broad]: Waiting for /controller_manager services
    [spawner.py-4] [ERROR] [1666217557.765990630] [spawner_diff_cont]: Controller manager not available
    [spawner.py-3] [ERROR] [1666217557.798581779] [spawner_joint_broad]: Controller manager not available
    [ERROR] [spawner.py-4]: process has died [pid 4581, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py diff_cont --ros-args'].
    [ERROR] [spawner.py-3]: process has died [pid 4579, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint_broad --ros-args'].


diffbot_system.hpp
// Copyright 2021 ros2_control Development Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


When you say


###  [ Agnes_Soesanto
](https://discourse.articulatedrobotics.xyz/u/Agnes_Soesanto)


Thank you very much [ @JoshNewans
](https://discourse.articulatedrobotics.xyz/u/joshnewans) for such a useful
content! I’m facing one issue. My real robot wheels are moving fine but in
rviz2 it is not moving. The tf is also not moving. Fixed frame is ‘odom’.
Tried other fixed frame but of no avail. Don’t know the real problem. If
anyone knows about this issue, please help me out. Thanks once again.


> I would love to rewrite this thing at some point


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.


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/2)


#include <memory>
#include <string>
#include <vector>


[ Nov '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/84 "November 10,
2023 10:54pm")


/dev/serial/by-path/pci-0000\:05\:00.3-usb-0\:2\:1.0 error:
namdc@Nam20195107:~/project_arduino$ ros2 launch diffdrive_arduino
diffbot.launch.py [INFO] [launch]: All log files can be found below
/home/namdc/.ros/log/2023-11-25-12-52-15-389354-Nam20195107-10120 [INFO]
[launch]: Default logging verbosity is set to INFO [INFO]
[ros2_control_node-1]: process started with pid [10123] [INFO]
[robot_state_publisher-2]: process started with pid [10125] [INFO]
[spawner-3]: process started with pid [10127] [ros2_control_node-1] [INFO]
[1700891536.231110072] [resource_manager]: Loading hardware 'DiffBot'
[ros2_control_node-1] [INFO] [1700891536.232843117] [resource_manager]:
Initialize hardware 'DiffBot' [ros2_control_node-1] [INFO]
[1700891536.233266397] [resource_manager]: Successful initialization of
hardware 'DiffBot' [ros2_control_node-1] [INFO] [1700891536.233504397]
[resource_manager]: 'configure' hardware 'DiffBot' [ros2_control_node-1]
[INFO] [1700891536.233545464] [DiffDriveArduinoHardware]: Configuring
...please wait... [ros2_control_node-1] terminate called after throwing an
instance of 'LibSerial::OpenFailed' [ros2_control_node-1] what(): Bad file
descriptor [ros2_control_node-1] Stack trace (most recent call last):
[robot_state_publisher-2] [WARN] [1700891536.235810194] [kdl_parser]: The root
link base_link has an inertia specified in the URDF, but KDL does not support
a root link with an inertia. As a workaround, you can add an extra dummy link
to your URDF. [robot_state_publisher-2] [INFO] [1700891536.236364170]
[robot_state_publisher]: got segment base_link [robot_state_publisher-2]
[INFO] [1700891536.236486892] [robot_state_publisher]: got segment
caster_frontal_wheel [robot_state_publisher-2] [INFO] [1700891536.236504515]
[robot_state_publisher]: got segment caster_rear_wheel
[robot_state_publisher-2] [INFO] [1700891536.236517450]
[robot_state_publisher]: got segment left_wheel [robot_state_publisher-2]
[INFO] [1700891536.236529713] [robot_state_publisher]: got segment right_wheel
[ros2_control_node-1] #22 Object "", at 0xffffffffffffffff, in
[ros2_control_node-1] #21 Object
"/opt/ros/humble/lib/controller_manager/ros2_control_node", at 0x55ebb695dd84,
in [ros2_control_node-1] #20 Source "../csu/libc-start.c", line 392, in
__libc_start_main_impl [0x7faad2c29e3f] [ros2_control_node-1] #19 Source
"../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main
[0x7faad2c29d8f] [ros2_control_node-1] #18 Object
"/opt/ros/humble/lib/controller_manager/ros2_control_node", at 0x55ebb695d89e,
in [ros2_control_node-1] #17 Object
"/opt/ros/humble/lib/libcontroller_manager.so", at 0x7faad3657661, in
controller_manager::ControllerManager::ControllerManager(std::shared_ptr,


edit


[ Oct '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/7 "October 20,
2022  9:14am") [ ▶ Sasffm
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/6)


[ 15 Mar ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/101 "March 15,
2024  2:01pm")


[INFO] [launch]: All log files can be found below
/home/diaz/.ros/log/2024-04-04-06-44-23-550460-diaz-desktop-13685
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [13688]
[robot_state_publisher-1] 1712227464.651032 [0] robot_stat: using network
interface wlan0 (udp/192.168.1.107) selected arbitrarily from: wlan0, docker0
[robot_state_publisher-1] Parsing robot urdf xml string.
[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 caster_wheel had 0 children
[robot_state_publisher-1] Link face_link had 0 children
[robot_state_publisher-1] Link laser_frame 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] [1712227464.679112441]
[robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1712227464.679405597]
[robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1712227464.679503966]
[robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-1] [INFO] [1712227464.679596512]
[robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1712227464.679661025]
[robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1712227464.679858499]
[robot_state_publisher]: got segment face_link
[robot_state_publisher-1] [INFO] [1712227464.679919908]
[robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1712227464.679992325]
[robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1712227464.680050182]
[robot_state_publisher]: got segment right_wheel
Task exception was never retrieved
future: <Task finished name=‘Task-12’ coro=<LaunchService._process_one_event()
done, defined at /opt/ros/foxy/lib/python3.8/site-
packages/launch/launch_service.py:226> exception=SubstitutionFailure(‘executed
command showed stderr output. Command: ros2 param get --hide-type
/robot_state_publisher robot_description\nCaptured stderr
output:\n1712227469.524891 [0] ros2: using network interface wlan0


Kindly any help in this regard?


[ ![Mike Scheutzow gravatar
image](/upfiles/avatars/Mike%20Scheutzow/resized/32/mike090516-med.jpg)
](/users/75154/mike-scheutzow/)


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/59 "June 11, 2023
4:37am") [ ▶ FrankfurtDynamics
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/56)


  ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
  std::vector<hardware_interface::StateInterface> export_state_interfaces() override;


[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_ptr [
rclcpp::Executor ](https://discourse.articulatedrobotics.xyz) ,
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)


[ General Support  ](/c/general-support/22)


“/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


Hello, I am working through the unit5 in ros2_control framework course and
have come across two issues that I cannot resolve.


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’].


[ rzegers  ](https://get-help.theconstruct.ai/u/rzegers) May 9, 2022, 10:24pm
4


[ May '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/34 "May 17, 2023
11:09am")


[ Oct '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/83 "October 30,
2023  9:59am")


[ 25 Mar ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/104 "March 25,
2024  9:12am") [ ▶ Hamza_Anwar
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/102)


with this one:


> robot_description_config = Command(['xacro ‘, xacro_file, ’
> use_ros2_control:=’, use_ros2_control, ‘sim_mode:=’, use_sim_time])


  for (auto i = 0; i < hw_start_sec_; i++)
  {
    rclcpp::sleep_for(std::chrono::seconds(1));
    RCLCPP_INFO(
      rclcpp::get_logger("DiffBotSystemHardware"), "%.1f seconds left...", hw_start_sec_ - i);
  }
  // END: This part here is for exemplary purposes - Please do not copy to your production code


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/45)


#include "ros2_control_demo_hardware/diffbot_system.hpp"


[ Nov '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/88 "November 28,
2023  6:05pm")


I have a sort of weird problem. I’ve resumed this project after a couple of
months and actually started it over as I’d forgotten a bit. The serial motor
demo and gui works great on my setup, the motors behave as expected. However,
after completing the ros2 control files and code, using teleop causes the
motors to go crazy. They will start slowly in the same direction, then they
will quickly climb to FULL speed of my motors, one flipping direction in the
process and the robot would spin in place at full speed (I have it on blocks
so this won’t happen). Nothing I’ve messed with seems to have made any
difference. It almost reminds me of an uncontrolled PID controller, like the
motors are trying to match a value or catch up with something and max out.
Does anyone have any ideas?


The disadvantages are:


![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/addypete/40/33_2.png)
AddyPete:


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


Hello, and thanks for great tutorials. I have noticed that my robot only
drives about half the linear and angular velocity as the /cmd_vel command. The
counts per revolutions is way lower at 392 tics and maybe that could have
something to do with the problem? Also its mentioned that the pid uses the
unit tics/loop rate. Should I set that number somewhere?


![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/mikhail_andryievich/40/59_2.png)
Mikhail_Andryievich:


###  [ AddyPete ](https://discourse.articulatedrobotics.xyz/u/AddyPete)


Edit: meant to say there’s also another bug preventing it from building which
I’m going to fix right now…


###  [ tadashi ](https://discourse.articulatedrobotics.xyz/u/tadashi)


###  [ tiptonnet ](https://discourse.articulatedrobotics.xyz/u/tiptonnet)


Hi
i am getting thist error when trying to build diffdrive_arduino with colcon.


  * 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.


###  [ GitHub - RedstoneGithub/diffdrive_arduino: A simple ROS Control
Hardware... ](https://github.com/RedstoneGithub/diffdrive_arduino)


    load_diff_drive_controller = ExecuteProcess(
        cmd=['ros2', 'control', 'load_controller', '--set-state', 'start',
             'diff_drive_controller'],
        output='screen'
    )


[ Feb '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/21 "February 17,
2023 11:34am")


  // Store the wheeled robot position
  double base_x_, base_y_, base_theta_;
};


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


Then as usual build your ros2_ws workspace and try again.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/a/f19dbf/45.png)
](https://discourse.articulatedrobotics.xyz/u/Aboude_zoua)


Hmm that is strange, but we should be able to figure it out by checking each
step along the way. I’m assuming through this that you are using the same
Arduino code as me and the diffdrive_arduino hardware interface.


###  [ Jon_Peroutka
](https://discourse.articulatedrobotics.xyz/u/Jon_Peroutka)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/d/9de0a6/45.png)
](https://discourse.articulatedrobotics.xyz/u/Devbot)


Yeah, creating new topics is restricted to paid members [ over at Patreon
](https://www.patreon.com/articulatedrobotics) 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.


hardware_interface::CallbackReturn myrobotSystemPositionOnlyHardware::on_init(
const hardware_interface::HardwareInfo & info) {


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);


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


###  [ Hamza_Anwar ](https://discourse.articulatedrobotics.xyz/u/Hamza_Anwar)


###  [ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/t/d2c977/45.png)
](https://discourse.articulatedrobotics.xyz/u/tiptonnet)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/s/e36b37/45.png)
](https://discourse.articulatedrobotics.xyz/u/Sudhanshu_ranjan)


[
![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/jeffrey_jene/45/49_2.png)
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


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.


arduino_.setMotorValues(l_wheel_.cmd / l_wheel_.rads_per_count / cfg_.loop_rate, r_wheel_.cmd / r_wheel_.rads_per_count / cfg_.loop_rate);


priority = 10.
[twist_mux-2] [INFO] [1702988150.253950440] [twist_mux]: Topic handler
‘topics.tracker’ subscribed to topic ‘cmd_vel_tracker’: timeout = 0.500000s ,
priority = 20.
[INFO] [ros2_control_node-3]: process started with pid [15541]
[INFO] [spawner.py-4]: process started with pid [15543]
[INFO] [spawner.py-5]: process started with pid [15545]
[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
fake_components/GenericSystem test_hardware_components/TestSystemCommandModes
test_hardware_components/TestTwoJointSystem test_system
turtlebot3_manipulation_hardware/TurtleBot3ManipulationSystemHardware
[spawner.py-4] [INFO] [1702988154.738035052] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1702988154.742421839] [spawner_diff_cont]: Waiting for
/controller_manager services
[ERROR] [ros2_control_node-3]: process has died [pid 15541, exit code -6, cmd
‘/opt/ros/foxy/lib/controller_manager/ros2_control_node --ros-args --params-
file /tmp/launch_params_i511tc0_ --params-file
/home/omar/colcon_ws/install/articubot_one/share/articubot_one/config/my_controllers.yaml’].
[spawner.py-4] [INFO] [1702988156.754901118] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1702988156.758037875] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-4] [INFO] [1702988158.770261931] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1702988158.773408347] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-4] [INFO] [1702988160.788893056] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1702988160.791728848] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-4] [INFO] [1702988162.807066439] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1702988162.811132170] [spawner_diff_cont]: Waiting for
/controller_manager services
[spawner.py-4] [ERROR] [1702988164.823391319] [spawner_joint_broad]:


###  [ LeoCleaner ](https://discourse.articulatedrobotics.xyz/u/LeoCleaner)


I am getting this error.


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


hw_cmd_pub_ = std::make_shared<HardwareCommandPub>();  //fire up the publisher node


  private:
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_;


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/43)


    position_goals = PathJoinSubstitution(
        [
            FindPackageShare("joint_trajectory_publisher"),
            "config",
            "joint_trajectory_publisher.yaml",
        ]
    )


Again, sorry it’s late but I hope that helps!


Additionally, the command that you should use to move the mobile robot should
be this one:


If you really want to have it in the launch file you can use an xacro argument
and pass it in, similar to how we handle the sim mode and ros2_control mode in
` rsp.launch.py ` .


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/e/7c8e57/45.png)
](https://discourse.articulatedrobotics.xyz/u/eaganrodegard)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/t/eb9ed0/45.png)
](https://discourse.articulatedrobotics.xyz/u/teknetik)


In another member function I call the publisher but there I get an error:


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.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/n/3d9bf3/45.png)
](https://discourse.articulatedrobotics.xyz/u/nam_Duong)


Could you please help?


My other suggestion would be to add print statements into the hardware
interface to confirm exactly what is being sent to the motors. That’s a little
tedious but should get to the bottom of it.


Pretty sure they are 110RPM. 250 is pretty fast, especially if your encoders
aren’t super fast. E.g. your requests might boil down to the difference
between a few integers in counts per loop and the PID will be jumping rapidly
between them.


###  [ Linh_Nguy_n_D_ng
](https://discourse.articulatedrobotics.xyz/u/Linh_Nguy_n_D_ng)


    load_diff_drive_controller = ExecuteProcess(
        cmd=['ros2', 'control', 'load_controller', '--set-state', 'start',
             'diffbot_base_controller'],
        output='screen'
    )


What is happening here is that the configuration file being used by the `
joint_trajectory_publisher ` is not the correct one. Sorry about the glitch
and thanks for reporting.


This fork seems to work. It compiles I have not actually tested it as such but
hopeful:


  * You have to write the code for the differential drive calculations, and you will probably make a mistake/not think of something that the ros2_control developers have thought of. By using their code you know it works and has been tested (at least, most of the time)
  * If you ever want to change your hardware out you’ll have to modify the whole thing instea of just the hardware interface


Can I get some help here, please?


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/58)


Hi [ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/joshnewans)
Thank you for the great work!


    [INFO] [ros2_control_node-4]: process started with pid [196016]
    [INFO] [spawner-5]: process started with pid [196018]
    [INFO] [spawner-6]: process started with pid [196020]
    [ros2_control_node-4] [INFO] [1700919705.073008620] [resource_manager]: Loading hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919705.094977924] [resource_manager]: Initialize hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919705.098197162] [DiffDriveArduino]: Configuring...
    [ros2_control_node-4] [INFO] [1700919705.128308250] [DiffDriveArduino]: Finished Configuration
    [ros2_control_node-4] [INFO] [1700919705.128477832] [resource_manager]: Successful initialization of hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919705.129383249] [resource_manager]: 'configure' hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919705.129478457] [resource_manager]: Successful 'configure' of hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919705.129508218] [resource_manager]: 'activate' hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919705.129532016] [DiffDriveArduino]: Starting Controller...
    [ros2_control_node-4] [INFO] [1700919706.134547443] [resource_manager]: Successful 'activate' of hardware 'RealRobot'
    [ros2_control_node-4] [INFO] [1700919706.271511173] [controller_manager]: update rate is 30 Hz
    [ros2_control_node-4] [INFO] [1700919706.288859315] [controller_manager]: RT kernel is recommended for better performance
    [ros2_control_node-4] [INFO] [1700919707.306182869] [controller_manager]: Loading controller 'joint_broad'
    [ros2_control_node-4] [INFO] [1700919707.525818714] [controller_manager]: Loading controller 'diff_cont'
    [ros2_control_node-4] [ERROR] [1700919707.525999760] [controller_manager]: Loader for controller 'diff_cont' (type 'diff_drive_controller/DiffDriveController') not found.
    [ros2_control_node-4] [INFO] [1700919707.526040966] [controller_manager]: Available classes:
    [ros2_control_node-4] [INFO] [1700919707.526075634] [controller_manager]:   controller_manager/test_controller
    [ros2_control_node-4] [INFO] [1700919707.526103543] [controller_manager]:   controller_manager/test_controller_failed_init
    [ros2_control_node-4] [INFO] [1700919707.526129859] [controller_manager]:   controller_manager/test_controller_with_interfaces
    [ros2_control_node-4] [INFO] [1700919707.526158527] [controller_manager]:   joint_state_broadcaster/JointStateBroadcaster
    [ros2_control_node-4] [INFO] [1700919707.526212030] [controller_manager]:   joint_trajectory_controller/JointTrajectoryController
    [ros2_control_node-4] [INFO] [1700919707.528960763] [controller_manager]:   controller_manager/test_chainable_controller
    [spawner-6] [FATAL] [1700919707.533096584] [spawner_diff_cont]: Failed loading controller diff_cont
    [spawner-5] [INFO] [1700919707.759520886] [spawner_joint_broad]: Loaded joint_broad
    [ros2_control_node-4] [INFO] [1700919707.765827910] [controller_manager]: Configuring controller 'joint_broad'
    [ros2_control_node-4] [INFO] [1700919707.766330214] [joint_broad]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
    [spawner-5] [INFO] [1700919707.954555349] [spawner_joint_broad]: Configured and activated joint_broad
    [ERROR] [spawner-6]: process has died [pid 196020, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner diff_cont --ros-args'].
    [INFO] [spawner-5]: process has finished cleanly [pid 196018]


auto hw_cmd_ = new trajectory_msgs::msg::JointTrajectory(); auto hw_cmd_pub_ =
new HardwareCommandPub(); //fire up the publisher node


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


###  [ FrankfurtDynamics
](https://discourse.articulatedrobotics.xyz/u/FrankfurtDynamics)


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/67)


[ @roman.smid ](/u/roman.smid)
Thank you for pointing that out, the link to the solution has been updated.
I apologize for the inconvenience.


> i only know how to send commands which are the left and right motor
> velocities.


    }
    return default_value;
  };
  // Add random ID to prevent warnings about multiple publishers within the same node
  rclcpp::NodeOptions options;
  options.arguments({ "--ros-args", "-r", "__node:=topic_based_ros2_control_" + info_.name });
  node_ = rclcpp::Node::make_shared("_", options);
  if (auto it = info_.hardware_parameters.find("trigger_joint_command_threshold"); it != info_.hardware_parameters.end())
  {
    trigger_joint_command_threshold_ = std::stod(it->second);
  }
  topic_based_joint_commands_publisher_ = node_->create_publisher<sensor_msgs::msg::JointState>(
      get_hardware_parameter("joint_commands_topic", "/robot_joint_commands"), rclcpp::QoS(1));
  topic_based_joint_states_subscriber_ = node_->create_subscription<sensor_msgs::msg::JointState>(
      get_hardware_parameter("joint_states_topic", "/robot_joint_states"), rclcpp::SensorDataQoS(),
      [this](const sensor_msgs::msg::JointState::SharedPtr joint_state) { latest_joint_state_ = *joint_state; });
  // if the values on the `joint_states_topic` are wrapped between -2*pi and 2*pi (like they are in Isaac Sim)
  // sum the total joint rotation returned on the `joint_states_` interface
  if (get_hardware_parameter("sum_wrapped_joint_states", "false") == "true")
  {
    sum_wrapped_joint_states_ = true;
  }
  return CallbackReturn::SUCCESS;
}
std::vector<hardware_interface::StateInterface> TopicBasedSystem::export_state_interfaces()
{
  std::vector<hardware_interface::StateInterface> state_interfaces;
  // Joints' state interfaces
  for (auto i = 0u; i < info_.joints.size(); i++)
  {
    const auto& joint = info_.joints[i];
    for (const auto& interface : joint.state_interfaces)
    {
      // Add interface: if not in the standard list then use "other" interface list
      if (!getInterface(joint.name, interface.name, i, joint_states_, state_interfaces))
      {
        throw std::runtime_error("Interface is not found in the standard list.");
      }
    }
  }


[ about ](/about/) |  [ faq ](/faq/) |  [ help ](/help/ "help") |  [ privacy
policy ](/privacy/) |  [ terms of service ](/terms/)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/k/848f3c/45.png)
](https://discourse.articulatedrobotics.xyz/u/ketill)


[ ROS2 nav2_turorial on win10 ERROR! ](/question/418092/ros2-nav2_turorial-on-
win10-error/)


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


Hello! I wanted to thank you for these amazing tutorials and ask for some
guidance on a problem I just ran into. While trying to build `
diffdrive_arduino ` , I received the following error:


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?


[
![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/jeffrey_jene/45/49_2.png)
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/a/ecae2f/45.png)
](https://discourse.articulatedrobotics.xyz/u/Afiq003)


Whereas ` diffdrive_arduino ` isn’t sending ROS messages at all, it is making
a pure serial connection to software on the other end, speaking a (very
simple) custom protocol. So you shouldn’t have rosserial or micro-ROS running
on the Arduino, it doesn’t know anything about ROS, just some simple motor
control serial commands. ` diffdrive_arduino ` is doing all the translation
from ROS to serial.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/l/898d66/45.png)
](https://discourse.articulatedrobotics.xyz/u/Linh_Nguy_n_D_ng)


    hardware_interface::return_type myrobotSystemPositionOnlyHardware::write(
      const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
    {

      // BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
    //  RCLCPP_INF    hardware_interface::return_type myrobotSystemPositionOnlyHardware::write(
      const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
    {

      // BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
    //  RCLCPP_INFO(rclcpp::get_logger("myrobotSystemPositionOnlyHardware"), "Writing...");

      for (uint i = 0; i < hw_commands_.size(); i++)
      {
        // Simulate sending commands to the hardware
        RCLCPP_INFO(
          rclcpp::get_logger("myrobotSystemPositionOnlyHardware"), "Got command %.5f for joint %d!",
          hw_commands_[i], i);

        hw_cmd_->points[0].positions[i] = hw_commands_[i];
      }
      hw_cmd_pub_->publishData(hw_cmd_);
    //  RCLCPP_INFO(
    //    rclcpp::get_logger("myrobotSystemPositionOnlyHardware"), "Joints successfully written!");
      // END: This part here is for exemplary purposes - Please do not copy to your production code

      return hardware_interface::return_type::OK;


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/56 "June  9, 2023
6:39pm")


So please post some more details about your hardware and how it’s wired up
(you can upload pictures to imgur and embed them here) and we’ll see what we
can figure out
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/59)


Thank you for bringing this to our attention!


![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/praveen_kumar/40/40_2.png)
Praveen_Kumar:


hardware_interface::[Actuator|Sensor|System]Interface


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/91)


Welcome!


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/60 "June 11, 2023
4:47am")


  1. When I try driving, all the wheels are reversed. I modified the diffdrive package to take inverted inputs (- for all vel1, vel2, vel3 and vel4). This seems to fix and motors driving correctly
  2. Teleop twist keyboard can be used to control the robot only if linear and angular velocity is set to 0.4xxx. Anything more than 5 or less than 3 does not move the wheels at all.
  3. Not all motors rotate at the same speed.


2 followers


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/a/4da419/45.png)
](https://discourse.articulatedrobotics.xyz/u/Adi)


[ ![image](https://get-
help.robotigniteacademy.com/uploads/default/original/2X/f/fcf87638a7ca6676c9259acb56e3657b90d1ea18.png)
image  1375×94 6.53 KB  ](https://get-
help.robotigniteacademy.com/uploads/default/original/2X/f/fcf87638a7ca6676c9259acb56e3657b90d1ea18.png
"image")


[ Where does message "Message Filter dropping message" comes from
](/question/409132/where-does-message-message-filter-dropping-message-comes-
from/)


[ Oct '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/79 "October  7,
2023  9:00am")


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[ Continue Discussion
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/2) 99 replies  [ Oct '22
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/2 "October 17, 2022  5:17pm")


Things i am going to try:


[ Jan '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/18 "January 28,
2023  7:30pm")


  return hardware_interface::return_type::OK;
}


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?


[ 7 Jan ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/96 "January  7,
2024  3:51am") [ ▶ Douglas_Beach
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/13)


[ Jan '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/17 "January 13,
2023 10:10pm")


> I’m also not sure what “Ko” is in the PID cod


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/39 "June  2, 2023
2:45am")


  1. is it possible that ill just make my own hard code controller instead of using diff drive from ros2 control package? Ill just convert the cmd_vel to left and right motor velocity.
  2. by doing the mentioned above, what are the disadvantages of this? I’m doing this because i don’t know how to get the hardware interfaces of the physical robot, i only know how to send commands which are the left and right motor velocities.


[ 1 reply ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/6)


#include <chrono>
#include <cmath>
#include <limits>
#include <memory>
#include <vector>


So, my questions are:


thanks a lot for sharing with us.


When you say it beeps, do you mean the router beeps or the Pi beeps? Perhaps
it is a power issue? How are you powering the router?


Summary: 4 packages finished [14.0s]
1 package failed: diffdrive_arduino
1 package had stderr output: diffdrive_arduino


Using a WebShell please cd into


###  [ UNAIB_USMANI
](https://discourse.articulatedrobotics.xyz/u/UNAIB_USMANI)


Hi, I’m having a problem getting my pi to locate the ros2 control package
using ‘sudo apt install’. It just cannot find it. I’ve updated and upgraded,
following the instructions here: [ Ubuntu (binary) — ROS 2 Documentation:
Humble documentation
](https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Install-
Binary.html)


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.


It worked for me. For reference, I switched to ROS foxy but the issue
persisted. I was connected to RPi over ssh and using nano for editing. I
ultimately connected to vscode over remote connection, replaced all my code
with the snippets provided in the blog by Josh ( I did this to
ros2_control.xacroa and the launch_robot.launch.py files though I couldn’t see
any difference between the two), removed the gazebo_control part completely
instead of commenting it out and recompiled and run the launch file. It
worked… Thankyou everyone and specially [ @JoshNewans
](https://discourse.articulatedrobotics.xyz/u/joshnewans) for these great
tutorials.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[ Oct '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/4 "October 17,
2022 10:31pm")


        auto index = static_cast<std::size_t>(std::distance(standard_interfaces_.begin(), it));
        // Check the initial_value param is used
        if (!interface.initial_value.empty())
        {
          joint_commands_[index][i] = std::stod(interface.initial_value);
        }
      }
    }
  }
  // Search for mimic joints
  for (auto i = 0u; i < info_.joints.size(); ++i)
  {
    const auto& joint = info_.joints.at(i);
    if (joint.parameters.find("mimic") != joint.parameters.cend())
    {
      const auto mimicked_joint_it = std::find_if(
          info_.joints.begin(), info_.joints.end(),
          [&mimicked_joint = joint.parameters.at("mimic")](const hardware_interface::ComponentInfo& joint_info) {
            return joint_info.name == mimicked_joint;
          });
      if (mimicked_joint_it == info_.joints.cend())
      {
        throw std::runtime_error(std::string("Mimicked joint '") + joint.parameters.at("mimic") + "' not found");
      }
      MimicJoint mimic_joint;
      mimic_joint.joint_index = i;
      mimic_joint.mimicked_joint_index =
          static_cast<std::size_t>(std::distance(info_.joints.begin(), mimicked_joint_it));
      auto param_it = joint.parameters.find("multiplier");
      if (param_it != joint.parameters.end())
      {
        mimic_joint.multiplier = std::stod(joint.parameters.at("multiplier"));
      }
      mimic_joints_.push_back(mimic_joint);
    }
  }
  const auto get_hardware_parameter = [this](const std::string& parameter_name, const std::string& default_value) {
    if (auto it = info_.hardware_parameters.find(parameter_name); it != info_.hardware_parameters.end())
    {
      return it->second;


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 )


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/c/ed8c4c/45.png)
](https://discourse.articulatedrobotics.xyz/u/Cliff_Andrew_Oliver)


does anyone has an idea?
Thanks


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


[ edit ](/s/answers/409093/edit/) flag offensive  delete  [ link
](/question/409067/why-is-trajectory_msgs__msg__jointtrajectory-not-valid-for-
publisher/?answer=409093#post-id-409093 "permanent link") more


[ rviz2 unable to create glx context ](/question/408252/rviz2-unable-to-
create-glx-context/)


In the meantime I’m not sure if anyone else has forked /updated it (I think
someone might have but
I can’t remember). If I do find out I’ll post here. As [ @BigShark3000
](https://discourse.articulatedrobotics.xyz/u/bigshark3000) helpfully noted,
you could have a go at porting it yourself using the ros2_control_demos - if
you do then let us know! That’s also a helpful note about the requirement to
swap the interface order.


You could achieve a similar result if you bypassed ros2_control completely and
wrote a custom node that interacted with Gazebo and also your robot but it
gets…messy (and I suspect probably won’t achieve the desired result,
especially with something like a mobile robot. It might be good for an arm)


[ 2 replies ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/60)


##  Question Tools


> Teleop twist keyboard can be used to control the robot only if linear and
> angular velocity is set to 0.4xxx. Anything more than 5 or less than 3 does
> not move the wheels at all.


###  [ Sasffm ](https://discourse.articulatedrobotics.xyz/u/Sasffm)


Thanks for your message. As mentioned on my answer to your question about
unit2, this should be solved running git pull:


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/o/9de053/45.png)
](https://discourse.articulatedrobotics.xyz/u/omar_salah)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/h/7ea924/45.png)
](https://discourse.articulatedrobotics.xyz/u/Hamza_Anwar)


can anyone please help me out


My current plan is that at the end of the build series (which is drawing
near!) I will do a video specifically on how to write a hardware interface for
humble, and as a demo I will take my foxy one and upgrade it.


I have commented out the spawner in my launch files since the controller
manager terminates automatically. Also my description file looks like:


    if (joint.state_interfaces[0].name != hardware_interface::HW_IF_POSITION)
    {
      RCLCPP_FATAL(
        rclcpp::get_logger("DiffBotSystemHardware"),
        "Joint '%s' have '%s' as first state interface. '%s' expected.", joint.name.c_str(),
        joint.state_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
      return CallbackReturn::ERROR;
    }


Yeah the old branch is foxy but I’m not really maintaining it.
The principles are all pretty similar so if you compare the two and watch [
this video ](https://youtu.be/J02jEKawE5U) you should be able to figure it
out.


###  [ ali_ghasemi ](https://discourse.articulatedrobotics.xyz/u/ali_ghasemi)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/d/54ee81/45.png)
](https://discourse.articulatedrobotics.xyz/u/Douglas_Beach)


[ error ](https://get-help.theconstruct.ai/tag/error)


###  [ Omar_Khaled ](https://discourse.articulatedrobotics.xyz/u/Omar_Khaled)


[
![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/addypete/45/33_2.png)
](https://discourse.articulatedrobotics.xyz/u/AddyPete)


###  [ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


What am I missing?


Any idea what’s going wrong? I’m surprised I can’t get the system to locate
it. Is there a workaround? Thanks for any help!


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/s/439d5e/45.png)
](https://discourse.articulatedrobotics.xyz/u/sampath_ganesh)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/l/898d66/45.png)
](https://discourse.articulatedrobotics.xyz/u/Linh_Nguy_n_D_ng)


[ May '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/33 "May 17, 2023
7:15am")


Hope it can be to any help and thanks again. Will update when i have found the
issue
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)


* I vaguely flagged this in the video, but I should not have used ` /dev/ttyUSB0 ` as that will sometimes be the lidar, instead I should set it by the path or ID (which I will do at some point).


namespace myrobot_controller_hardware {


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?


![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/addypete/40/33_2.png)
AddyPete:


Best regards,
Ivo


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:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/frowning.png?v=12)
) I’m glad it’s fixed for you though.


    position_goals = PathJoinSubstitution(
        [
            FindPackageShare("joint_trajectory_publisher"),
            "config",
            "lie_down_stand_up_publisher.yaml",
        ]
    )


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


What i mean with i can send only motor commands. Is that by using pyserial and
ESP32 in my laptop, i’ll just write a certain string that indicated the speed
value of both motors for example, the string is “0.5,1.0&\n” (0.5 = left motor
speed, 1.0 = right motor speed) then i use arduino.write() to send those
command sending it to another ESP32 that has arduino attached to it.


Yeah me too. I didn’t write the Arduino code (just made some small mods) and
would like to do it from scratch.


      if (
        hardware_interface::SystemInterface::on_init(info) !=
        hardware_interface::CallbackReturn::SUCCESS)
      {
        return hardware_interface::CallbackReturn::ERROR;
      }

      // BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
      hw_start_sec_ = stod(info_.hardware_parameters["example_param_hw_start_duration_sec"]);
      hw_stop_sec_ = stod(info_.hardware_parameters["example_param_hw_stop_duration_sec"]);
      hw_slowdown_ = stod(info_.hardware_parameters["example_param_hw_slowdown"]);
      // END: This part here is for exemplary purposes - Please do not copy to your production code
      hw_states_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());
      hw_commands_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());

      hw_cmd_->joint_names[0] = "hip";
      hw_cmd_->joint_names[1] = "shoulder";
      hw_cmd_->joint_names[2] = "elbow";
      hw_cmd_->joint_names[3] = "wrist";
      hw_cmd_->points[0].positions[0] = 0.0;
      hw_cmd_->points[0].positions[1] = 0.0;
      hw_cmd_->points[0].positions[2] = 0.0;
      hw_cmd_->points[0].positions[3] = 0.0;

    .....
      return hardware_interface::CallbackReturn::SUCCESS;
    }


hardware_interface::return_type DiffBotSystemHardware::read()
{
  RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Reading...");


###  [ Afiq003 ](https://discourse.articulatedrobotics.xyz/u/Afiq003)


I am confused by the two styles ` trajectory_msgs__msg__JointTrajectory ` and
` trajectory_msgs::msg::JointTrajectory ` .
Do I understand it right one is C notation the other is C++?


    ament_cmakeConfig.cmake
    ament_cmake-config.cmake


As I understand it the fix is a bit more involved than just the dependence on
that file, and that it was a more substantial change to the API.


  return CallbackReturn::SUCCESS;
}


Also I ran controller_manager and no connection
ros2 run controller_manager spawner diff_cont
[INFO] [1703828709.701625640] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[INFO] [1703828711.722023739] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[INFO] [1703828713.742430911] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[INFO] [1703828715.764174999] [spawner_diff_cont]: Waiting for
‘/controller_manager’ node to exist
[ERROR] [1703828717.784713751] [spawner_diff_cont]: Controller manager not
available
[ros2run]: Process exited with failure 1


[ Oct '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/5 "October 18,
2022  7:58pm") [ ▶ Sasffm
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/4)


There are a bunch of places that wheel reversing can occur, depending on your
hardware. Getting the wrong pins on the driver in, the driver out, the
controller, the wrong axis direction in URDF, etc. It sounds like what you’ve
done there is probably not the “correct” solution, but if it works, it works
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)


###  [ Praveen_Kumar
](https://discourse.articulatedrobotics.xyz/u/Praveen_Kumar)


[ Nov '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/89 "November 29,
2023  3:14am")


Except the joint_trajectory_publisher.yaml file doesn’t exist on the bitbucket
site yet. Could you add it?


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/43 "June  3, 2023
10:13pm")


##  Related questions


[ Sep '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/75 "September 12,
2023  9:28pm")


Thank you very much!


[ rzegers  ](https://get-help.theconstruct.ai/u/rzegers) May 10, 2022, 10:33am
6


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


Hi Josh, do you know if it is possible to implement a real controller of a
robot (reality) and in parallel a Gazebo simulation so that ros2_control
controls both the hardware and the behavior in Gazebo like a digital twin? In
your article i understood that its either the real robot or gazebo simulation.


###  [ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/u/Jeffrey_Jene)


Hi Josh, thanks a lot for your tutorials,


I think the problem is that it goes to start up the hardware interface but it
can’t see the device on the specified serial port and so it fails. A few
things to check here:


See the documentation on the hardware_interface for the ros2_control, on
github


I was able to resolve this issue by cloning the repo from buzzology github and
then rebuilt the whole project with colcon .


[ The Construct ROS Community ](/)


So just to confirm, did you manage to build ` diffdrive_arduino ` after my
last reply?


###  [ Adi ](https://discourse.articulatedrobotics.xyz/u/Adi)


I also found this confusing. I believe this and also the reason everything is
done in “encoder ticks per loop” is to avoid doing floating point arithmetic
in the Arduino. So the ` Ko ` just scales things up. E.g. if we want ` Kp =
0.5 ` (and ` Ko = 1 ` ) we can’t do that, so instead we set ` Kp = 5 ` and `
Ko = 10 ` .
It’s a little while since I dug into it though so that might be not quite
right.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


###  [ BigShark3000
](https://discourse.articulatedrobotics.xyz/u/BigShark3000)


I watched the video “You can use ANY hardware with ros2_control”, I downloaded
the code of that video, The purpose of that code is that I want to use the
frame available in the code to connect to the arduino mega board. Currently I
am in the stage of connecting ros2_control to arduino through the code
framework available in the video, But I have connection problems when
launching the diffbot.launch.py file, currently I am working on the ros_humble
version. I’m really sorry that my English sentence seems grammatically
incorrect. Thank you everyone for your help.
I just edited the device parameter:


Did you install ` ros2_control ` (e.g. with ` sudo apt install ros-foxy-
ros2-control ` )?
That should provide the ` hardware_interface ` dependency.


Hi [ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/joshnewans)
thanks a lot for the videos, They helped me a lot to understand ROS2 and how
to build a differential drive bot. I am working on a 4 WD and have been
following your tutorials until " ` [Using ros2_control to drive our robot (off
the edge of the bench...)](https://www.youtube.com/watch?v=4VVrTCnxvSw&t=601s)
` " video. I am facing some trouble after changing to ros2_control, The issue
is that my robot is not moving either left or right in gazebo but it seems to
move in Rviz as expected. I have searched all the online resources but did not
find anything that helps.
here is the link to my repo [ GitHub - BooraKaushik/autobot
](https://github.com/BooraKaushik/autobot)
Video of what is happening, [ IMG_5920.mov - Google Drive
](https://drive.google.com/file/d/1HQrvvV8iWDbZdpng4oNF73YuQRl-
ay5P/view?usp=sharing)
as you can see it is turning fine in rviz but not in gazebo.


[ May '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/38 "May 18, 2023
9:43pm")


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/f/7c8e57/45.png)
](https://discourse.articulatedrobotics.xyz/u/FrankfurtDynamics)


Asked: ** 2022-11-07 07:51:32 -0500  **


CallbackReturn DiffBotSystemHardware::on_deactivate(
  const rclcpp_lifecycle::State & /*previous_state*/)
{
  // START: This part here is for exemplary purposes - Please do not copy to your production code
  RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Deactivating ...please wait...");


[ Oct '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/3 "October 17,
2022  8:08pm") [ ▶ Sasffm
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/2)


Hello
All the hardware and software I use are the same as the one you use. The
router is the same. When I connect the router to the development machine with
ethernet as you do, and when I connect it to the raspberry pi 4, when I want
to control the robot as in the 13th video, it gives a biiiip sound and cuts
the internet for a short time. It gives buffer.cpp error, where could I have
made a mistake?


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/k/c6cbf5/45.png)
](https://discourse.articulatedrobotics.xyz/u/KaushikBoora)


  // set some default values
  for (auto i = 0u; i < hw_positions_.size(); i++)
  {
    if (std::isnan(hw_positions_[i]))
    {
      hw_positions_[i] = 0;
      hw_velocities_[i] = 0;
      hw_commands_[i] = 0;
    }
  }


Interesting, I have had similar problems with other motors. I still got them
to work but they were a bit more sensitive to the PID settings.


Please open the file ` joint_trajectory_publisher.launch.py ` and locate this
block of code:


###  [ JoshNewans ](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


I am using Arduino UNO instead of Nano, there is no issues when I do launch
launch_robot file and it tells me that all controllers configured correctly
but when I try to drive it with teleop, none of the motors move!!.. my driver
EN pins on the UNO are 6,3,9,5.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/m/c57346/45.png)
](https://discourse.articulatedrobotics.xyz/u/martoliod)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/a/3e96dc/45.png)
](https://discourse.articulatedrobotics.xyz/u/Agnes_Soesanto)


    if (joint.command_interfaces[0].name != hardware_interface::HW_IF_VELOCITY)
    {
      RCLCPP_FATAL(
        rclcpp::get_logger("DiffBotSystemHardware"),
        "Joint '%s' have %s command interfaces found. '%s' expected.", joint.name.c_str(),
        joint.command_interfaces[0].name.c_str(), hardware_interface::HW_IF_VELOCITY);
      return CallbackReturn::ERROR;
    }


#node


I was thinking of having the callback call a multithreaded version of the image processing function. For my application, I need the result of my image processing function to have the timestamp of the WM_PAINT messages in sequence even if a later threaded call to the image processing function completes before an earlier threaded call to the image processing function.


  * [ Blog ](https://blog.logrocket.com/)
    * [ Dev ](https://blog.logrocket.com/dev)
    * [ Product Management ](https://blog.logrocket.com/product-management)
    * [ UX Design ](https://blog.logrocket.com/ux-design)
    * [ Podcast ](https://podrocket.logrocket.com)
  * [ Features ](https://logrocket.com/features)
  * Solutions
    * [ Solve User-Reported Issues ](https://logrocket.com/solutions/solve-user-issues)
    * [ Find Issues Faster ](https://logrocket.com/solutions/find-issues-faster)
    * [ Optimize Conversion and Adoption ](https://logrocket.com/solutions/optimize-conversion-adoption)


Reply


I don't understand the following about your last comments in light of the MSDN docs:
Whatever. ..., but WM_PAINT might just be a special case, because it is never queued like the other messages. Instead, a flag is set. A pecularity of WM_PAINT is that it's always the last message to be retrieved.
I appreciate your maxim: "Users of MS Windows should not be programmers", but maybe you can help anyway.
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.


##  Links