mateusmenezes95 / omnidirectional_controllers

ROS2 controllers for Omnidirectional robots with three wheels
MIT License
29 stars 5 forks source link

Two Errors: One on installing dependencies as mentioned and another on building #2

Closed aamodbk closed 8 months ago

aamodbk commented 9 months ago

On typing this command:

rosdep install --from-paths src/omnidirectional_controllers --ignore-src -r -y --rosdistro foxy

I get this error:

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
omnidirectional_controllers: Cannot locate rosdep definition for [ament_add_gmock]

And on typing this command:

colcon build --symlink-install --event-handlers console_direct+

I get this error:

/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp: In member function ‘void omnidirectional_controllers::OmnidirectionalController::velocityCommandUnstampedCallback(geometry_msgs::msg::Twist_<std::allocator<void> >::SharedPtr)’:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
  324 |     RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
      |                      ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:5: error: template argument 1 is invalid
  324 |     RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
      |     ^~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:5: error: template argument 1 is invalid
  324 |     RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
      |     ^~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:5: error: template argument 1 is invalid
  324 |     RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
      |     ^~~~~~~~~~~
In file included from /opt/ros/galactic/include/rclcpp/client.hpp:40,
                 from /opt/ros/galactic/include/rclcpp/callback_group.hpp:23,
                 from /opt/ros/galactic/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/galactic/include/rclcpp/memory_strategy.hpp:25,
                 from /opt/ros/galactic/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/galactic/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/galactic/include/rclcpp/executor.hpp:36,
                 from /opt/ros/galactic/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/galactic/include/rclcpp/executors.hpp:21,
                 from /opt/ros/galactic/include/rclcpp/rclcpp.hpp:156,
                 from /opt/ros/galactic/include/controller_interface/controller_interface.hpp:28,
                 from /home/aamod/dev_ws/src/omnidirectional_controllers/include/omnidirectional_controllers/omnidirectional_controller.hpp:30,
                 from /home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:23:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
  324 |     RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
      |                      ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
  324 |     RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
      |                      ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:329:39: error: base operand of ‘->’ is not a pointer
  329 |   this->cmd_vel_->header.stamp = node_->get_clock()->now();
      |                                       ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp: In member function ‘virtual controller_interface::return_type omnidirectional_controllers::OmnidirectionalController::update(const rclcpp::Time&, const rclcpp::Duration&)’:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:335:22: error: base operand of ‘->’ is not a pointer
  335 |   auto logger = node_->get_logger();
      |                      ^~
In file included from /opt/ros/galactic/include/rclcpp/service.hpp:34,
                 from /opt/ros/galactic/include/rclcpp/callback_group.hpp:25,
                 from /opt/ros/galactic/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/galactic/include/rclcpp/memory_strategy.hpp:25,
                 from /opt/ros/galactic/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/galactic/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/galactic/include/rclcpp/executor.hpp:36,
                 from /opt/ros/galactic/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/galactic/include/rclcpp/executors.hpp:21,
                 from /opt/ros/galactic/include/rclcpp/rclcpp.hpp:156,
                 from /opt/ros/galactic/include/controller_interface/controller_interface.hpp:28,
                 from /home/aamod/dev_ws/src/omnidirectional_controllers/include/omnidirectional_controllers/omnidirectional_controller.hpp:30,
                 from /home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:23:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:358:7: error: template argument 1 is invalid
  358 |       RCLCPP_ERROR(logger, e.what());
      |       ^~~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:358:7: error: template argument 1 is invalid
  358 |       RCLCPP_ERROR(logger, e.what());
      |       ^~~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:358:7: error: template argument 1 is invalid
  358 |       RCLCPP_ERROR(logger, e.what());
      |       ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/omnidirectional_controllers.dir/build.make:63: CMakeFiles/omnidirectional_controllers.dir/src/omnidirectional_controller.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:241: CMakeFiles/omnidirectional_controllers.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< omnidirectional_controllers [2.25s, exited with code 2]

Summary: 1 package finished [4.52s]
  1 package failed: omnidirectional_controllers
  1 package had stderr output: omnidirectional_controllers

I am a beginner in ROS so I do not know if this is trivial so please excuse my question if it is so.

mateusmenezes95 commented 9 months ago

Hello @aamodbk. I think the issues are because you are using the Galactic version but I developed the package for the Foxy version. The ROS maintainers releases versions frequently and between versions exists what we call API and ABI breaking. These breakings is which cause the building to fail when a package created in a version is built in another version. And about the first problem, It is very likely that this package I used was not yet available in the Galactic version

I strongly recommend you upgrade your ROS to the ROS 2 Humble version

aamodbk commented 9 months ago

I started out with the galactic version but switched to foxy by sourcing the /opt/ros/foxy/setup.bash file instead of the galactic one and then tried out running the commands but it shows the same errors. I also thought the issue might be with the workspace since I had first built it with galactic but even after removing the build, install and log directories using rm -rf build/ install/ log/ and building again with foxy, the same errors are being shown.

aamodbk commented 9 months ago

Update: I looked into the package.xml file and noticed that @mateusmenezes95, you had included ament_add_gmock as one of the package dependencies but I don't see a ros2 package named ament_add_gmock listed instead I only saw ament_cmake_gmock package.

Also upon scrolling through the log to find source of the error upon building it shows this message:

In file included from /home/aamod/ros2_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:23:
/home/aamod/ros2_ws/src/omnidirectional_controllers/include/omnidirectional_controllers/omnidirectional_controller.hpp:114:37: error: ‘LifecycleNode’ is not a member of ‘rclcpp_lifecycle’
  114 |   std::shared_ptr<rclcpp_lifecycle::LifecycleNode> node_;
      |                                     ^~~~~~~~~~~~~
/home/aamod/ros2_ws/src/omnidirectional_controllers/include/omnidirectional_controllers/omnidirectional_controller.hpp:114:37: error: ‘LifecycleNode’ is not a member of ‘rclcpp_lifecycle’

I have checked the rclcpp_lifecycle CPP files in the /opt/ros/foxy/include/ directory and it seems to have the class LifecycleNode in it but still drops this error upon building for some reason. I would appreciate it if you could explain the reason behind this error.

mateusmenezes95 commented 9 months ago

Hello @aamodbk, thanks for reporting the error in the package.xml. I will change it now.

About the second error, did you change the repository branch to build the package? The default branch of the package is for the ROS 2 Humble. Hence, if you only clone the repository without change the branch, maybe you are try to build the Humble version in a ROS 2 Foxy installation. If the error persists let me know

mateusmenezes95 commented 9 months ago

@aamodbk, I added a GitHub Action Wokflow to build the repository using the Humble version. Now we can ensure that the repository are building properly in the Humble version, because the jobs performed in the action run in fresh ubuntu 22.04 environment. Please, try to build the package in the Humble version with the new commits that I made. As the ROS 2 Foxy is not maintained anymore by the ROS 2 community, I think it is not worth to fix problems there.

aamodbk commented 9 months ago

@mateusmenezes95 , Thank you so much for the update, I will upgrade to ROS2 Humble version since it is supported currently. I did not notice the branch mentioned the Humble version but upgrading ROS2 distro should fix the issue.

aamodbk commented 8 months ago

Hey @mateusmenezes95, I wanted to know if I could use your controller for robots of different dimensions and what exactly would I have to change in case I wanted to do so. In my robot, the wheels are arranged not on a circular base but a T shaped base making an isosceles triangle instead of an equilateral one. Could you please guide me in what changes I need to make to the controller for support on the mentioned robot? Sorry for contacting you here I had no other way of communication. It would be helpful if you could provide an email address to mail you on.

mateusmenezes95 commented 8 months ago

Hello @aamodbk, you can contact me through the email mateusmenezes95@gmail.com. Just a tip, you can always find the email of the package maintainer in the package.xml.

About your question, Take a look in the math documentation about the forward and inverse kinematics of the robot that I used. If you do not get adjust the kinematic of your robot to the current implementation (mainly the gamma parameter) you will need to implement forward and inverse kinematics yourself. Take a look in the kinematics.hpp and kinematics.cpp. I think that if you only implement this class (if need) you will not to change the other stuffs. I recommend the book Modern Robotics: Mechanics, Planning, and Control of the authors Kevin M. Lynch and Frank C. Park. This book have the forward and inverse kinematics of a T-Shape omnidirectional robot, although in a fast thinking, maybe you only need to find the parameters to use my implementation.