Closed christophfroehlich closed 1 month ago
@SantoshGovindaraj you want to tackle this?
Thank you @christophfroehlich for reaching out! I’d be happy to take on this issue. I believe this would be a great opportunity to contribute further. Just to mention, I’m still relatively new to open-source contributions, but I’m eager to learn and tackle the challenge. I’ll do my best to implement the required changes and would appreciate any guidance along the way. 🙌 Is there any starting point to look into?
Welcome! For this reasons we have the good-first-issue labels ;) Have a look at the code snippets I posted, in fact it is a single line of code to change.
You can use any of the ros2_control_demos or gz_ros2_control_demos for playing aroung with the GUI.
Hi @christophfroehlich I just managed to look into this.
As far as I understand, I think we need to just change method name from load_controller
to configure_controller
in line 263.
yes I think so, too.
Many Thanks @christophfroehlich , I have amended the changes and I am trying to the test it with ros2_control_demo_example_2, to find any other potential bugs. Once verified, I create PR for to solve this issue. Is there anything more we might have to look into?
@christophfroehlich I have a quick question that I hope you don’t mind addressing. I’ve been trying to resolve this issue for a while. As per the instructions, I forked the repo and built it on my system (Ubuntu 22, ROS Iron). In the same workspace, I cloned and successfully built ros2_control_demos. However, when running diffbot.launch.py, the joint_state_controller and diffbot_base_controller fail to load.
Should I be working with the iron branch instead? If so, would this create any conflicts when submitting a PR?
Apologies if this isn't the appropriate place to ask this question.
If you want to use the rolling version of ros2_control (the master branch) on an iron distro, you also have to compile the correct version of ros2_controllers. See this repos file for example.
Thanks, @christophfroehlich . I'm still encountering issues building the ros2_control
master
branch with ROS Iron, especially building controllers. Based on the ros_control_ci
, it seems that rolling compatibility with Iron is failing, I believe.
I will push a PR with the suggested changes. Please let me know if any additional modifications are needed.
what are the issues with building it? as far as I remember, the compatibility job only fails somewhere in the tests
Yes, I agree. The build is failing in the tests. The following is the build error I am facing.
--- stderr: joint_state_broadcaster
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp: In member function ‘void JointStateBroadcasterTest::init_broadcaster_and_set_parameters(const std::vector<std::__cxx11::basic_string<char> >&, const std::vector<std::__cxx11::basic_string<char> >&)’:
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp:72:47: error: no matching function for call to ‘FriendJointStateBroadcaster::init(const char [24])’
72 | const auto result = state_broadcaster_->init("joint_state_broadcaster");
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/santosh/open_source/ros2_control_ws/install/controller_interface/include/controller_interface/controller_interface/controller_interface.hpp:21,
from /home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/include/joint_state_broadcaster/joint_state_broadcaster.hpp:24,
from /home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp:28:
/home/santosh/open_source/ros2_control_ws/install/controller_interface/include/controller_interface/controller_interface/controller_interface_base.hpp:129:15: note: candidate: ‘controller_interface::return_type controller_interface::ControllerInterfaceBase::init(const string&, const string&, unsigned int, const string&, const rclcpp::NodeOptions&)’
129 | return_type init(
| ^~~~
/home/santosh/open_source/ros2_control_ws/install/controller_interface/include/controller_interface/controller_interface/controller_interface_base.hpp:129:15: note: candidate expects 5 arguments, 1 provided
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp: In member function ‘void JointStateBroadcasterTest::activate_and_get_joint_state_message(const string&, sensor_msgs::msg::JointState&)’:
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp:673:11: error: ‘rclcpp::executors’ has not been declared
673 | rclcpp::executors::SingleThreadedExecutor executor;
| ^~~~~~~~~
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp:674:3: error: ‘executor’ was not declared in this scope
674 | executor.add_node(test_node.get_node_base_interface());
| ^~~~~~~~
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp: In member function ‘void JointStateBroadcasterTest::test_published_dynamic_joint_state_message(const string&)’:
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp:749:11: error: ‘rclcpp::executors’ has not been declared
749 | rclcpp::executors::SingleThreadedExecutor executor;
| ^~~~~~~~~
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_joint_state_broadcaster.cpp:750:3: error: ‘executor’ was not declared in this scope
750 | executor.add_node(test_node.get_node_base_interface());
| ^~~~~~~~
gmake[2]: *** [CMakeFiles/test_joint_state_broadcaster.dir/build.make:76: CMakeFiles/test_joint_state_broadcaster.dir/test/test_joint_state_broadcaster.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:264: CMakeFiles/test_joint_state_broadcaster.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
In file included from /usr/include/c++/11/memory:76,
from /opt/ros/iron/src/gmock_vendor/include/gmock/gmock-actions.h:46,
from /opt/ros/iron/src/gmock_vendor/include/gmock/gmock.h:59,
from /home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_load_joint_state_broadcaster.cpp:15:
/usr/include/c++/11/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = hardware_interface::ResourceManager; _Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<hardware_interface::ResourceManager>]’:
/home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_load_joint_state_broadcaster.cpp:33:58: required from here
/usr/include/c++/11/bits/unique_ptr.h:962:30: error: no matching function for call to ‘hardware_interface::ResourceManager::ResourceManager(const std::__cxx11::basic_string<char>&)’
962 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/santosh/open_source/ros2_control_ws/install/controller_manager/include/controller_manager/controller_manager/controller_manager.hpp:44,
from /home/santosh/open_source/ros2_control_ws/src/ros-controls/ros2_controllers/joint_state_broadcaster/test/test_load_joint_state_broadcaster.cpp:18:
/home/santosh/open_source/ros2_control_ws/install/hardware_interface/include/hardware_interface/hardware_interface/resource_manager.hpp:69:12: note: candidate: ‘hardware_interface::ResourceManager::ResourceManager(const string&, rclcpp::node_interfaces::NodeClockInterface::SharedPtr, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr, bool, unsigned int)’
69 | explicit ResourceManager(
| ^~~~~~~~~~~~~~~
/home/santosh/open_source/ros2_control_ws/install/hardware_interface/include/hardware_interface/hardware_interface/resource_manager.hpp:69:12: note: candidate expects 5 arguments, 1 provided
/home/santosh/open_source/ros2_control_ws/install/hardware_interface/include/hardware_interface/hardware_interface/resource_manager.hpp:51:12: note: candidate: ‘hardware_interface::ResourceManager::ResourceManager(rclcpp::node_interfaces::NodeClockInterface::SharedPtr, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr)’
51 | explicit ResourceManager(
| ^~~~~~~~~~~~~~~
/home/santosh/open_source/ros2_control_ws/install/hardware_interface/include/hardware_interface/hardware_interface/resource_manager.hpp:51:12: note: candidate expects 2 arguments, 1 provided
gmake[2]: *** [CMakeFiles/test_load_joint_state_broadcaster.dir/build.make:76: CMakeFiles/test_load_joint_state_broadcaster.dir/test/test_load_joint_state_broadcaster.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:235: CMakeFiles/test_load_joint_state_broadcaster.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< joint_state_broadcaster [5.19s, exited with code 2]
Yes, I agree. The build is failing in the tests. The following is the build error I am facing.
No, the test stage is failing, not the build. From your log it seems that you have mixed different versions of the repos, or you have sourced your iron workspace before the build and the overlay does not work. Do you have ros2_control, ros2_controllers, and ros2_control_demos on the master branch? And built every dependency, e.g,
colcon build --packages-up-to ros2_control_demo_example_2
?
From your log it seems that you have mixed different versions of the repos, or you have sourced your iron workspace before the build and the overlay does not work. Oh, okay. I understand.
Yes, it solved the issue I was having. Now, I am able to successfully build and run the ros2_control_demo_example_2
.
Many thanks @christophfroehlich for the clarification and helping with my problem. This will be useful understanding for my future contribution to the repo. I also tested the changes too. 😃
Background
If the controller is unconfigured (e.g, after unloading with the GUI), the item "configure and activate" is shown. https://github.com/ros-controls/ros2_control/blob/0433960580c5834b11af9703e3e34ace86824d01/rqt_controller_manager/rqt_controller_manager/controller_manager.py#L236-L238 But then, the wrong actions are performed. Instead of load+activate it should configure+activate https://github.com/ros-controls/ros2_control/blob/0433960580c5834b11af9703e3e34ace86824d01/rqt_controller_manager/rqt_controller_manager/controller_manager.py#L262-L264
Instructions
Hi, this is a
good-first-issue
issue. This means we've worked to make it more legible to people who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.We're interested in helping you take the first step, and can answer questions and help you out along the way. Note that we're especially interested in contributions from underrepresented groups!
We know that creating a pull request is the biggest barrier for new contributors. This issue is for you 💝
If you have contributed before, consider leaving this PR for someone new, and looking through our general bug issues. Thanks!
🤔 What you will need to know.
Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.
📋 Step by Step
[ ] 🙋 Claim this issue: Comment below. If someone else has claimed it, ask if they've opened a pull request already and if they're stuck -- maybe you can help them solve a problem or move it along!
[ ] 🗄️ Create a local workspace for making your changes and testing following these instructions, for Step 3 use "Download Source Code" section with these instructions.
[ ] 🍴 Fork the repository using the handy button at the top of the repository page and clone it into
~/ws_ros2_control/src/ros-controls/ros2_control
, here is a guide that you can follow (You will have to remove or empty the existingros2_control
folder before cloning your own fork)[ ] Checkout a new branch using
git checkout -b <branch_name>
[ ] 🤖 Apply
pre-commit
auto formatting, by runningpip3 install pre-commit
and runningpre-commit install
in the ros2_control repo.[ ] 💾 Commit and Push your changes
[ ] 🔀 Start a Pull Request to request to merge your code into
master
. There are two ways that you can start a pull request:[ ] 🏁 Done Ask in comments for a review :)
Is someone else already working on this?
🔗- We encourage contributors to link to the original issue in their pull request so all users can easily see if someone's already started on it.
👥- If someone seems stuck, offer them some help!
🤔❓ Questions?
Don’t hesitate to ask questions or to get help if you feel like you are getting stuck. For example leave a comment below! Furthermore, you find helpful resources here:
Good luck with your first issue!