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

Ros2 control node #216

Closed
wants to merge 8 commits into from
Closed

Conversation

destogl
Copy link
Member

@destogl destogl commented Oct 28, 2020

rework of #147.

Changes:

  • controller_manager - callback groups for services and update loop
  • controller_interface - enable undeclared parameters for now
  • ros2_control_node - default node - currently is using TestRobotHardware to initialize something until ResourceManager is compleated

@destogl
Copy link
Member Author

destogl commented Oct 28, 2020

Check out the follow-up issues

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.

Remove @brief in newly added doxygen comments (see #202)

controller_manager/src/ros2_control_node.cpp Outdated Show resolved Hide resolved
Comment on lines +36 to +41
auto cm = std::make_shared<controller_manager::ControllerManager>(
// TODO(anyone): remove robot_hw when ResourceManager is added
// since RobotHW is not a plugin we had to take some type of robot
std::make_shared<test_robot_hardware::TestRobotHardware>(),
executor,
manager_node_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is that? Why would you hardcode TestRobotHardware here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we need to have something here otherwise it will not work. As soon is there the ResourceManager there is no issue any more.

The RobotHardware should be loaded dynamically to work properly.

timer = cm->create_wall_timer(
std::chrono::milliseconds(update_time_ms),
std::bind(&controller_manager::ControllerManager::update, cm.get()),
cm->deterministic_callback_group_);
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks a bit like a dependency inversion to me. If the executor is handled outside of the controller manager in its own node, then the associated callback groups should be handled externally as well.
With this approach - essentially having the controller manager's callback groups exposed publicly - every node can temper with the execution model of the controller manager and provoke a undesired behavior given the assumptions within the CM.

Copy link
Contributor

Choose a reason for hiding this comment

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

Realistically, I see two executors being used here. The first one spawns the controller and handles the update (as well as the read and write) loop with a given frequency. That executor can then be assigned a higher realtime priority by the operating system to guarantee a deterministic behavior.
We have to introduce a second node which handles the async callbacks to low prio calls such as list controllers etc.

That workaround is needed as we're targeting foxy and we can't leverage the changes introduced in here: ros2/rclcpp#1218

Copy link
Member

Choose a reason for hiding this comment

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

Please submit a PR with a suggested alternative

Copy link
Member Author

Choose a reason for hiding this comment

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

@Karsten1987 I agree with you. I added here are @v-lopez and @gavanderhoorn commented that they want to temper with the execution of update function.

Or should they then just call specialize ControllerManager in a new class?

controller_manager/src/controller_manager.cpp Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
@codecov-io
Copy link

Codecov Report

Merging #216 (baaf393) into master (3d542bb) will decrease coverage by 0.18%.
The diff coverage is 26.66%.

@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
- Coverage   31.41%   31.23%   -0.19%     
==========================================
  Files          38       39       +1     
  Lines        2489     2513      +24     
  Branches     1638     1646       +8     
==========================================
+ Hits          782      785       +3     
- Misses        251      265      +14     
- Partials     1456     1463       +7     
Flag Coverage Δ
unittests 31.23% <26.66%> (-0.19%) ⬇️

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

Impacted Files Coverage Δ
.../include/controller_manager/controller_manager.hpp 62.50% <ø> (ø)
controller_manager/src/ros2_control_node.cpp 0.00% <0.00%> (ø)
...ontroller_manager/test/test_controller_manager.cpp 8.88% <ø> (ø)
controller_interface/src/controller_interface.cpp 30.00% <33.33%> (-3.34%) ⬇️
controller_manager/src/controller_manager.cpp 40.22% <47.82%> (+0.51%) ⬆️

Signed-off-by: Karsten Knese <Karsten1987@users.noreply.github.com>
@Karsten1987 Karsten1987 mentioned this pull request Nov 11, 2020
@Karsten1987
Copy link
Contributor

I tried your PR locally and the node without having any controllers loaded nor doing any work eats up a complete core with more than 100% CPU.
Can you reproduce this?

@destogl
Copy link
Member Author

destogl commented Nov 13, 2020

@Karsten1987: I can confirm this. There is a lot of resource usage... I have between 60% and 95% CPU usage

Why is that? update calls?

@destogl
Copy link
Member Author

destogl commented Nov 15, 2020

@Karsten1987. it seems you merged some of the code here already in #236. Should I close this now?

@destogl
Copy link
Member Author

destogl commented Nov 20, 2020

Added into #236. closing...

@destogl destogl closed this Nov 20, 2020
@destogl destogl deleted the ros2_control_node branch August 16, 2021 14:23
destogl added a commit to StoglRobotics-forks/ros2_control that referenced this pull request Aug 11, 2022
…ces on specific joints (ros-controls#216)

* Joint state broadcaster support for specific joint_names and interface_names.
* Extend documentation.
Co-authored-by: Bence Magyar <bence.magyar.robotics@gmail.com>
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.

6 participants