-
Notifications
You must be signed in to change notification settings - Fork 580
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 Servo JointJog Crash #3351
base: main
Are you sure you want to change the base?
Fix Servo JointJog Crash #3351
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this!
I think by putting all these checks at the ROS node level, it may be making servo even harder to test than it already is.
If I may offer a suggestion, a few lines down where you modified things there is a line that actually creates a JointJogCommand
struct:
JointJogCommand command{ latest_joint_jog_.joint_names, latest_joint_jog_.velocities };
As you have correctly noticed, this is just a plain struct and has no validation on the joint name vs. velocity inputs. I think what would make this stuff much more sustainable to test would be to create either free functions that convert directly from the ROS JointJog
message to the servo specific JointJogCommand
type, or otherwise make non-default constructors for these structs.
If we go the free functions route, these can have their own validation / failure handling with things like std::optional
or tl::expected
.
If you'd be up for giving this a try, it would definitely help to take some of the logic in the servo_node.cpp
and encapsulate it a little better.
But I'll defer to you on how far you want to go here vs. just fix a bug and move on :)
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #3351 +/- ##
==========================================
+ Coverage 45.85% 45.91% +0.06%
==========================================
Files 717 717
Lines 62572 62579 +7
Branches 7564 7566 +2
==========================================
+ Hits 28689 28724 +35
+ Misses 33717 33688 -29
- Partials 166 167 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@sea-bass what do you think of this approach? Instead of adding extra functions on the struct initialization, I moved the check to the section where velocities are actually processed in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely is better! Still 2 comments though
- I think the amount of conditionals/nesting can still be simplified significantly
- I'm a bit worried about relying on a subscription to the
/rosout
topic for tests to pass, and may lead to (even more) flaky tests. Have you tried to use thestress
command to stress your system and run this new test repeatedly?
I tried running with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- thanks! Just one last comment from me.
Now that I see this all again, would it make sense to put the warning about displacements not being supported in jointDeltaFromJointJog()
instead of in the ROS node itself?
The |
You were right, CI is failing on the /rosout log check. Maybe I should add a longer delay before that check? Or is there something else unusual about the environment? So far I have only tested on Raspberry Pi 5 in Jazzy Docker. |
Hah, never underestimate how crappy CI runners can be. Honestly, if it were up to me I'd just verify the value of the status coming out of the function and not worry about the logs. Also, understood re: the displacement warning. 👍🏻 |
@sea-bass ready to merge? |
Sorry, I thought I had asked other active maintainers for a 2nd approval. Tagged a few. |
Description
Currently the realtime servo node crashes if a JointJog message is received without velocity commands. I added a check for this condition and a warning if the message contains displacement commands.
Checklist