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

Fix WaitSet issue in tests #1206

Merged
merged 29 commits into from
Jul 16, 2024
Merged

Conversation

saikishor
Copy link
Member

This PR aims to fix the WaitSet issue with the command subscription in the tests

@bmagyar
Copy link
Member

bmagyar commented Jul 15, 2024

This approach looks very good! Thank you for taking the time!

@saikishor saikishor marked this pull request as ready for review July 15, 2024 21:48
@saikishor
Copy link
Member Author

saikishor commented Jul 15, 2024

@bmagyar @destogl @christophfroehlich Apart from this failing test TestTrajectoryActions.test_tolerances_via_actions, the rest of the tests that use WaitSet pass with the new fixes. I think it's better to fix this test separately in a different PR after or before this. Thank you for your support.

5: [ RUN      ] TestTrajectoryActions.test_tolerances_via_actions
5: [INFO] [1721079954.094818503] [test_joint_trajectory_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
5: [INFO] [1721079954.094849567] [test_joint_trajectory_controller]: Command interfaces are [position] and state interfaces are [position velocity].
5: [INFO] [1721079954.094887736] [test_joint_trajectory_controller]: Using 'splines' interpolation method.
5: [INFO] [1721079954.095324437] [test_joint_trajectory_controller]: Action status changes will be monitored at 20.00 Hz.
5: [INFO] [1721079954.397499342] [test_joint_trajectory_controller]: Received new action goal
5: [INFO] [1721079954.397541138] [test_joint_trajectory_controller]: Accepted new action goal
5: [INFO] [1721079954.897661639] [test_joint_trajectory_controller]: Goal reached, success!
5: /home/user/rolling_noble/ros2_control_ws/src/ros2_controllers/joint_trajectory_controller/test/test_trajectory_controller_utils.hpp:48: Failure
5: Expected equality of these values:
5:   active_tolerances.goal_time_tolerance
5:     Which is: 1
5:   default_goal_time
5:     Which is: 0.10000000000000001
5: Google Test trace:
5: /home/user/rolling_noble/ros2_control_ws/src/ros2_controllers/joint_trajectory_controller/test/test_trajectory_actions.cpp:517: Check default values
5: 
5: [INFO] [1721079956.397694646] [test_joint_trajectory_controller]: Received new action goal
5: [INFO] [1721079956.397755103] [test_joint_trajectory_controller]: Accepted new action goal
5: [INFO] [1721079956.897870466] [test_joint_trajectory_controller]: Goal reached, success!
5: [INFO] [1721079958.397807526] [test_joint_trajectory_controller]: Received new action goal
5: [INFO] [1721079958.397844261] [test_joint_trajectory_controller]: Accepted new action goal
5: [INFO] [1721079958.897976363] [test_joint_trajectory_controller]: Goal reached, success!
5: /home/user/rolling_noble/ros2_control_ws/src/ros2_controllers/joint_trajectory_controller/test/test_trajectory_controller_utils.hpp:48: Failure
5: Expected equality of these values:
5:   active_tolerances.goal_time_tolerance
5:     Which is: 1
5:   default_goal_time
5:     Which is: 0.10000000000000001
5: 
5: [  FAILED  ] TestTrajectoryActions.test_tolerances_via_actions (6014 ms)

@github-actions github-actions bot requested a review from bmagyar July 15, 2024 22:04
@christophfroehlich
Copy link
Contributor

@bmagyar @destogl @christophfroehlich Apart from this failing test TestTrajectoryActions.test_tolerances_via_actions, the rest of the tests that use WaitSet pass with the new fixes. I think it's better to fix this test separately in a different PR after or before this. Thank you for your support.

I reported this already in #1192 ;) I can have a look today to fix it 👀 @fmauch

@saikishor
Copy link
Member Author

I reported this already in #1192 ;) I can have a look today to fix it 👀 @fmauch

Awesome. Thank you so much @christophfroehlich

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.

The new code looks quite simple 👍 And if it works -> great! Thanks for your efforts!

@fmauch fmauch mentioned this pull request Jul 16, 2024
8 tasks
@christophfroehlich christophfroehlich added backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble. backport-iron labels Jul 16, 2024
Comment on lines 211 to 213
executor.add_node(test_subscription_node.get_node_base_interface());
received_msg.reset();
ASSERT_FALSE(received_msg);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
executor.add_node(test_subscription_node.get_node_base_interface());
received_msg.reset();
ASSERT_FALSE(received_msg);
received_msg.reset();
ASSERT_FALSE(received_msg);
executor.add_node(test_subscription_node.get_node_base_interface());

I'm not sure I'm understanding this part completely but I think adding the node before resetting the local var is problematic. Why do we even need to reset it and then check that it's still reset?

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't be a problem unless you spin in between. if you spin yes, then it would reset and be a problem. I was just resetting and added assert to be sure nothing much

Copy link
Member

Choose a reason for hiding this comment

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

Since it is a local variable... does it matter at all if we not reset it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, it doesn't matter. I can remove it

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Done

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 83.09179% with 35 lines in your changes missing coverage. Please review.

Project coverage is 86.58%. Comparing base (0b43291) to head (1d2b3b6).
Report is 48 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1206       +/-   ##
===========================================
+ Coverage   71.86%   86.58%   +14.71%     
===========================================
  Files          41       95       +54     
  Lines        3650     8585     +4935     
  Branches     1794      718     -1076     
===========================================
+ Hits         2623     7433     +4810     
- Misses        707      883      +176     
+ Partials      320      269       -51     
Flag Coverage Δ
unittests 86.58% <83.09%> (+14.71%) ⬆️

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

Files Coverage Δ
...roller/test/test_ackermann_steering_controller.cpp 100.00% <100.00%> (ø)
...nce_controller/test/test_admittance_controller.cpp 100.00% <100.00%> (ø)
...ntroller/test/test_bicycle_steering_controller.cpp 100.00% <100.00%> (ø)
...ory_controller/test/test_trajectory_controller.cpp 99.74% <100.00%> (ø)
pid_controller/test/test_pid_controller.cpp 100.00% <100.00%> (ø)
...library/test/test_steering_controllers_library.hpp 96.87% <100.00%> (ø)
...troller/test/test_tricycle_steering_controller.cpp 100.00% <100.00%> (ø)
...ive_controller/test/test_diff_drive_controller.cpp 93.60% <80.00%> (ø)
...ollers/test/test_joint_group_effort_controller.cpp 98.43% <83.33%> (ø)
...ontroller/test/test_forward_command_controller.cpp 99.24% <83.33%> (ø)
... and 14 more

... and 56 files with indirect coverage changes

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

All good, thank you!

@bmagyar bmagyar merged commit 2674f6d into ros-controls:master Jul 16, 2024
16 of 19 checks passed
mergify bot pushed a commit that referenced this pull request Jul 16, 2024
(cherry picked from commit 2674f6d)

# Conflicts:
#	joint_trajectory_controller/test/test_trajectory_controller.cpp
#	joint_trajectory_controller/test/test_trajectory_controller_utils.hpp
mergify bot pushed a commit that referenced this pull request Jul 16, 2024
(cherry picked from commit 2674f6d)

# Conflicts:
#	joint_trajectory_controller/test/test_trajectory_controller.cpp
#	joint_trajectory_controller/test/test_trajectory_controller_utils.hpp
bmagyar pushed a commit that referenced this pull request Jul 16, 2024
bmagyar pushed a commit that referenced this pull request Jul 17, 2024
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.

4 participants