Please let me know if there are any issues,


(P.S. I’ve responded to your other message)


That’s very odd. To start with diagnosing I’ll need more detail on your
motors/controllers/drivers etc. (which might also help us with problem 1).
Depending on how things are being mapped it’s not unusual for there to be a
lower limit that it won’t turn below, but an upper limit is strange.


        joint_state.position[mimic_joint.joint_index] =
            mimic_joint.multiplier * joint_state.position[mimic_joint.mimicked_joint_index];
      }
      else if (interface.name == hardware_interface::HW_IF_VELOCITY)
      {
        joint_state.velocity[mimic_joint.joint_index] =
            mimic_joint.multiplier * joint_state.velocity[mimic_joint.mimicked_joint_index];
      }
      else if (interface.name == hardware_interface::HW_IF_EFFORT)
      {
        joint_state.effort[mimic_joint.joint_index] =
            mimic_joint.multiplier * joint_state.effort[mimic_joint.mimicked_joint_index];
      }
    }
  }
  if (rclcpp::ok())
  {
    topic_based_joint_commands_publisher_->publish(joint_state);
  }
  return hardware_interface::return_type::OK;
}
}  // end namespace topic_based_ros2_control
#include "pluginlib/class_list_macros.hpp"
PLUGINLIB_EXPORT_CLASS(topic_based_ros2_control::TopicBasedSystem, hardware_interface::SystemInterface)


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


I will try all your suggestions. I forgot to mention that the wheel radius is
indeed quite large compared with your example (0.09[m]). The wheel separation
is 0.43[m]. Also the test of driving a distance and spinning in rviz2 is
correct compared to the real robot. (One meter in rviz is one meter on the
robot and 360 deg is 360 deg on the robot). I am currently using the full
navigation stack so the problem could be higher up but the issue of wrong
speed remains when driving with a controller so the issue should not be there
(checked agains /cmd_vel message).


>
> hardware_interface::BaseInterface<hardware_interface::[Actuator|Sensor|System]Interface>


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


After fooling around with it quite a bit, I do see that it is the PID values,
possible something else as well. I could sit and fool with the values, but the
behavior is still strange (the motors start slow and rev up to the required
speed, but overshoot it and reverse directions). Open loop control works
great. I would love to rewrite this thing at some point. I’m fuzzy on a few
things I need to research first, like how to translate input tick count to
speed to PWM. I’m also not sure what “Ko” is in the PID code. Josh, what are
the RPM speeds of your motors? I think mine are about 250 or so, maybe too
much for this application (if that even makes a difference). Anyway, I’ll keep
fussing with it.


Using your code editor please cd into `
~/ros2_ws/src/ros2_control_course/unit5/diffbot_sim/launch ` and open the file
` diffbot_controllers.launch.py ` .


[ Jul '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/69 "July  5, 2023
7:58am") [ ▶ Jeffrey_Jene
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/67)


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


^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-1] [INFO] [1712228830.109878910] [rclcpp]:
signal_handler(signal_value=2)
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 13688]


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/46 "June  6, 2023
9:35am") [ ▶ AddyPete
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/44)


Did you source your ROS installation first? (i.e. ` source
/opt/ros/foxy/setup.bash ` )?


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


Hey! This is an issue I’m well aware of (just this week someone [ flagged it
on GitHub ](https://github.com/joshnewans/diffdrive_arduino/issues/1) too),
but have not put any energy into resolving yet.


old:


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


If I were to adapt this code for a different robot with different hardware or
control requirements, what aspects of this line would I need to modify?


Cheers,
Ivo


[ Autoware.auto Master branch source code failed
](/question/375372/autowareauto-master-branch-source-code-failed/)


The MicroRos and ros2_control combo seems pretty new and I can find very
little about it. I’ve been working on this for a few weeks now but I’m not
getting any further.


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


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


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


  1. Can I use the previous serial_motor_demo library to complete SLAM setup?
  2. Any ideas why the robot is not responding to twist correctly?


  double radius = 0.02;  // radius of the wheels
  double dist_w = 0.1;   // distance between the wheels
  double dt = 0.01;      // Control period
  for (uint i = 0; i < hw_commands_.size(); i++)
  {
    // Simulate DiffBot wheels's movement as a first-order system
    // Update the joint status: this is a revolute joint without any limit.
    // Simply integrates
    hw_positions_[i] = hw_positions_[1] + dt * hw_commands_[i];
    hw_velocities_[i] = hw_commands_[i];


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


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


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


[ ![cc-by-sa](/m/default/media/images/cc-by-sa.png?v=28)
](http://creativecommons.org/licenses/by-sa/3.0/legalcode) ROS Answers is
licensed under Creative Commons Attribution 3.0 Content on this site is
licensed under a [ Creative Commons Attribution Share Alike 3.0
](http://creativecommons.org/licenses/by-sa/3.0/legalcode) license.


what exactly did u do to resolve this? Thanks alot in advance!


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


    [INFO] [launch]: All log files can be found below /home/vahin/.ros/log/2023-06-07-09-52-16-628234-ubuntu-13541
    [INFO] [launch]: Default logging verbosity is set to INFO
    [INFO] [robot_state_publisher-1]: process started with pid [13544]
    [robot_state_publisher-1] Parsing robot urdf xml string.
    [robot_state_publisher-1] Link chassis had 2 children
    [robot_state_publisher-1] Link caster_wheel 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] [1686131537.466259297] [robot_state_publisher]: got segment base_link
    [robot_state_publisher-1] [INFO] [1686131537.466644027] [robot_state_publisher]: got segment caster_wheel
    [robot_state_publisher-1] [INFO] [1686131537.466723784] [robot_state_publisher]: got segment chassis
    [robot_state_publisher-1] [INFO] [1686131537.466753468] [robot_state_publisher]: got segment laser_frame
    [robot_state_publisher-1] [INFO] [1686131537.466781004] [robot_state_publisher]: got segment left_wheel
    [robot_state_publisher-1] [INFO] [1686131537.466809170] [robot_state_publisher]: got segment right_wheel
    [INFO] [ros2_control_node-2]: process started with pid [13606]
    [INFO] [spawner.py-3]: process started with pid [13608]
    [INFO] [spawner.py-4]: process started with pid [13610]
    [ros2_control_node-2] [INFO] [1686131543.680967466] [DiffDriveArduino]: Configuring...
    [ros2_control_node-2] [INFO] [1686131543.687668416] [DiffDriveArduino]: Finished Configuration
    [ros2_control_node-2] [INFO] [1686131543.688505651] [DiffDriveArduino]: Starting Controller...
    [ros2_control_node-2] [INFO] [1686131545.719892550] [controller_manager]: update rate is 30 Hz
    [ros2_control_node-2] [INFO] [1686131545.762545973] [controller_manager]: Loading controller 'diff_cont'
    [ros2_control_node-2] [ERROR] [1686131545.762714005] [controller_manager]: Loader for controller 'diff_cont' not found.
    [ros2_control_node-2] [INFO] [1686131545.762758207] [controller_manager]: Available classes:
    [ros2_control_node-2] [INFO] [1686131545.762797873] [controller_manager]:   controller_manager/test_controller
    [ros2_control_node-2] [INFO] [1686131545.762828928] [controller_manager]:   controller_manager/test_controller_failed_init
    [ros2_control_node-2] [INFO] [1686131545.762866667] [controller_manager]:   controller_manager/test_controller_with_interfaces
    [ros2_control_node-2] [INFO] [1686131545.835433835] [controller_manager]: Loading controller 'joint_broad'
    [ros2_control_node-2] [ERROR] [1686131545.835685402] [controller_manager]: Loader for controller 'joint_broad' not found.
    [ros2_control_node-2] [INFO] [1686131545.835744493] [controller_manager]: Available classes:
    [ros2_control_node-2] [INFO] [1686131545.835786603] [controller_manager]:   controller_manager/test_controller
    [ros2_control_node-2] [INFO] [1686131545.835817731] [controller_manager]:   controller_manager/test_controller_failed_init
    [ros2_control_node-2] [INFO] [1686131545.835846286] [controller_manager]:   controller_manager/test_controller_with_interfaces
    [ERROR] [spawner.py-4]: process has died [pid 13610, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py diff_cont --ros-args'].
    [ERROR] [spawner.py-3]: process has died [pid 13608, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint_broad --ros-args'].


[ Powered by Askbot version 0.10.2 ](http://askbot.com)


Please help me, my graduation project is depending on that


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


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


so I'd expect you also need to use the c++ namespace syntax:


(udp/192.168.1.107) selected arbitrarily from: wlan0,
docker0\n1712227470.409871 [0] ros2: using network interface wlan0
(udp/192.168.1.107) selected arbitrarily from: wlan0, docker0\n’)>
Traceback (most recent call last):
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py”,
line 228, in _process_one_event
await self.__process_event(next_event)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py”,
line 248, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context))
File “/opt/ros/foxy/lib/python3.8/site-
packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py”,
line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity,
context)
File “/opt/ros/foxy/lib/python3.8/site-
packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py”,
line 38, in visit_all_entities_and_collect_futures
sub_entities = entity.visit(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py”, line 108,
in visit
return self.execute(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py”,
line 444, in execute
self._perform_substitutions(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py”,
line 399, in _perform_substitutions
evaluated_parameters = evaluate_parameters(context, self.__parameters)
File “/opt/ros/foxy/lib/python3.8/site-
packages/launch_ros/utilities/evaluate_parameters.py”, line 164, in
evaluate_parameters
output_params.append(evaluate_parameter_dict(context, param))
File “/opt/ros/foxy/lib/python3.8/site-
packages/launch_ros/utilities/evaluate_parameters.py”, line 71, in
evaluate_parameter_dict
evaluated_value = perform_substitutions(context, list(value))
File “/opt/ros/foxy/lib/python3.8/site-
packages/launch/utilities/perform_substitutions_impl.py”, line 26, in
perform_substitutions
return ‘’.join([context.perform_substitution(sub) for sub in subs])


  for (const hardware_interface::ComponentInfo & joint : info_.joints)
  {
    // DiffBotSystem has exactly two states and one command interface on each joint
    if (joint.command_interfaces.size() != 1)
    {
      RCLCPP_FATAL(
        rclcpp::get_logger("DiffBotSystemHardware"),
        "Joint '%s' has %zu command interfaces found. 1 expected.", joint.name.c_str(),
        joint.command_interfaces.size());
      return CallbackReturn::ERROR;
    }


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


#endif  // ROS2_CONTROL_DEMO_HARDWARE__DIFFBOT_SYSTEM_HPP_
@hongjin-su
Comment

Leave a comment

Footer
© 2024 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Docs
Contact
Manage cookies
Do not share my personal information


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


[ Nov '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/12 "November 27,
2022 12:49am") [ ▶ JoshNewans
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/11)


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


hello Mr joshNewans i have a problem when i try to run this command ros2
launch articubot_one launch_robot.launch.py
the error is :
[INFO] [launch]: All log files can be found below
/home/omar/.ros/log/2023-12-19-14-15-50-067095-omarlegiony540-15500
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [15503]
[INFO] [twist_mux-2]: process started with pid [15505]
[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 3 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 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] [1702988150.253367756]
[robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1702988150.253457840]
[robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1702988150.253472042]
[robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1702988150.253482521]
[robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-1] [INFO] [1702988150.253492593]
[robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1702988150.253502422]
[robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1702988150.253512065]
[robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1702988150.253521801]
[robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1702988150.253531529]
[robot_state_publisher]: got segment right_wheel
[twist_mux-2] [INFO] [1702988150.253417560] [twist_mux]: Topic handler
‘topics.joystick’ subscribed to topic ‘cmd_vel_joy’: timeout = 0.500000s ,
priority = 100.
[twist_mux-2] [INFO] [1702988150.253767902] [twist_mux]: Topic handler
‘topics.navigation’ subscribed to topic ‘cmd_vel’: timeout = 0.500000s ,


Yeah, by the sound of things it’s worth stepping through the details of your
setup and making sure the low-level motor control is working before touching
the ROS-level stuff. If it’s broken then no amount of ROS tweaking will fix
things!


![](https://github.githubassets.com/favicons/favicon.svg) [ GitHub
](https://github.com/RedstoneGithub/diffdrive_arduino)


Both it is even a problem when I just use the ROS-Arduino-Bridge.ino and
miniterm. When I type o 255 255 or negative it works fine. When I type o 255
-255 the motors don’t turn at all.


[ ALL ](/questions/scope:all/sort:activity-desc/page:1/) [ UNANSWERED
](/questions/scope:unanswered/sort:answers-asc/page:1/)


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


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


[ Dec '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/14 "December 10,
2022 11:55pm")


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


Hi,


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


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


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


Sounds fair.
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)
I have now joined Patreon.


###  [ The-Kriz ](https://discourse.articulatedrobotics.xyz/u/The-Kriz)


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


  * ` o 255 0 `
  * ` o -255 0 `
  * ` o 0 255 `
  * ` o 0 -255 `
All work as expected?


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


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


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


[ Dec '22 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/13 "December  8,
2022  4:54pm")


  * [ Home ](/)
  * [ Categories ](/categories)
  * [ FAQ/Guidelines ](/guidelines)
  * [ Terms of Service ](http://www.theconstructsim.com/terms_and_conditions/)
  * [ Privacy Policy ](http://www.theconstructsim.com/privacy_policy/)


> i’m a bit confused by your solution.


  1. the name of the plugin should be diffdrive_arduino/DiffDriveArduinoHardware
  2. the name of the timeout parameter should be timeout_ms
  3. the sequence of the state_interface should be position then velocity, see correct xml code below:


The diffdrive_arduino was succesfull build.
But i am getting errors when running “ros2 launch articubot_one
launch_robot.launch.py”


If the services are not available, that suggests the controller manager is not
running - you can confirm this with ` ros2 node list ` . If it is not running,
check that it’s in your launch file properly, that you are running the correct
launch file, and that there are no errors in the output of the launch.


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/r/e9bcb4/45.png)
](https://discourse.articulatedrobotics.xyz/u/Robotawi)


* Remove include of headers ` base_interface.hpp ` and ` hardware_interface_status_values.hpp `


[ ![GUENNI gravatar image](/m/default/media/images/nophoto.png?v=28)
](/users/55678/guenni/) [ GUENNI ](/users/55678/guenni/) (  2022-11-08
07:54:13 -0500  )  edit


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


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


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/j/4af34b/45.png)
](https://discourse.articulatedrobotics.xyz/u/Jon_Peroutka)


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


      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;


Glad you got it sorted.
I was going to suggest checking that you were running the `
joint_state_broadcaster ` which is responsible for publishing the joint states
when using ros2_control, which are then read by ` robot_state_publisher ` to
broadcast the transforms. Including that as a note in case someone has a
similar (but different!) issue to what you did
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)


> Can I use the previous serial_motor_demo library to complete SLAM setup?


Update:


Any ideas would be welcome. Thank you


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


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


Hi Josh, thanks for this great tutorial. However I’m facing issue when
unbreaking gazebo. I follow your tutorial exactly, but when i launch my
launch_sim.launch.py, i get this error instead


[ [ROS2] Issues with OptionsWithAllocator in humble
](/question/403060/ros2-issues-with-optionswithallocator-in-humble/)


Seen: **141 times**


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


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


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


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


Thank you for your great and fast answer! And it’s amazing to get a great
tutorial on the whole motor control chain. For me it was a very hard issue to
solve by myself.


gmake[2]: *** [CMakeFiles/diffdrive_arduino.dir/build.make:76:
CMakeFiles/diffdrive_arduino.dir/src/diffdrive_arduino.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs…
gmake[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/diffdrive_arduino.dir/all]
Error 2
gmake: *** [Makefile:146: all] Error 2


[ 20 Mar ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/102 "March 20,
2024 10:07am")


It seems like xacro itself was failing - possibly you had an error in your
URDF?


std::vector<hardware_interface::StateInterface> DiffBotSystemHardware::export_state_interfaces()
{
  std::vector<hardware_interface::StateInterface> state_interfaces;
  for (auto i = 0u; i < info_.joints.size(); i++)
  {
    state_interfaces.emplace_back(hardware_interface::StateInterface(
      info_.joints[i].name, hardware_interface::HW_IF_POSITION, &hw_positions_[i]));
    state_interfaces.emplace_back(hardware_interface::StateInterface(
      info_.joints[i].name, hardware_interface::HW_IF_VELOCITY, &hw_velocities_[i]));
  }


  return CallbackReturn::SUCCESS;
}


    if (joint.state_interfaces.size() != 2)
    {
      RCLCPP_FATAL(
        rclcpp::get_logger("DiffBotSystemHardware"),
        "Joint '%s' has %zu state interface. 2 expected.", joint.name.c_str(),
        joint.state_interfaces.size());
      return CallbackReturn::ERROR;
    }


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


We don’t use rasberry pi btw, just like you did.
So it’s basically i’m sending a string command with my laptop connected to
esp32 then another esp32 connected to arduino just received the command, and i
don’t know how the hardware guy works around with that string i have sent. I
can ask him if necessary to provide more information.


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


[ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/joshnewans) Hi!
Firstly, amazing tutorial which clearly explains how to interface to a real
robot. However, I am facing an issue when launching the real robot. The error
is as below


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


[robot_state_publisher-1] [INFO] [1703963064.974666931]
[robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1703963064.974673816]
[robot_state_publisher]: got segment leftb_wheel
[robot_state_publisher-1] [INFO] [1703963064.974680677]
[robot_state_publisher]: got segment leftf_wheel
[robot_state_publisher-1] [INFO] [1703963064.974687395]
[robot_state_publisher]: got segment right_wheel
[robot_state_publisher-1] [INFO] [1703963064.974694133]
[robot_state_publisher]: got segment rightb_wheel
[robot_state_publisher-1] [INFO] [1703963064.974701012]
[robot_state_publisher]: got segment rightf_wheel
[INFO] [ros2_control_node-3]: process started with pid [26338]
[INFO] [spawner.py-4]: process started with pid [26340]
[INFO] [spawner.py-5]: process started with pid [26342]
[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
[spawner.py-4] [INFO] [1703963069.430926611] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1703963069.431065690] [spawner_diff_cont]: Waiting for
/controller_manager services
[ERROR] [ros2_control_node-3]: process has died [pid 26338, exit code -6, cmd
‘/opt/ros/foxy/lib/controller_manager/ros2_control_node --ros-args --params-
file /tmp/launch_params_8fuljyhu --params-file
/home/omar/real_ws/install/medo/share/medo/config/my_controllers.yaml’].
[spawner.py-4] [INFO] [1703963071.446737365] [spawner_joint_broad]: Waiting
for /controller_manager services
[spawner.py-5] [INFO] [1703963071.447554445] [spawner_diff_cont]: Waiting for
/controller_manager services
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[twist_mux-2] [INFO] [1703963073.455811200] [rclcpp]:
signal_handler(signal_value=2)
[robot_state_publisher-1] [INFO] [1703963073.455834934] [rclcpp]:
signal_handler(signal_value=2)
[spawner.py-5] Traceback (most recent call last):


[ system  ](https://get-help.theconstruct.ai/u/system) Closed  May 20, 2022,
10:41am  8


Very good hints !
The problem was the ‘dialout’ group.
After adding the user to the ‘dialou’ group everything works out fine.
Thank you , that was a excellent support.
Looking forward to the next video .


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


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/t/54ee81/45.png)
](https://discourse.articulatedrobotics.xyz/u/The-Kriz)


RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Successfully deactivated!");


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


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/r/8e8cbc/45.png)
](https://discourse.articulatedrobotics.xyz/u/robotmaker)


  return command_interfaces;
}


File “/opt/ros/foxy/lib/python3.8/site-
packages/launch/utilities/perform_substitutions_impl.py”, line 26, in
return ‘’.join([context.perform_substitution(sub) for sub in subs])
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_context.py”,
line 232, in perform_substitution
return substitution.perform(self)
File “/opt/ros/foxy/lib/python3.8/site-
packages/launch/substitutions/command.py”, line 122, in perform
raise SubstitutionFailure(on_stderr_message)
launch.substitutions.substitution_failure.SubstitutionFailure: executed
command showed stderr output. Command: ros2 param get --hide-type
/robot_state_publisher robot_description
Captured stderr output:
1712227469.524891 [0] ros2: using network interface wlan0 (udp/192.168.1.107)
selected arbitrarily from: wlan0, docker0
1712227470.409871 [0] ros2: using network interface wlan0 (udp/192.168.1.107)
selected arbitrarily from: wlan0, docker0


    Starting >>> serial
    Starting >>> serial_motor_demo_msgs
    Finished <<< serial [1.69s]
    Starting >>> diffdrive_arduino
    Finished <<< serial_motor_demo_msgs [3.61s]
    Starting >>> serial_motor_demo
    --- stderr: diffdrive_arduino
    CMake Error at CMakeLists.txt:16 (find_package):
      By not providing "Findhardware_interface.cmake" in CMAKE_MODULE_PATH this
      project has asked CMake to find a package configuration file provided by
      "hardware_interface", but CMake did not find one.

      Could not find a package configuration file provided by
      "hardware_interface" with any of the following names:

        hardware_interfaceConfig.cmake
        hardware_interface-config.cmake

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

    ---
    Failed   <<< diffdrive_arduino [5.06s, exited with code 1]
    Aborted  <<< serial_motor_demo [3.37s]

    Summary: 2 packages finished [8.30s]
      1 package failed: diffdrive_arduino
      1 package aborted: serial_motor_demo
      1 package had stderr output: diffdrive_arduino


std::vector<hardware_interface::CommandInterface> DiffBotSystemHardware::export_command_interfaces()
{
  std::vector<hardware_interface::CommandInterface> command_interfaces;
  for (auto i = 0u; i < info_.joints.size(); i++)
  {
    command_interfaces.emplace_back(hardware_interface::CommandInterface(
      info_.joints[i].name, hardware_interface::HW_IF_VELOCITY, &hw_commands_[i]));
  }


Please note: ROS Answers requires javascript to work properly, please enable
javascript in your browser, [ here is how
](https://www.google.com/support/bin/answer.py?answer=23852)


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


So my question is:
Can diffdrive_arduino work in this setup?
If so, how do I get that to work?
If diffdrive_arduino can’t work, what are my options?


CallbackReturn DiffBotSystemHardware::on_activate(
  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"), "Activating ...please wait...");


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


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


Hello [ @roman.smid ](/u/roman.smid) ,


[ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/joshnewans) sir .
I was able to run the robot in real time but unable to run in the rviz i.e the
robot was not moving in the rviz
I have tried to change frames but no result , is there any solution I was
using ros2 humble and 22.04


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/53 "June  8, 2023
1:04pm") [ ▶ JoshNewans
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/51)


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


Thank you for your answer. It helped me to get rid of most errors. I update my
question with the corrected version. There is one error left. I hope for
another good hint.


> 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


[ 5 Jan ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/95 "January  5,
2024 11:46am")


[ Dec '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/90 "December 19,
2023 12:21pm")


I haven’t got Patreon and Discourse synced up yet though and have to update
user permissions manually, so don’t be afraid to remind me if needed
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)


I have updated the git repository for the course to make sure that other
students do not experience the same problem.


This is unfortunate, but not too surprising. Again, we’ll need more details on
how you have things hooked up but this is where the PID controller comes into
play (which if you’re following the tutorials will be external to ROS/Pi
stuff, in an Arduino or some other dedicated controller). The quality control
of the motors will be a factor, but the PID controller should be able to be
tuned to get the motors performing fairly similarly. If you don’t have a PID
controller and are running in open loop, that might also be the cause of
problem 2.


std::shared_ptr<HardwareCommandPub> hw_cmd_pub_;    //make the publisher node a member


Let me know how you go with that or if you need further assistance
![:slight_smile:](https://discourse.articulatedrobotics.xyz/images/emoji/twitter/slight_smile.png?v=12)


2. In the **diff_drive_controller** section I am getting this following error


Failed <<< serial_motor_demo_msgs [0.38s, exited with code 1]


[ 4 Apr ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/105 "April  4,
2024 11:12am")


Sort by »  [ oldest  ](/question/409067/why-is-
trajectory_msgs__msg__jointtrajectory-not-valid-for-
publisher/?sort=oldest#sort-top) [ newest  ](/question/409067/why-is-
trajectory_msgs__msg__jointtrajectory-not-valid-for-
publisher/?sort=latest#sort-top) [ most voted  ](/question/409067/why-is-
trajectory_msgs__msg__jointtrajectory-not-valid-for-
publisher/?sort=votes#sort-top)


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


Thank you very much!


        return ''.join([context.perform_substitution(sub) for sub in subs])
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
        return ''.join([context.perform_substitution(sub) for sub in subs])
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_context.py", line 232, in perform_substitution
        return substitution.perform(self)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/executable_in_package.py", line 76, in perform
        package_prefix = super().perform(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 79, in perform
        result = self.find(package)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/find_package.py", line 96, in find
        return get_package_prefix(package_name)
      File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py", line 52, in get_package_prefix
        raise PackageNotFoundError(
    ament_index_python.packages.PackageNotFoundError: "package 'twist_mux' not found, searching: ['/home/cliff/dev_ws/install/serial_motor_demo', '/home/cliff/dev_ws/install/serial_motor_demo_msgs', '/home/cliff/dev_ws/install/diffdrive_arduino', '/home/cliff/dev_ws/install/serial', '/home/cliff/dev_ws/install/articubot_one', '/opt/ros/foxy']"
    Task exception was never retrieved
    future: <Task finished name='Task-8' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=RuntimeError('Signal event received before subprocess transport available.')>
    Traceback (most recent call last):
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
        await self.__process_event(next_event)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
        visit_all_entities_and_collect_futures(entity, self.__context))
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
        sub_entities = entity.visit(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
        return self.execute(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/opaque_function.py", line 75, in execute
        return self.__function(context, *self.__args, **self.__kwargs)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 443, in __on_signal_process_event
        raise RuntimeError('Signal event received before subprocess transport available.')
    RuntimeError: Signal event received before subprocess transport available.
    [INFO] [robot_state_publisher-1]: process started with pid [4345]
    [robot_state_publisher-1] Parsing robot urdf xml string.
    [robot_state_publisher-1] Link base_footprint had 0 children
    [robot_state_publisher-1] Link chassis had 4 children
    [robot_state_publisher-1] Link camera_link had 1 children
    [robot_state_publisher-1] Link camera_link_optical had 0 children
    [robot_state_publisher-1] Link 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


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


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


Yep


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


Is this caused by the message type or by the way the pointer is defined? A
standard string message type gives no error.


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


Controller manager not available
[spawner.py-5] [ERROR] [1702988164.828567043] [spawner_diff_cont]: Controller
manager not available
[ERROR] [spawner.py-4]: process has died [pid 15543, exit code 1, cmd
‘/opt/ros/foxy/lib/controller_manager/spawner.py joint_broad --ros-args’].
[ERROR] [spawner.py-5]: process has died [pid 15545, exit code 1, cmd
‘/opt/ros/foxy/lib/controller_manager/spawner.py diff_cont --ros-args’].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[twist_mux-2] [INFO] [1702988175.110388053] [rclcpp]:
signal_handler(signal_value=2)
[robot_state_publisher-1] [INFO] [1702988175.110824006] [rclcpp]:
signal_handler(signal_value=2)
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 15503]
[INFO] [twist_mux-2]: process has finished cleanly [pid 15505]


How do i solve this?


    // Declaration of the publisher_ attribute
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_;


then please replace it by this block:


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


Hello I’m a beginner in robotics, im mainly a software guy. With that said, i
have a question.


  // Store the command for the simulated robot
  std::vector<double> hw_commands_;
  std::vector<double> hw_positions_;
  std::vector<double> hw_velocities_;


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


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


[ rosbag2 doesn't write meta data file ](/question/397687/rosbag2-doesnt-
write-meta-data-file/)


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


Hi Josh,


Hey Jon, this should be fixed with the latest humble update, so if you try an
` apt update ` and then go again hopefully it will be there. Let me know if
you have further troubles.


Hey [ @Afiq003 ](https://discourse.articulatedrobotics.xyz/u/afiq003) ,
i got the same error… but as [ @JoshNewans
](https://discourse.articulatedrobotics.xyz/u/joshnewans) :


add a comment


private:
  // Parameters for the DiffBot simulation
  double hw_start_sec_;
  double hw_stop_sec_;


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


I seem to be having a problem with the teleop_twist_joy node not auto-
repeating.


Honestly, that sounds very similar to how mine works, just with a few extra
steps - which means it shouldn’t be too hard to modify!
I recommend watching my [ motor tutorial ](https://youtu.be/-PCuDnpgiew)
first, so that you understand how mine is structured (and how it is similar
and different to yours).


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


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


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


I can control the robot with Twist messages and I can publish odometry from
the Arduino. The problem is getting it to work with ros2_control and
specifically implementing a hardware interface.


[ Oct '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/81 "October 26,
2023 12:50pm")


I hope that clears things up, if not please ask further questions!


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


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


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


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


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


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/66 "June 22, 2023
12:11pm") [ ▶ JoshNewans
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/65)


[ Dec '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/92 "December 29,
2023  5:39am") [ ▶ Agnes_Soesanto
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/89)


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


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


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


void HardwareCommandPub::publishData()
{
  auto message = std_msgs::msg::String();
  message.data = "Hello, world! ";
  publisher_->publish(message);
}


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


Is this with teleoperation or autonomous control?


    [robot_state_publisher-1] Link right_wheel had 0 children
    [robot_state_publisher-1] [INFO] [1686455366.472416353] [robot_state_publisher]: got segment base_footprint
    [robot_state_publisher-1] [INFO] [1686455366.472564150] [robot_state_publisher]: got segment base_link
    [robot_state_publisher-1] [INFO] [1686455366.472588526] [robot_state_publisher]: got segment camera_link
    [robot_state_publisher-1] [INFO] [1686455366.472606757] [robot_state_publisher]: got segment camera_link_optical
    [robot_state_publisher-1] [INFO] [1686455366.472624637] [robot_state_publisher]: got segment caster_wheel
    [robot_state_publisher-1] [INFO] [1686455366.472642309] [robot_state_publisher]: got segment chassis
    [robot_state_publisher-1] [INFO] [1686455366.472659212] [robot_state_publisher]: got segment face_link
    [robot_state_publisher-1] [INFO] [1686455366.472675486] [robot_state_publisher]: got segment laser_frame
    [robot_state_publisher-1] [INFO] [1686455366.472692599] [robot_state_publisher]: got segment left_wheel
    [robot_state_publisher-1] [INFO] [1686455366.472709362] [robot_state_publisher]: got segment right_wheel
    [ERROR] [robot_state_publisher-1]: process[robot_state_publisher-1] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
    [INFO] [robot_state_publisher-1]: sending signal 'SIGTERM' to process[robot_state_publisher-1]
    [ERROR] [robot_state_publisher-1]: process has died [pid 4345, exit code -15, cmd '/opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher --ros-args --params-file /tmp/launch_params_zw350_hn'].


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


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


  * Connect to the Arduino using a serial terminal (e.g. miniterm) and confirm your cpr is 392 using the “e” commands
  * Calculate the counts per loop to go at 1 rev/sec. In this case that will be 392/30=13.
  * Use the “m” command to set the motors at that speed and confirm it is correct (e.g. with a stopwatch).
  * Manually calculate and test the speed that you ultimately want your motors to be going. This might be where you are running into precision issues.
    * e.g. If your cmd_vel is 0.5m/s and your wheel radius was 0.06m
    * 0.5/(2 * pi * 0.06) = 1.32 rev/sec
    * = 17 counts/loop
    * _If your wheels are big and you are trying to drive slow this is where you’ll fall apart_
      * e.g. if you were aiming for 0.1m/s and had 0.08m radius wheels, you’re looking at 2.6 counts/loop
      * This is so low that being off by one will make a huge difference and so the PID controller will have a very hard time tracking it
      * In that case you may want to try driving faster, gearing the motors, lengthining the loop time, or tuning the PID
  * Assuming it did track that fine the problem must be further up the chain (which is great, means it’s just a software/config issue!)
  * Confirm that ` ros2_control.xacro ` has correct parameters, particularly the loop rate and counts per rev
  * Confirm that ` my_controllers.yaml ` has the correct wheel radius
  * At this point it should be working, but if not then you can dig into the ` diffdrive_arduino ` code (particularly ` arduino_comms.cpp ` and ` diffdrive_arduino.cpp ` and print out what that is sending to the Arduino - it should be the same numbers you calculated earlier!
  * Maybe also echo the cmd_vel topic to verify those numbers are correct.


[ @rzegers ](/u/rzegers) , thanks for putting in the effort, I will try your
suggestions and let you know,


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


      joint_states_[POSITION_INTERFACE_INDEX].cbegin(), joint_states_[POSITION_INTERFACE_INDEX].cend(),
      joint_commands_[POSITION_INTERFACE_INDEX].cbegin(), 0.0,
      [](const auto d1, const auto d2) { return std::abs(d1) + std::abs(d2); }, std::minus<double>{});
  if (diff <= trigger_joint_command_threshold_)
  {
    return hardware_interface::return_type::OK;
  }
  sensor_msgs::msg::JointState joint_state;
  for (std::size_t i = 0; i < info_.joints.size(); ++i)
  {
    joint_state.name.push_back(info_.joints[i].name);
    joint_state.header.stamp = node_->now();
    // only send commands to the interfaces that are defined for this joint
    for (const auto& interface : info_.joints[i].command_interfaces)
    {
      if (interface.name == hardware_interface::HW_IF_POSITION)
      {
        joint_state.position.push_back(joint_commands_[POSITION_INTERFACE_INDEX][i]);
      }
      else if (interface.name == hardware_interface::HW_IF_VELOCITY)
      {
        joint_state.velocity.push_back(joint_commands_[VELOCITY_INTERFACE_INDEX][i]);
      }
      else if (interface.name == hardware_interface::HW_IF_EFFORT)
      {
        joint_state.effort.push_back(joint_commands_[EFFORT_INTERFACE_INDEX][i]);
      }
      else
      {
        RCLCPP_WARN_ONCE(node_->get_logger(), "Joint '%s' has unsupported command interfaces found: %s.",
                         info_.joints[i].name.c_str(), interface.name.c_str());
      }
    }
  }
  for (const auto& mimic_joint : mimic_joints_)
  {
    for (const auto& interface : info_.joints[mimic_joint.mimicked_joint_index].command_interfaces)
    {
      if (interface.name == hardware_interface::HW_IF_POSITION)
      {


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


[ subscribe to rss feed ](/feeds/question/409067/ "subscribe to the rss feed")


hello, i have problem with the diffdrive_arduino, it can’t be compiled. im
using the ubuntu 22.04 with ros humble and i can install the ros-foxy, so i
use the ros-humble. but after i install the ros-humble-ros2-control & ros-
humble-ros2-controllers the diffdrive_arduino still won’t compiled. can u help
me?? thankyou
agnes@raspberrypi:~/ros2_ws$ colcon build --symlink-install
[8.185s] WARNING:colcon.colcon_core.package_selection:Some selected packages
are already built in one or more underlay workspaces:
‘rplidar_ros’ is in: /home/agnes/ros2_ws/install/rplidar_ros
If a package in a merged underlay workspace is overridden and it installs
headers, then all packages in the overlay must sort their include directories
by workspace order. Failure to do so may result in build failures or undefined
behavior at run time.
If the overridden package is used by another package in any underlay, then the
overriding package in the overlay must be API and ABI compatible or undefined
behavior at run time may occur.


/** @brief Sums the total rotation for joint states that wrap from 2*pi to -2*pi
when rotating in the positive direction */
void sumRotationFromMinus2PiTo2Pi(const double current_wrapped_rad, double& total_rotation)
{
  double delta = 0;
  angles::shortest_angular_distance_with_large_limits(total_rotation, current_wrapped_rad, 2 * M_PI, -2 * M_PI, delta);
  // Add the corrected delta to the total rotation
  total_rotation += delta;
}
}  // namespace
namespace topic_based_ros2_control
{
static constexpr std::size_t POSITION_INTERFACE_INDEX = 0;
static constexpr std::size_t VELOCITY_INTERFACE_INDEX = 1;
// JointState doesn't contain an acceleration field, so right now it's not used
static constexpr std::size_t EFFORT_INTERFACE_INDEX = 3;
CallbackReturn TopicBasedSystem::on_init(const hardware_interface::HardwareInfo& info)
{
  if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
  {
    return CallbackReturn::ERROR;
  }
  // Initialize storage for all joints' standard interfaces, regardless of their existence and set all values to nan
  joint_commands_.resize(standard_interfaces_.size());
  joint_states_.resize(standard_interfaces_.size());
  for (auto i = 0u; i < standard_interfaces_.size(); i++)
  {
    joint_commands_[i].resize(info_.joints.size(), 0.0);
    joint_states_[i].resize(info_.joints.size(), 0.0);
  }
  // Initial command values
  for (auto i = 0u; i < info_.joints.size(); i++)
  {
    const auto& component = info_.joints[i];
    for (const auto& interface : component.state_interfaces)
    {
      auto it = std::find(standard_interfaces_.begin(), standard_interfaces_.end(), interface.name);
      // If interface name is found in the interfaces list
      if (it != standard_interfaces_.end())
      {


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


Is there something we’ve missed out on? The controller_manager had issues
earlier as well when running on the dev machine but it was sorted when it was
rerun a few times.


####  [ ](https://discourse.articulatedrobotics.xyz#migration-from-foxy-to-
newer-versions-1) Migration from Foxy to newer versions


[ @dusevitch ](/u/dusevitch)


Is our approach in doing this project correct? Is there anyway i can expose
state interfaces with robot with our current approach? Thanks


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


Roberto


` trajectory_msgs__msg__JointTrajectory ` is indeed the C type.


I’d first use ` ros2 topic echo ` to check the contents of your cmd_vel topic
are correct and you are sending a Z rotation.


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


` git pull `


[
![](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/j/c67d28/45.png)
](https://discourse.articulatedrobotics.xyz/u/JoshNewans)


Also I noticed that unit6 doesn’t let me access the final solution, the error
I am getting is


[ Dec '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/94 "December 31,
2023  5:27am") [ ▶ Aboude_zoua
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/91)


I have a really weird Issue. The robot drives forwards and backwards fine but
it doesn’t turn.


Why is the controller manager not running.
I use your file from github.


when creating a shared pointer with:


[ GUENNI ](/users/55678/guenni/) ![flag of
Germany](/m/default/media/images/flags/de.gif?v=28)
56  ●  7  ●  11  ●  15


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


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


    /home/guenther/myrobot_ws/src/myrobot_controller_hardware/src/myrobot_system_position_only.cpp:46:61:   required from here
    /opt/ros/humble/include/rclcpp/rclcpp/publisher.hpp:81:47: error: static assertion failed: given message type is not compatible with ROS and cannot be used with a Publisher
       81 |     rclcpp::is_ros_compatible_type<MessageT>::value,


Hi guys. I am new to ROS2 and I am following [ @JoshNewans
](https://discourse.articulatedrobotics.xyz/u/joshnewans) tutorial to make my
own robot. I am using an arduino uno board with polulu motors. I was able to
make the robot work in gazebo/rviz but when I downloaded the diffdrive
controller from Josh’ github and started to port it on the robot using RPI
3b+, I get the error:


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


[ Aug '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/72 "August 25,
2023  7:15am") [ ▶ Linh_Nguy_n_D_ng
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/71)


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


[ ![gvdhoorn gravatar image](/upfiles/avatars/gvdhoorn/resized/16/4550046.png)
](/users/5184/gvdhoorn/) [ gvdhoorn ](/users/5184/gvdhoorn/) (  2022-11-08
04:11:00 -0500  )  edit


Last updated: **Nov 08 '22**


> with base class type hardware_interface::SystemInterface does not exist.


[ ![GUENNI gravatar image](/m/default/media/images/nophoto.png?v=28)
](/users/55678/guenni/)


  * Firstly, that you are using the same setup as me (with the Arduino running that same code)
  * Have you set the device correctly in ` ros2_control.xacro ` (e.g. ` /dev/ttyUSB0 ` or ` /dev/serial/by-id... ` )
  * Is the specified device visible in the OS (e.g. if the parameter is set to ` /dev/ttyUSB0 ` , does ` ls /dev/ttyUSB0 ` return something)
  * Have you added the user to the ` dialout ` group with ` sudo adduser $USER dialout ` ?
  * Can you connect to the arduino with a serial terminal e.g. ` miniterm -e <device path> 57600 `
  * Has the system got the lidar or other device and the Arduino the wrong way around*
  * Did you get the baud rate wrong? (That should be a different kind of problem though)


[ roman.smid  ](https://get-help.theconstruct.ai/u/roman.smid) May 10, 2022,
4:59am  5


##  [ ](https://discourse.articulatedrobotics.xyz#this-may-be-promoted-to-an-
error-in-a-future-release-of-colcon-override-check-starting-serial-starting-
articubot_one-starting-ldlidar_stl_ros2-starting-rplidar_ros-finished-
articubot_one-333s-finished-ldlidar_stl_ros2-337s-finished-
serial-488s-starting-diffdrive_arduino-finished-rplidar_ros-461s-stderr-
diffdrive_arduino-in-file-included-from-
homeagnesros2_wssrcdiffdrive_arduinosrcfake_robotcpp1-homeagnesros2_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-
homeagnesros2_wssrcdiffdrive_arduinosrcdiffdrive_arduinocpp1-homeagnesros2_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-gmake1-cmakefilesmakefile2139-cmakefilesdiffdrive_arduinodirall-
error-2-gmake-makefile146-all-error-2-1) This may be promoted to an error in a
future release of colcon-override-check.
Starting >>> serial
Starting >>> articubot_one
Starting >>> ldlidar_stl_ros2
Starting >>> rplidar_ros
Finished <<< articubot_one [3.33s]
Finished <<< ldlidar_stl_ros2 [3.37s]
Finished <<< serial [4.88s]
Starting >>> diffdrive_arduino
Finished <<< rplidar_ros [4.61s]
— stderr: diffdrive_arduino
In file included from
/home/agnes/ros2_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:
/home/agnes/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


That’s a great question and I’ve never really thought about it!
In short, I think the answer is no…but sort of yes?
The ` ros2_control ` controller expects to only control one hardware
interface, so to achieve what you’re talking about you’d just have to run two
independent controllers and have them both listening to the same twist topic
(but avoid them publishing to the same feedback).


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


[
![](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/6 "October 19,
2022 10:19pm")


[ Using Nav2 with external localization source ](/question/409260/using-
nav2-with-external-localization-source/)


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


Is there an import I’m missing?


Then replace this block of code:


Summary: 0 packages finished [0.87s]
1 package failed: serial_motor_demo_msgs
1 package had stderr output: serial_motor_demo_msgs
1 package not processed
ubuntu@ubuntu:~/robot_ws$


Bizarre! Yeah it does sound like a PID controller behaving badly.
One possible issue if you are using my exact code is that the PID settings
might have changed since the earlier version? The latest hardware interface is
[ here ](https://github.com/joshnewans/diffdrive_arduino/tree/humble) and it
gives you the ability to tweak the PID parameters.
That version SHOULD leave them as default if you don’t set them, but I think
there were other versions with a hardcoded value so you may have that?


  // Update the free-flyer, i.e. the base notation using the classical
  // wheel differentiable kinematics
  double base_dx = 0.5 * radius * (hw_commands_[0] + hw_commands_[1]) * cos(base_theta_);
  double base_dy = 0.5 * radius * (hw_commands_[0] + hw_commands_[1]) * sin(base_theta_);
  double base_dtheta = radius * (hw_commands_[0] - hw_commands_[1]) / dist_w;
  base_x_ += base_dx * dt;
  base_y_ += base_dy * dt;
  base_theta_ += base_dtheta * dt;


Hi Ivo, sorry for not getting back to you (and many other people).


This will download the latest changes from the remote repository.


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


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


[ Aug '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/71 "August 25,
2023  6:32am")


Using the code editor please go to:
` ros2_ws/src/ros2_control_course/common/joint_trajectory_publisher/launch `


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


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


Hi [ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/joshnewans)
i installed RO2 Humble. I am getting this error when trying to build
diffdrive_arduino with colcon build. Can you help me?


and run


Thanks for the super quick reply Josh, that clears it all up. I’m going to
stick with your route so that I can follow your track in coming videos. I’m
going back to the motor control video to implement RosArduinoBridge and then
implement diffdrive_arduino. Plenty of time to play around with MicroRos etc
later.


#ifndef ROS2_CONTROL_DEMO_HARDWARE__DIFFBOT_SYSTEM_HPP_
#define ROS2_CONTROL_DEMO_HARDWARE__DIFFBOT_SYSTEM_HPP_


[ Hi there! Please sign in ](/account/signin/?next=/question/409067/why-is-
trajectory_msgs__msg__jointtrajectory-not-valid-for-publisher/) [ help
](/help/ "help")


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


Between Foxy and Galactic we made substantial changes to the interface of
hardware components to enable management of their lifecycle. The following
list shows a set of quick changes to port existing hardware components to
Galactic:


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


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


> What are the RPM speeds of your motors? I think mine are about 250 or so,
> maybe too much for this application (if that even makes a difference).


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


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


    ros2 launch adrover_ROS2 launch_robot.launch.py
    [INFO] [launch]: All log files can be found below /home/adrover/.ros/log/2024-03-20-14-58-26-819462-adrover-2942
    [INFO] [launch]: Default logging verbosity is set to INFO
    [INFO] [robot_state_publisher-1]: process started with pid [2945]
    [robot_state_publisher-1] Parsing robot urdf xml string.
    [robot_state_publisher-1] Link chassis_link_back had 1 children
    [robot_state_publisher-1] Link laser_frame had 0 children
    [robot_state_publisher-1] Link chassis_link_front had 1 children
    [robot_state_publisher-1] Link lcd_link had 1 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 chassis_link_left had 2 children
    [robot_state_publisher-1] Link caster_wheel_link_lb had 0 children
    [robot_state_publisher-1] Link caster_wheel_link_lf had 0 children
    [robot_state_publisher-1] Link chassis_link_right had 2 children
    [robot_state_publisher-1] Link caster_wheel_link_rb had 0 children
    [robot_state_publisher-1] Link caster_wheel_link_rf had 0 children
    [robot_state_publisher-1] Link left_wheel_link had 0 children
    [robot_state_publisher-1] Link right_wheel_link had 0 children
    [robot_state_publisher-1] [INFO] [1710928708.453907263] [robot_state_publisher]: got segment base_link
    [robot_state_publisher-1] [INFO] [1710928708.454549749] [robot_state_publisher]: got segment camera_link
    [robot_state_publisher-1] [INFO] [1710928708.454657611] [robot_state_publisher]: got segment camera_link_optical
    [robot_state_publisher-1] [INFO] [1710928708.454703444] [robot_state_publisher]: got segment caster_wheel_link_lb
    [robot_state_publisher-1] [INFO] [1710928708.454747245] [robot_state_publisher]: got segment caster_wheel_link_lf
    [robot_state_publisher-1] [INFO] [1710928708.454788963] [robot_state_publisher]: got segment caster_wheel_link_rb
    [robot_state_publisher-1] [INFO] [1710928708.454830316] [robot_state_publisher]: got segment caster_wheel_link_rf
    [robot_state_publisher-1] [INFO] [1710928708.454871253] [robot_state_publisher]: got segment chassis_link_back
    [robot_state_publisher-1] [INFO] [1710928708.454913543] [robot_state_publisher]: got segment chassis_link_front
    [robot_state_publisher-1] [INFO] [1710928708.454954636] [robot_state_publisher]: got segment chassis_link_left
    [robot_state_publisher-1] [INFO] [1710928708.454996562] [robot_state_publisher]: got segment chassis_link_right
    [robot_state_publisher-1] [INFO] [1710928708.455047186] [robot_state_publisher]: got segment laser_frame
    [robot_state_publisher-1] [INFO] [1710928708.455090831] [robot_state_publisher]: got segment lcd_link
    [robot_state_publisher-1] [INFO] [1710928708.455134007] [robot_state_publisher]: got segment left_wheel_link
    [robot_state_publisher-1] [INFO] [1710928708.455264005] [robot_state_publisher]: got segment right_wheel_link
    [INFO] [ros2_control_node-2]: process started with pid [2957]
    [ros2_control_node-2] terminate called after throwing an instance of 'std::runtime_error'
    [ros2_control_node-2]   what():  invalid URDF passed in to robot parser
    [ERROR] [ros2_control_node-2]: process has died [pid 2957, exit code -6, cmd '/opt/ros/foxy/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_y8g2xwtv --params-file /home/adrover/adrover_ws/install/adrover_ROS2/share/adrover_ROS2/config/adrover_controller.yaml'].


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


  ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
  CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;


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


A simple ROS Control Hardware Interface for differential drive control of
robot whose motors are connected via an Arduino (or similar microcontroller).
- GitHub - RedstoneGithub/diffdrive_arduino: ...


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


If that is set up correctly, then make sure it is actually being loaded!


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/41 "June  2, 2023
9:46pm") [ ▶ Afiq003 ](https://discourse.articulatedrobotics.xyz/t/discussion-
running-ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/40)


    <?xml version="1.0"?>
    <robot xmlns:xacro="http://www.ros.org/wiki/xacro">

        <ros2_control name="RealRobot" type="system">

            <hardware>
                <plugin>diffdrive_arduino/DiffDriveArduino</plugin>
                <param name="left_wheel_names">left_wheel_joint</param>
                <param name="right_wheel_names">right_wheel_joint</param>
                <param name="loop_rate">30</param>
                <param name="device">/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0</param>
                <param name="baud_rate">57600</param>
                <param name="timeout">1000</param>
                <param name="enc_counts_per_rev">8400</param>
            </hardware>

            <joint name="left_wheel_joint">
                <command_interface name="velocity">
                    <param name="min">-10</param>
                    <param name="max">10</param>
                </command_interface>
                <state_interface name="velocity" />
                <state_interface name="position" />
            </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="velocity" />
                <state_interface name="position" />
            </joint>

        </ros2_control>
            <gazebo>
            <plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
                <parameters>$(find adrover_ROS2)/config/adrover_controller.yaml</parameters>


> Not all motors rotate at the same speed.


Cant find whats actually going wrong, feels like its ros not building properly


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


[ edit ](/questions/409067/edit/) [ retag ](/s/questions/409067/retag/) flag
offensive  [ close ](/questions/409067/close/) merge  delete


[ Jun '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/55 "June  9, 2023
8:49am") [ ▶ FrankfurtDynamics
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/54)


[ ROS2 C++ Re-Created Subscriber Not Listening ](/question/300339/ros2-c-re-
created-subscriber-not-listening/)


make you clone the " humble " Branch from josh repo . This should solve your
issue .


Make sure when posting code blocks (I have edited yours) you put backticks
(the ` ~ ` key without shift) around it to make it easier to read, like this:


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


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


/*ROS2 Control Demos diffbot hardware interface publisher. My use-case is sending hardware commands from a Raspberry Pi 4 running a diffrential drive robot controller to a Teensy 4.1 microcontroller controlling the actual hardware. The Teensy is running micro-ROS and can subscribe and publish to topics over a USB connection to the Raspberry Pi. The important change between this gist and the official demos is the presence of a node class, and the addition of a shared pointer member for the node in DiffBotSystemHardware. The shared pointer gets assigned in the on_init() member function, at which point its publisher can be used.
*/


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


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


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


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


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


#include <geometry_msgs/msg/twist.hpp>


Yeah so the confusion here (and it’s not just you, others have had the same
issue) is that ` diffdrive_arduino ` does NOT use rosserial (or micro-ROS for
that matter).


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


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


  // START: 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"]);
  // END: This part here is for exemplary purposes - Please do not copy to your production code
  hw_positions_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());
  hw_velocities_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());
  hw_commands_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());


Why is trajectory_msgs__msg__JointTrajectory not valid for Publisher


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


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


Hi [ @JoshNewans ](https://discourse.articulatedrobotics.xyz/u/joshnewans) I
have learned a lot from your tutorials and applying them on my graduation
project so thank you for all the work you have done I would not got anywhere
without your generous help
I have been running into issues when I run the “launch_robot.launch.py” on the
RasberryPi while it works perfectly on my laptop and in both cases the Arduino
board works fine but I do not seem to load “diff_cont” for some reason on the
Pi here is the error I get


[ Dec '23 ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/93 "December 30,
2023  7:06pm") [ ▶ JoshNewans
](https://discourse.articulatedrobotics.xyz/t/discussion-running-ros2-control-
on-a-real-robot-making-a-mobile-robot-pt-13/107/3)


[
![](https://discourse.articulatedrobotics.xyz/user_avatar/discourse.articulatedrobotics.xyz/omar_khaled/45/62_2.png)
](https://discourse.articulatedrobotics.xyz/u/Omar_Khaled)


        <ros2_control name="RealRobot" type="system">
            <hardware>
                <plugin>hover_diffdrive/HoverDiffDrive</plugin>
            </hardware>
            <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>


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


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


}O(rclcpp::get_logger("myrobotSystemPositionOnlyHardware"), "Writing...");


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


HardwareCommandPub::HardwareCommandPub() : Node("hardware_command_publisher")
{
  publisher_ = this->create_publisher<std_msgs::msg::String>("test_topic", 10);
}


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


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


  return state_interfaces;
}


Thanks for the responses BigShark3000 and Josh. I figured it wasn’t going to
be a simple fix but thought I would ask to be sure! I’ve been looking through
the ros2_control_demos and diffdrive_arduino code to try and understand how it
all works… definitely have a ways to go there. If I do manage to get something
working, I’ll be sure to share.


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


[ 21 Mar ](https://discourse.articulatedrobotics.xyz/t/discussion-running-
ros2-control-on-a-real-robot-making-a-mobile-robot-pt-13/107/103 "March 21,
2024  8:17am")


[ **updated 2022-11-08 08:33:28 -0500  ** ](/questions/409067/revisions/)


` ~/ros2_ws/src/ros2_control_course `


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


Don’t know where to post this but I found an issue using the Velodyne 16 lidar
to laser scan (2D lidar) in Slam toolbox node. It is a quite common lidar so
maybe some other have the same issue. It took a long time for me to find the
bug but apparently when converting the pointcloud message to laserscan message
with the official driver the lidar can give the error of too many or too few
scans per revolution. I think if the resolution in the .yaml file is not
evenly divided it cases the error and then the slam toolbox is not able to
start correctly. I did a bad fix of changing the resolution: 0.006 and it
works.


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


[
![](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/s/f4b2a3/45.png)
](https://discourse.articulatedrobotics.xyz/u/Shah)


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


EDIT: found the issue. in ` rsp.launch.py ` i needed to insert an blank before
the “sim_mode” parameter as follows:


[ ![ROS Answers logo](/m/ros/media/images/logoros.png?v=28) ](/questions/)


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


    ```
    My code here
    ```


##  Stats


[ tags ](/tags/) [ users ](/users/) [ badges ](/badges/)


[
![](https://discourse.articulatedrobotics.xyz/letter_avatar_proxy/v4/letter/b/779978/45.png)
](https://discourse.articulatedrobotics.xyz/u/Betul_Duran)


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


If you understand the risks and want to override a package anyways, add the
following to the command line:
–allow-overriding rplidar_ros


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


|  [ Ask Your Question ](/questions/ask/)
---|---|---|---

0


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


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


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


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


    [INFO] [launch]: All log files can be found below /home/cliff/.ros/log/2023-06-11-09-19-26-129315-cliff-Legion-4342
    [INFO] [launch]: Default logging verbosity is set to INFO
    Task exception was never retrieved
    future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=PackageNotFoundError("package 'twist_mux' not found, searching: ['/home/cliff/dev_ws/install/serial_motor_demo', '/home/cliff/dev_ws/install/serial_motor_demo_msgs', '/home/cliff/dev_ws/install/diffdrive_arduino', '/home/cliff/dev_ws/install/serial', '/home/cliff/dev_ws/install/articubot_one', '/opt/ros/foxy']")>
    Traceback (most recent call last):
      File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py", line 50, in get_package_prefix
        content, package_prefix = get_resource('packages', package_name)
      File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/resources.py", line 48, in get_resource
        raise LookupError(
    LookupError: Could not find the resource 'twist_mux' of type 'packages'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
        await self.__process_event(next_event)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
        visit_all_entities_and_collect_futures(entity, self.__context))
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
        futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
        futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
        futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      [Previous line repeated 1 more time]
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
        sub_entities = entity.visit(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
        return self.execute(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 453, in execute
        ret = super().execute(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 823, in execute
        self.__expand_substitutions(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 668, in __expand_substitutions
        cmd = [perform_substitutions(context, x) for x in self.__cmd]
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 668, in <listcomp>
        cmd = [perform_substitutions(context, x) for x in self.__cmd]
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions


[spawner.py-5] File “/opt/ros/foxy/lib/controller_manager/spawner.py”, line
204, in
[spawner.py-5] sys.exit(main())
[spawner.py-5] File “/opt/ros/foxy/lib/controller_manager/spawner.py”, line
118, in main
[spawner.py-5] if not wait_for_controller_manager(node,
controller_manager_name,
[spawner.py-5] File “/opt/ros/foxy/lib/controller_manager/spawner.py”, line
59, in wait_for_controller_manager
[spawner.py-5] time.sleep(0.2)
[spawner.py-5] KeyboardInterrupt
[spawner.py-4] Traceback (most recent call last):
[spawner.py-4] File “/opt/ros/foxy/lib/controller_manager/spawner.py”, line
204, in
[spawner.py-4] sys.exit(main())
[spawner.py-4] File “/opt/ros/foxy/lib/controller_manager/spawner.py”, line
118, in main
[spawner.py-4] if not wait_for_controller_manager(node,
controller_manager_name,
[spawner.py-4] File “/opt/ros/foxy/lib/controller_manager/spawner.py”, line
59, in wait_for_controller_manager
[spawner.py-4] time.sleep(0.2)
[spawner.py-4] KeyboardInterrupt
[INFO] [twist_mux-2]: process has finished cleanly [pid 26302]
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 26300]
[ERROR] [spawner.py-5]: process has died [pid 26342, exit code -2, cmd
‘/opt/ros/foxy/lib/controller_manager/spawner.py diff_cont --ros-args’].
[ERROR] [spawner.py-4]: process has died [pid 26340, exit code -2, cmd
‘/opt/ros/foxy/lib/controller_manager/spawner.py joint_broad --ros-args’].


I used ros2 topic echo /diff_cont/cmd_vel_unstamped to monitor the command
being sent when I was using the joy stick to control the robot.


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


Cheers,
Ivo


` rosserial ` is a method for sending ROS messages over a serial line (to an
Arduino or similar). And now with micro-ROS those kinds of problems can be
solved differently.


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


[spawner-4]: process has died [pid 10167, exit code 1, cmd
'/opt/ros/humble/lib/controller_manager/spawner diffbot_base_controller
--controller-manager /controller_manager --ros-args'].


new:


[ Send an array or a list between nodes? ](/question/411851/send-an-array-or-
a-list-between-nodes/)


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


I did this because the hardware guy just told me to send those string via
esp32, and he just do the rest of the hardware control thing.


ubuntu@ubuntu:~/robot_ws$ colcon build --symlink-install
Starting >>> serial_motor_demo_msgs
— stderr: serial_motor_demo_msgs
CMake Error at CMakeLists.txt:19 (find_package):
By not providing “Findament_cmake.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“ament_cmake”, but CMake did not find one.


thanks you,
Kriz


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


class DiffBotSystemHardware : public hardware_interface::SystemInterface
{
public:
  RCLCPP_SHARED_PTR_DEFINITIONS(DiffBotSystemHardware);


    afiq@afiq-VM:~/dev_ws$ ros2 launch my_bot launch_sim.launch.py world:=src/my_bot/worlds/obstacles.world
    [INFO] [launch]: All log files can be found below /home/afiq/.ros/log/2023-06-02-08-25-17-400678-afiq-VM-24746
    [INFO] [launch]: Default logging verbosity is set to INFO
    Task exception was never retrieved
    future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=SubstitutionFailure('executed command failed. Command: xacro /home/afiq/dev_ws/install/my_bot/share/my_bot/description/robot.urdf.xacro use_ros2_control:=true sim_mode:=true')>
    Traceback (most recent call last):
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
        await self.__process_event(next_event)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
        visit_all_entities_and_collect_futures(entity, self.__context))
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
        futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
        futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
        futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      [Previous line repeated 3 more times]
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
        sub_entities = entity.visit(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
        return self.execute(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 444, in execute
        self._perform_substitutions(context)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 399, in _perform_substitutions
        evaluated_parameters = evaluate_parameters(context, self.__parameters)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/utilities/evaluate_parameters.py", line 164, in evaluate_parameters
        output_params.append(evaluate_parameter_dict(context, param))
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/utilities/evaluate_parameters.py", line 71, in evaluate_parameter_dict
        evaluated_value = perform_substitutions(context, list(value))
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
        return ''.join([context.perform_substitution(sub) for sub in subs])
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
        return ''.join([context.perform_substitution(sub) for sub in subs])
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_context.py", line 232, in perform_substitution
        return substitution.perform(self)
      File "/opt/ros/foxy/lib/python3.8/site-packages/launch/substitutions/command.py", line 116, in perform
        raise SubstitutionFailure(f'executed command failed. Command: {command_str}')
    launch.substitutions.substitution_failure.SubstitutionFailure: executed command failed. Command: xacro /home/afiq/dev_ws/install/my_bot/share/my_bot/description/robot.urdf.xacro use_ros2_control:=true sim_mode:=true


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


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


  1. In the **joint_trajectory_controller** section the joint trajectory publisher when launched doesn’t seem to be publishing anything, the robot in gazebo stays still
(edit) looking at the publisher topic the name of the joints seem to be those
of the solo robot from section6?


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


I would really appreciate any help.
Thanks,
Kaushik Boora


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


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