Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: allow to build in galactic #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Buzzology
Copy link

@Buzzology Buzzology commented Jan 21, 2023

Hey Josh,

Thanks for all your tutorials, they've been really good. I am currently trying to use CommanderAPI and had to upgrade to Galactic. I ran into a few compatibility issues and have attempted to fix it. It's now building on my end but I won't be able to test it properly until I've fixed the remaining issues in the rest of my code.

First time ever using C++ so probably needs a bit of tidying up/fixing. Hopefully it's able to help anyone else hitting the same problem to at least get started.

I mostly followed what was in these links:

Update: Just wanted to add that I've now got everything else working and this seems to be working for me. Feel free to ping me if you have any issues (or if I've missed checking in any files).

@slgrobotics
Copy link

I tried the following "minimal build" on a Ubuntu 22.04 machine with only ROS2 Humble installed:

sudo apt install ros-humble-ros2-control

mkdir -p ~/plucky_wsB/src
cd ~/plucky_wsB/src
git clone https://github.com/Buzzology/diffdrive_arduino.git
git clone https://github.com/joshnewans/serial.git
colcon build

It produced a lot of strange errors. Adding "rclcpp_lifecycle" to dependencies in CMakefile didn't help. Any ideas? Thanks!

======================

Starting >>> serial  
Finished <<< serial [0.19s]                     
Starting >>> diffdrive_arduino
--- stderr: diffdrive_arduino                             
In file included from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:1:
/home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/fake_robot.h:35:15: error: ‘hardware_interface::return_type FakeRobot::read()’ marked ‘override’, but does not override
   35 |   return_type read() override;
      |               ^~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/fake_robot.h:37:15: error: ‘hardware_interface::return_type FakeRobot::write()’ marked ‘override’, but does not override
   37 |   return_type write() override;
      |               ^~~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:13:1: error: ‘CallbackReturn’ does not name a type
   13 | CallbackReturn FakeRobot::on_init(const hardware_interface::HardwareInfo & info)
      | ^~~~~~~~~~~~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:67:1: error: ‘CallbackReturn’ does not name a type
   67 | CallbackReturn FakeRobot::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
      | ^~~~~~~~~~~~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:74:1: error: ‘CallbackReturn’ does not name a type
   74 | CallbackReturn FakeRobot::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
      | ^~~~~~~~~~~~~~
In file included from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:
/home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:36:15: error: ‘hardware_interface::return_type DiffDriveArduino::read()’ marked ‘override’, but does not override
   36 |   return_type read() override;
      |               ^~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:38:15: error: ‘hardware_interface::return_type DiffDriveArduino::write()’ marked ‘override’, but does not override
   38 |   return_type write() override;
      |               ^~~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:13:1: error: ‘CallbackReturn’ does not name a type
   13 | CallbackReturn DiffDriveArduino::on_init(const hardware_interface::HardwareInfo & info)
      | ^~~~~~~~~~~~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:71:1: error: ‘CallbackReturn’ does not name a type
   71 | CallbackReturn DiffDriveArduino::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
      | ^~~~~~~~~~~~~~
/home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:83:1: error: ‘CallbackReturn’ does not name a type
   83 | CallbackReturn DiffDriveArduino::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
      | ^~~~~~~~~~~~~~
In file included from /opt/ros/humble/include/class_loader/class_loader/class_loader_core.hpp:57,
                 from /opt/ros/humble/include/class_loader/class_loader/class_loader.hpp:55,
                 from /opt/ros/humble/include/pluginlib/pluginlib/class_list_macros.hpp:40,
                 from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:116:
/opt/ros/humble/include/class_loader/class_loader/meta_object.hpp: In instantiation of ‘B* class_loader::impl::MetaObject<C, B>::create() const [with C = FakeRobot; B = hardware_interface::SystemInterface]’:
/opt/ros/humble/include/class_loader/class_loader/meta_object.hpp:216:7:   required from here
/opt/ros/humble/include/class_loader/class_loader/meta_object.hpp:218:12: error: invalid new-expression of abstract class type ‘FakeRobot’
  218 |     return new C;
      |            ^~~~~
In file included from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:1:
/home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/fake_robot.h:18:7: note:   because the following virtual functions are pure within ‘FakeRobot’:
   18 | class FakeRobot : public hardware_interface::SystemInterface
      |       ^~~~~~~~~
In file included from /home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/fake_robot.h:7,
                 from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/fake_robot.cpp:1:
/opt/ros/humble/include/hardware_interface/system_interface.hpp:173:23: note:     ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::read(const rclcpp::Time&, const rclcpp::Duration&)’
  173 |   virtual return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) = 0;
      |                       ^~~~
/opt/ros/humble/include/hardware_interface/system_interface.hpp:184:23: note:     ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::write(const rclcpp::Time&, const rclcpp::Duration&)’
  184 |   virtual return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) = 0;
      |                       ^~~~~
In file included from /opt/ros/humble/include/class_loader/class_loader/class_loader_core.hpp:57,
                 from /opt/ros/humble/include/class_loader/class_loader/class_loader.hpp:55,
                 from /opt/ros/humble/include/pluginlib/pluginlib/class_list_macros.hpp:40,
                 from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:145:
/opt/ros/humble/include/class_loader/class_loader/meta_object.hpp: In instantiation of ‘B* class_loader::impl::MetaObject<C, B>::create() const [with C = DiffDriveArduino; B = hardware_interface::SystemInterface]’:
/opt/ros/humble/include/class_loader/class_loader/meta_object.hpp:216:7:   required from here
/opt/ros/humble/include/class_loader/class_loader/meta_object.hpp:218:12: error: invalid new-expression of abstract class type ‘DiffDriveArduino’
  218 |     return new C;
      |            ^~~~~
In file included from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:
/home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:19:7: note:   because the following virtual functions are pure within ‘DiffDriveArduino’:
   19 | class DiffDriveArduino : public hardware_interface::SystemInterface
      |       ^~~~~~~~~~~~~~~~
In file included from /home/sergei/plucky_wsB/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:7,
                 from /home/sergei/plucky_wsB/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:
/opt/ros/humble/include/hardware_interface/system_interface.hpp:173:23: note:     ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::read(const rclcpp::Time&, const rclcpp::Duration&)’
  173 |   virtual return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) = 0;
      |                       ^~~~
/opt/ros/humble/include/hardware_interface/system_interface.hpp:184:23: note:     ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::write(const rclcpp::Time&, const rclcpp::Duration&)’
  184 |   virtual return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) = 0;
      |                       ^~~~~
gmake[2]: *** [CMakeFiles/fake_robot.dir/build.make:76: CMakeFiles/fake_robot.dir/src/fake_robot.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:165: CMakeFiles/fake_robot.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/diffdrive_arduino.dir/build.make:76: CMakeFiles/diffdrive_arduino.dir/src/diffdrive_arduino.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/diffdrive_arduino.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< diffdrive_arduino [6.10s, exited with code 2]

Summary: 1 package finished [6.50s]
  1 package failed: diffdrive_arduino
  1 package had stderr output: diffdrive_arduino

=======================================

@slgrobotics
Copy link

I merged all necessary code from https://github.com/Buzzology/diffdrive_arduino and copied some snippets from code generated for Humble using this method:

https://rtw.stoglrobotics.de/master/tutorials/quick-start.html#clone-and-source-the-rosteamworkspace

Compiles fine on Humble, not tested yet.

My final version is here: https://github.com/slgrobotics/diffdrive_arduino

sudo apt install ros-humble-ros2-control

mkdir -p ~/plucky_ws/src
cd ~/plucky_ws/src
git clone https://github.com/slgrobotics/diffdrive_arduino.git
git clone https://github.com/joshnewans/articubot_one.git
git clone https://github.com/joshnewans/serial.git
cd ~/plucky_ws
colcon build

@Buzzology
Copy link
Author

Buzzology commented Feb 14, 2023

Nice, was there anything missing in the galactic MR of mine or just more changes between Galactic and Humble? Took me a while to do the Foxy -> Galactic migration on everything else so I've been holding off on Humble until I really need it.

@slgrobotics
Copy link

@Buzzology - Chris, sorry, I don't have previous ROS releases installed anywhere, only Humble. But if you have a Galactic machine, "compilability" of my changes is easy to check in five minutes - just do the following:

mkdir -p ~/plucky_ws/src
cd ~/plucky_ws/src
git clone https://github.com/slgrobotics/diffdrive_arduino.git
git clone https://github.com/joshnewans/serial.git
cd ~/plucky_ws
colcon build

I am pretty sure though that read() and write() signatures did change between your and my code. And I haven't done any testing yet, that might be another can of worms.

@Buzzology
Copy link
Author

Thanks for the info Sergei!

@SAMPATHONROS
Copy link

@slgrobotics I was trying to develop the same on humble and ubuntu 22.04 and I ran into these issues
if you have any idea please let me know

In file included from /usr/include/boost/bind.hpp:30,
from /home/sampath/robot1_ws/src/serial/tests/unix_serial_tests.cc:23:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
36 | BOOST_PRAGMA_MESSAGE(
| ^~~~~~~~~~~~~~~~~~~~

Finished <<< serial [5.76s]
Starting >>> diffdrive_arduino
--- stderr: diffdrive_arduino
In file included from /home/sampath/robot1_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:
/home/sampath/robot1_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"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/sampath/robot1_ws/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:
/home/sampath/robot1_ws/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:7:10: fatal error: hardware_interface/base_interface.hpp: No such file or directory
7 | #include "hardware_interface/base_interface.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
compilation terminated.
gmake[2]: *** [CMakeFiles/fake_robot.dir/build.make:76: CMakeFiles/fake_robot.dir/src/fake_robot.cpp.o] Error 1
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:165: CMakeFiles/fake_robot.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/diffdrive_arduino.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

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

Summary: 5 packages finished [12.3s]
1 package failed: diffdrive_arduino

@Buzzology
Copy link
Author

Buzzology commented Feb 24, 2023

Hey @SAMPATHONROS , I'm not sure which repo you copied but I ended up upgrading to Humble and 22.04 last week. I ended up using a mixture of Sergei's code and my original Galactic upgrade and it seems to be working okay so far. I added the changes to a humble branch on this repo: https://github.com/Buzzology/diffdrive_arduino/tree/humble. Sergei's code is likely fine, but if you're using my original Galactic changes there are more changes required in order to go to Humble.

@slgrobotics
Copy link

Please make sure you have these prerequisites installed:

sudo apt install ros-humble-ros2-control
sudo apt install ros-humble-ros2-controllers
(?? ros-humble-gazebo-ros2-control - *** can't find package - probably isn't needed in humble ***)
sudo apt install ros-humble-twist-mux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants