joshnewans / articubot_one

282 stars 248 forks source link

diffdrive_arduino package fails to build for ros2 humble #31

Closed Getafix17 closed 3 months ago

Getafix17 commented 4 months ago

My robot_ws build fails. The error seems to be with diffdrive_arduino package. I am using the ros2 humble fork

starting >>> diffdrive_arduino

--- stderr: diffdrive_arduino

In file included from /home/alexf/robot_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:

/home/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:

/home/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/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/alexf/robot_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:

/home/alexf/robot_ws/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/alexf/robot_ws/src/diffdrive_arduino/include/diffdrive_arduino/fake_robot.h:7,

             from /home/alexf/robot_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:

/opt/ros/humble/include/hardware_interface/system_interface.hpp:175:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::read(const rclcpp::Time&, const rclcpp::Duration&)’

175 | virtual return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) = 0;

  |                       ^~~~

/opt/ros/humble/include/hardware_interface/system_interface.hpp:186:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::write(const rclcpp::Time&, const rclcpp::Duration&)’

186 | 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/alexf/robot_ws/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/alexf/robot_ws/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:

/home/alexf/robot_ws/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/alexf/robot_ws/src/diffdrive_arduino/include/diffdrive_arduino/diffdrive_arduino.h:7,

             from /home/alexf/robot_ws/src/diffdrive_arduino/src/diffdrive_arduino.cpp:1:

/opt/ros/humble/include/hardware_interface/system_interface.hpp:175:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::read(const rclcpp::Time&, const rclcpp::Duration&)’

175 | virtual return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) = 0;

  |                       ^~~~

/opt/ros/humble/include/hardware_interface/system_interface.hpp:186:23: note: ‘virtual hardware_interface::return_type hardware_interface::SystemInterface::write(const rclcpp::Time&, const rclcpp::Duration&)’

186 | 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[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/diffdrive_arduino.dir/all] Error 2

gmake: *** [Makefile:146: all] Error 2


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

Summary: 4 packages finished [32.3s]

1 package failed: diffdrive_arduino

3 packages had stderr output: diffdrive_arduino serial serial_motor_demo

joshnewans commented 4 months ago

Hi! You aren't on the humble branch of diffdrive_arduino. I can see this is your first line

In file included from /home/alexf/robot_ws/src/diffdrive_arduino/src/fake_robot.cpp:1:

Which is from the foxy version. Make sure you are using https://github.com/joshnewans/diffdrive_arduino/tree/humble

Getafix17 commented 3 months ago

Hi, Josh. Thanks for the response, I figured it out a while ago, after watching your YouTube video again. Thanks anyway. I have made two robots, one with Humble and one with the old Foxy branch. My robot's chassis is circular. There are some very nice chassis designs for free download at https://openroboticplatform.com/ These can be lasercut after downloading the necessary files. I am trying to create a new URDF.xacro for the one I have because I have an issue with the odom frame diplaying in the wrong orientation. ChatGPT 4.o is very useful because it allows you to upload a picture of the robot and then give the dimensions. It won't work right away; it needs some tweaks.