Skip to content

[CM] Add controller_manager activity topic #2006

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

Merged
merged 21 commits into from
Mar 5, 2025

Conversation

saikishor
Copy link
Member

As discussed in the ros2_control WG meeting on 15th Jan 2025

I've added a topic to the CM inorder to publish information on changes in the CM. This is quite useful to have when developing applications that need to be dynamic enough with the changes in CM. Right now, the only way is to spam the CM with lot of service requests.

It should look something like the below

---
header:
  stamp:
    sec: 1737128088
    nanosec: 39885323
  frame_id: ''
controllers:
- name: forward_position_controller
  state:
    id: 2
    label: inactive
- name: position_controller
  state:
    id: 3
    label: active
- name: joint2_position_controller
  state:
    id: 3
    label: active
- name: joint1_position_controller
  state:
    id: 3
    label: active
- name: joint_state_broadcaster
  state:
    id: 3
    label: active
hardware_components:
- name: RRBot
  state:
    id: 3
    label: active
---

@saikishor saikishor force-pushed the add/cm/activity/topic branch from dbe3071 to 6768145 Compare January 17, 2025 15:36
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 94.80519% with 4 lines in your changes missing coverage. Please review.

Project coverage is 89.56%. Comparing base (3aa38b0) to head (30e8c2c).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ontroller_manager/test/test_controller_manager.cpp 90.00% 0 Missing and 3 partials ⚠️
controller_manager/src/controller_manager.cpp 96.77% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2006      +/-   ##
==========================================
+ Coverage   89.54%   89.56%   +0.02%     
==========================================
  Files         139      139              
  Lines       15125    15195      +70     
  Branches     1283     1290       +7     
==========================================
+ Hits        13543    13609      +66     
+ Misses       1096     1094       -2     
- Partials      486      492       +6     
Flag Coverage Δ
unittests 89.56% <94.80%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
.../include/controller_manager/controller_manager.hpp 96.87% <ø> (ø)
hardware_interface/src/resource_manager.cpp 76.40% <100.00%> (+0.23%) ⬆️
controller_manager/src/controller_manager.cpp 76.70% <96.77%> (+0.42%) ⬆️
...ontroller_manager/test/test_controller_manager.cpp 95.87% <90.00%> (-0.23%) ⬇️

... and 3 files with indirect coverage changes

@saikishor saikishor changed the title Add Controller Manager Activity topic [CM] Add controller_manager activity topic Jan 17, 2025
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.

great addition. Should we also add a publisher section here describing this?
https://control.ros.org/rolling/doc/ros2_control/controller_manager/doc/userdoc.html#subscribers

@saikishor
Copy link
Member Author

great addition. Should we also add a publisher section here describing this?
https://control.ros.org/rolling/doc/ros2_control/controller_manager/doc/userdoc.html#subscribers

Actually, I want to document all the Services and Publishers from the controller manager. I don't know if I have to do it in this PR or a separate PR. What's your opinion @christophfroehlich

@christophfroehlich
Copy link
Contributor

great addition. Should we also add a publisher section here describing this?
https://control.ros.org/rolling/doc/ros2_control/controller_manager/doc/userdoc.html#subscribers

Actually, I want to document all the Services and Publishers from the controller manager. I don't know if I have to do it in this PR or a separate PR. What's your opinion @christophfroehlich

please add the docs for this new publisher with this PR.

@saikishor
Copy link
Member Author

@christophfroehlich done! 👍🏾

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.

Thx!

Comment on lines +381 to +382
resource_manager_->set_on_component_state_switch_callback(
std::bind(&ControllerManager::publish_activity, this));
Copy link
Member

Choose a reason for hiding this comment

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

I understand that this is easier to integrate now but shouldn't we simply make these part of the constructors?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, when we branch off, we will certainly do that :)

bmagyar
bmagyar previously approved these changes Mar 5, 2025
Copy link
Contributor

mergify bot commented Mar 5, 2025

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

@saikishor saikishor dismissed stale reviews from bmagyar and christophfroehlich via 5641d8d March 5, 2025 11:36
@bmagyar bmagyar merged commit ef2b3fc into ros-controls:master Mar 5, 2025
24 of 27 checks passed
@bmagyar bmagyar deleted the add/cm/activity/topic branch March 5, 2025 12:35
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.

5 participants