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

CM: Check if a valid time is received #1901

Merged
merged 11 commits into from
Dec 4, 2024
Merged

CM: Check if a valid time is received #1901

merged 11 commits into from
Dec 4, 2024

Conversation

christophfroehlich
Copy link
Contributor

With use_sim_time=true but nothing received on /clock topic, we get a not so nice exception
ros-controls/gz_ros2_control#439

Not sure if we should escalate and throw an error or spam the console with log output.

Copy link

codecov bot commented Nov 30, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Project coverage is 87.55%. Comparing base (89fd4ef) to head (6b400b9).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
controller_manager/src/controller_manager.cpp 22.22% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1901      +/-   ##
==========================================
- Coverage   87.59%   87.55%   -0.04%     
==========================================
  Files         122      122              
  Lines       12766    12774       +8     
  Branches     1146     1147       +1     
==========================================
+ Hits        11182    11184       +2     
- Misses       1155     1161       +6     
  Partials      429      429              
Flag Coverage Δ
unittests 87.55% <22.22%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
controller_manager/src/controller_manager.cpp 76.31% <22.22%> (-0.30%) ⬇️

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

Personally I would throw an error! Probably we can do that in the constructor of the CM?

@christophfroehlich
Copy link
Contributor Author

Haven't tried that but there are SE answers that clock()->now() with sim_time is always zero in the constructor of a node.

@christophfroehlich
Copy link
Contributor Author

We could just use the time argument instead, and maybe use a throttled/once warning?

@fmauch
Copy link
Contributor

fmauch commented Dec 2, 2024

This definitively fixes the issues I recently faced, thank you for fixing that. Regarding the discussion I think it's good to be verbose about this. A throttled warning seems suitable in my opinion. But it would be good if the warning could point users to how to actually fix that problem if it occurs.

@saikishor
Copy link
Member

This definitively fixes the issues I recently faced, thank you for fixing that. Regarding the discussion I think it's good to be verbose about this. A throttled warning seems suitable in my opinion. But it would be good if the warning could point users to how to actually fix that problem if it occurs.

I just realized that we cannot use the throttle as the clock is not working

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

Sounds fine!

Just some minor changes

controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
Co-authored-by: Felix Exner (fexner) <exner@fzi.de>
Copy link
Contributor

mergify bot commented Dec 3, 2024

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

Copy link
Contributor

@fmauch fmauch left a comment

Choose a reason for hiding this comment

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

Tested this locally with both, a /clock topic present and not. The result was as expected and the output is helpful in case of the missing clock topic.

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

Some changes that might bring back the failing tests.
Sorry, it got mixed up with my Diagnostics update.

controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Show resolved Hide resolved
Co-authored-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

Thanks

@bmagyar bmagyar merged commit 331038d into master Dec 4, 2024
13 of 19 checks passed
@bmagyar bmagyar deleted the no_sim_time branch December 4, 2024 18:27
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.

4 participants