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

Add Mecanum Drive Controller #512

Merged

Conversation

destogl
Copy link
Member

@destogl destogl commented Jan 27, 2023

.pre-commit-config.yaml Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2023

Codecov Report

Attention: Patch coverage is 92.89520% with 40 lines in your changes missing coverage. Please review.

Project coverage is 83.55%. Comparing base (4f447f4) to head (7458e24).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
..._drive_controller/src/mecanum_drive_controller.cpp 90.53% 17 Missing and 6 partials ⚠️
..._controller/test/test_mecanum_drive_controller.hpp 86.04% 8 Missing and 4 partials ⚠️
mecanum_drive_controller/src/odometry.cpp 89.58% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #512      +/-   ##
==========================================
+ Coverage   83.08%   83.55%   +0.47%     
==========================================
  Files         115      122       +7     
  Lines       10396    10963     +567     
  Branches      894      932      +38     
==========================================
+ Hits         8637     9160     +523     
- Misses       1459     1489      +30     
- Partials      300      314      +14     
Flag Coverage Δ
unittests 83.55% <92.89%> (+0.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ller/include/mecanum_drive_controller/odometry.hpp 100.00% <100.00%> (ø)
...roller/test/test_load_mecanum_drive_controller.cpp 100.00% <100.00%> (ø)
..._controller/test/test_mecanum_drive_controller.cpp 100.00% <100.00%> (ø)
.../test/test_mecanum_drive_controller_preceeding.cpp 100.00% <100.00%> (ø)
mecanum_drive_controller/src/odometry.cpp 89.58% <89.58%> (ø)
..._controller/test/test_mecanum_drive_controller.hpp 86.04% <86.04%> (ø)
..._drive_controller/src/mecanum_drive_controller.cpp 90.53% <90.53%> (ø)

... and 3 files with indirect coverage changes

---- 🚨 Try these New Features:

@destogl destogl force-pushed the add-mecanum-drive-controller branch from 9b036ae to 43b183f Compare February 8, 2023 16:36
@destogl destogl force-pushed the add-mecanum-drive-controller branch from 80df10c to 936bb9e Compare February 22, 2023 16:48
@destogl destogl force-pushed the add-mecanum-drive-controller branch from 936bb9e to 48415bf Compare March 8, 2023 18:45
@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2023

This pull request is in conflict. Could you fix it @destogl?

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, suggestions only for small changes like typos etc.

mecanum_drive_controller/src/mecanum_drive_controller.yaml Outdated Show resolved Hide resolved
mecanum_drive_controller/src/mecanum_drive_controller.yaml Outdated Show resolved Hide resolved
mecanum_drive_controller/src/mecanum_drive_controller.yaml Outdated Show resolved Hide resolved
mecanum_drive_controller/src/odometry.cpp Show resolved Hide resolved
mecanum_drive_controller/src/odometry.cpp Outdated Show resolved Hide resolved
mecanum_drive_controller/doc/userdoc.rst Outdated Show resolved Hide resolved
mecanum_drive_controller/doc/userdoc.rst Outdated Show resolved Hide resolved
mecanum_drive_controller/doc/userdoc.rst Outdated Show resolved Hide resolved
@mergify
Copy link
Contributor

mergify bot commented Jul 27, 2023

This pull request is in conflict. Could you fix it @destogl?

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And some more: StoglRobotics-forks#23

@destogl but when_reference_msg_received_expect_updated_commands_and_status_message still fails

@Pratham-Pandey
Copy link

I am unable to compile it successfully. Others experiencing the same?

Sequence of steps:

git clone https://github.com/StoglRobotics-forks/ros2_controllers.git
cd ros2_controllers/
git checkout add-mecanum-drive-controller
cd ../..
colcon build --symlink-install

Error Log:

Starting >>> forward_command_controller
Starting >>> steering_controllers_library
Starting >>> joint_trajectory_controller
Starting >>> diff_drive_controller
[Processing: diff_drive_controller, forward_command_controller, joint_trajectory_controller, steering_controllers_library]             
[Processing: diff_drive_controller, forward_command_controller, joint_trajectory_controller, steering_controllers_library]                         
--- stderr: joint_trajectory_controller                                                                                                            
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp: In member function ‘virtual controller_interface::CallbackReturn joint_trajectory_controller::JointTrajectoryController::on_init()’:
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp:58:30: error: ‘get_robot_description’ was not declared in this scope; did you mean ‘goal_event_descriptions’?
   58 |   const std::string & urdf = get_robot_description();
      |                              ^~~~~~~~~~~~~~~~~~~~~
      |                              goal_event_descriptions
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp: In member function ‘virtual controller_interface::return_type joint_trajectory_controller::JointTrajectoryController::update(const rclcpp::Time&, const rclcpp::Duration&)’:
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp:140:7: error: ‘get_lifecycle_state’ was not declared in this scope; did you mean ‘rcl_lifecycle_state_t’?
  140 |   if (get_lifecycle_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE)
      |       ^~~~~~~~~~~~~~~~~~~
      |       rcl_lifecycle_state_t
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp: In member function ‘void joint_trajectory_controller::JointTrajectoryController::query_state_service(std::shared_ptr<control_msgs::srv::QueryTrajectoryState_Request_<std::allocator<void> > >, std::shared_ptr<control_msgs::srv::QueryTrajectoryState_Response_<std::allocator<void> > >)’:
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp:596:7: error: ‘get_lifecycle_state’ was not declared in this scope; did you mean ‘rcl_lifecycle_state_t’?
  596 |   if (get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
      |       ^~~~~~~~~~~~~~~~~~~
      |       rcl_lifecycle_state_t
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp: In member function ‘rclcpp_action::GoalResponse joint_trajectory_controller::JointTrajectoryController::goal_received_callback(const GoalUUID&, std::shared_ptr<const control_msgs::action::FollowJointTrajectory_Goal_<std::allocator<void> > >)’:
/home/user_2/files/general/update_cont/src/ros2_controllers/joint_trajectory_controller/src/joint_trajectory_controller.cpp:1115:7: error: ‘get_lifecycle_state’ was not declared in this scope; did you mean ‘rcl_lifecycle_state_t’?
 1115 |   if (get_lifecycle_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE)
      |       ^~~~~~~~~~~~~~~~~~~
      |       rcl_lifecycle_state_t
gmake[2]: *** [CMakeFiles/joint_trajectory_controller.dir/build.make:76: CMakeFiles/joint_trajectory_controller.dir/src/joint_trajectory_controller.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:212: CMakeFiles/joint_trajectory_controller.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< joint_trajectory_controller [1min 7s, exited with code 2]
Aborted  <<< diff_drive_controller [1min 7s]                                                             
Aborted  <<< steering_controllers_library [1min 34s]                                                       
Aborted  <<< forward_command_controller [1min 43s]                                         

Summary: 0 packages finished [1min 44s]
  1 package failed: joint_trajectory_controller
  3 packages aborted: diff_drive_controller forward_command_controller steering_controllers_library
  4 packages had stderr output: diff_drive_controller forward_command_controller joint_trajectory_controller steering_controllers_library
  19 packages not processed

@christophfroehlich
Copy link
Contributor

Do you have ros2_control from jazzy or rolling? The API is not backwards compatible.

@Pratham-Pandey
Copy link

Do you have ros2_control from jazzy or rolling? The API is not backwards compatible.

I am running Ros2 Iron. Does ros2_control has separate version? how do i check it?

@christophfroehlich
Copy link
Contributor

I am running Ros2 Iron. Does ros2_control has separate version? how do i check it?

Sure, there are different versions of ros2_control for different distros. You can compile the development version (which is rolling) from source on iron, see the docs.

@Pratham-Pandey
Copy link

@christophfroehlich after installing ros2_control development version successfully, i re-executed the steps described above in my previous comment but the following error occurs while building. Are you able to build this PR on your machine?:

[0.993s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/user_2/files/general/update_cont/install/test_bot' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[1.119s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
	'joint_trajectory_controller' is in: /home/user_2/files/general/ros2_control_dev/install/joint_trajectory_controller, /opt/ros/iron
	'joint_state_broadcaster' is in: /home/user_2/files/general/ros2_control_dev/install/joint_state_broadcaster, /opt/ros/iron
	'effort_controllers' is in: /home/user_2/files/general/ros2_control_dev/install/effort_controllers, /opt/ros/iron
	'tricycle_controller' is in: /home/user_2/files/general/ros2_control_dev/install/tricycle_controller, /opt/ros/iron
	'imu_sensor_broadcaster' is in: /home/user_2/files/general/ros2_control_dev/install/imu_sensor_broadcaster, /opt/ros/iron
	'velocity_controllers' is in: /home/user_2/files/general/ros2_control_dev/install/velocity_controllers, /opt/ros/iron
	'diff_drive_controller' is in: /home/user_2/files/general/ros2_control_dev/install/diff_drive_controller, /opt/ros/iron
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.

If you understand the risks and want to override a package anyways, add the following to the command line:
	--allow-overriding diff_drive_controller effort_controllers imu_sensor_broadcaster joint_state_broadcaster joint_trajectory_controller tricycle_controller velocity_controllers

This may be promoted to an error in a future release of colcon-override-check.
Starting >>> forward_command_controller
Starting >>> steering_controllers_library
Starting >>> joint_trajectory_controller
Starting >>> diff_drive_controller
[Processing: diff_drive_controller, forward_command_controller, joint_trajectory_controller, steering_controllers_library]
[Processing: diff_drive_controller, forward_command_controller, joint_trajectory_controller, steering_controllers_library]
[Processing: diff_drive_controller, forward_command_controller, joint_trajectory_controller, steering_controllers_library]
--- stderr: steering_controllers_library    
In file included from /opt/ros/iron/src/gtest_vendor/include/gtest/gtest.h:375,
                 from /opt/ros/iron/src/gmock_vendor/include/gmock/internal/gmock-internal-utils.h:47,
                 from /opt/ros/iron/src/gmock_vendor/include/gmock/gmock-actions.h:51,
                 from /opt/ros/iron/src/gmock_vendor/include/gmock/gmock.h:59,
                 from /home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.hpp:18,
                 from /home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:15:
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp: In member function ‘virtual void SteeringControllersLibraryTest_check_exported_interfaces_Test::TestBody()’:
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:73:39: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::shared_ptr<hardware_interface::CommandInterface> >, std::shared_ptr<hardware_interface::CommandInterface> >::value_type’ {aka ‘class std::shared_ptr<hardware_interface::CommandInterface>’} has no member named ‘get_name’
   73 |     EXPECT_EQ(reference_interfaces[i].get_name(), ref_itf_name);
      |                                       ^~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro ‘GTEST_ASSERT_’
   77 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
      |                                                    ^~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest_pred_impl.h:164:3: note: in expansion of macro ‘GTEST_PRED_FORMAT2_’
  164 |   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
      |   ^~~~~~~~~~~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest.h:2028:3: note: in expansion of macro ‘EXPECT_PRED_FORMAT2’
 2028 |   EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
      |   ^~~~~~~~~~~~~~~~~~~
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:73:5: note: in expansion of macro ‘EXPECT_EQ’
   73 |     EXPECT_EQ(reference_interfaces[i].get_name(), ref_itf_name);
      |     ^~~~~~~~~
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:74:39: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::shared_ptr<hardware_interface::CommandInterface> >, std::shared_ptr<hardware_interface::CommandInterface> >::value_type’ {aka ‘class std::shared_ptr<hardware_interface::CommandInterface>’} has no member named ‘get_prefix_name’
   74 |     EXPECT_EQ(reference_interfaces[i].get_prefix_name(), controller_->get_node()->get_name());
      |                                       ^~~~~~~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro ‘GTEST_ASSERT_’
   77 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
      |                                                    ^~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest_pred_impl.h:164:3: note: in expansion of macro ‘GTEST_PRED_FORMAT2_’
  164 |   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
      |   ^~~~~~~~~~~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest.h:2028:3: note: in expansion of macro ‘EXPECT_PRED_FORMAT2’
 2028 |   EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
      |   ^~~~~~~~~~~~~~~~~~~
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:74:5: note: in expansion of macro ‘EXPECT_EQ’
   74 |     EXPECT_EQ(reference_interfaces[i].get_prefix_name(), controller_->get_node()->get_name());
      |     ^~~~~~~~~
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:75:39: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::shared_ptr<hardware_interface::CommandInterface> >, std::shared_ptr<hardware_interface::CommandInterface> >::value_type’ {aka ‘class std::shared_ptr<hardware_interface::CommandInterface>’} has no member named ‘get_interface_name’
   75 |     EXPECT_EQ(reference_interfaces[i].get_interface_name(), joint_reference_interfaces_[i]);
      |                                       ^~~~~~~~~~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro ‘GTEST_ASSERT_’
   77 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
      |                                                    ^~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest_pred_impl.h:164:3: note: in expansion of macro ‘GTEST_PRED_FORMAT2_’
  164 |   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
      |   ^~~~~~~~~~~~~~~~~~~
/opt/ros/iron/src/gtest_vendor/include/gtest/gtest.h:2028:3: note: in expansion of macro ‘EXPECT_PRED_FORMAT2’
 2028 |   EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
      |   ^~~~~~~~~~~~~~~~~~~
/home/user_2/files/general/update_cont/src/ros2_controllers/steering_controllers_library/test/test_steering_controllers_library.cpp:75:5: note: in expansion of macro ‘EXPECT_EQ’
   75 |     EXPECT_EQ(reference_interfaces[i].get_interface_name(), joint_reference_interfaces_[i]);
      |     ^~~~~~~~~
gmake[2]: *** [CMakeFiles/test_steering_controllers_library.dir/build.make:76: CMakeFiles/test_steering_controllers_library.dir/test/test_steering_controllers_library.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:234: CMakeFiles/test_steering_controllers_library.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< steering_controllers_library [1min 43s, exited with code 2]
Aborted  <<< diff_drive_controller [2min 16s]          
Aborted  <<< forward_command_controller [2min 39s]                                                          
Aborted  <<< joint_trajectory_controller [3min 32s]                                          

Summary: 0 packages finished [3min 33s]
  1 package failed: steering_controllers_library
  3 packages aborted: diff_drive_controller forward_command_controller joint_trajectory_controller
  1 package had stderr output: steering_controllers_library
  19 packages not processed


@christophfroehlich
Copy link
Contributor

you are right, try StoglRobotics-forks#26
👀 @destogl

@Pratham-Pandey
Copy link

you are right, try StoglRobotics-forks#26 👀 @destogl

Working 👍

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, some minor touchups left:
StoglRobotics-forks#27

* Update release notes

* Update maintainers

* Update compile flags

* Fix compiler errors
Copy link
Member Author

@destogl destogl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am approving this!

@bmagyar bmagyar merged commit 79358e3 into ros-controls:master Nov 19, 2024
19 of 21 checks passed
mergify bot pushed a commit that referenced this pull request Nov 19, 2024
(cherry picked from commit 79358e3)
@destogl destogl deleted the add-mecanum-drive-controller branch November 26, 2024 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble.
Projects
None yet
Development

Successfully merging this pull request may close these issues.