-
Notifications
You must be signed in to change notification settings - Fork 21
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
Issue 233-outside goal tolerance #241
Issue 233-outside goal tolerance #241
Conversation
@yai-rosejo: I've used your PR as a basis and restructured it a little. See this for the diff. All WIP right now. It's basically the same as your changes, but split into a couple of functions. My idea is we'd be able to write some tests for the new functionality this way. I've tested it on my YRC with GP25 and it (still) works. High-level question: did you intentionally iterate over the |
I just did a cursory look through your solution; I think it looks much better than my current one. motoros2/src/ActionServer_FJT.c Lines 498 to 504 in daa47bd
|
Ok. Thanks. I'll add some tests, and then push some commits to this PR if that would be OK with you. |
That works for me! |
Added some first batch of tests for Click to expand
|
@yai-rosejo: I've added tests for the two new functions I introduced, refactored things a bit and cleaned up the Git history. See the diff. Your changes are now all squashed into the initial commit. Could you take a look whether this would work for you? If you agree, I'll force-push these changes to your branch to update this PR. |
@yai-rosejo wrote:
@ted-miller: would it be absolutely necessary to iterate over |
Limiting the loops would be OK. I can't think of any justification for keeps maxaxes. |
The changes look good to me. You can go ahead with the force push. |
Working on this a bit more and I'm beginning to wonder whether we shouldn't already parse the If we fail to parse at the end of an executed trajectory, we can't really do much anymore: failing the goal completely seems like a bit of a 'waste' of a good trajectory execution and failing so late for something almost 'unrelated' doesn't apply fail-early and least-surprise principles. |
So you're suggesting separating the logic of validating the tolerance input from validating the position is within that tolerance? That makes sense to me. We've got the My next question is how much of the goal message do we validate? So far, we've been ignoring much of the goal message, such as |
Indeed.
True, although the
I would for now indeed suggest to fix & refactor the current implementation which only takes the |
Coming back to this: unknown joints in Adding goal validation -- which would include I'll create an issue to log the enhancement request. @yai-rosejo: I've pushed some more commits to my version of your branch. If you could PTAL and let me know whether you'd still be ok with me force-pushing here? Thanks. |
I have taken a look and agree with pushing those onto this branch. This PR is focused on supporting goal functionalities, so I also agree that the goal validation should be a separate task. |
638063b
to
64c6524
Compare
Don't assume all joints have associated tolerances, and deal with potentially out-of-order tolerance specifications (compared to order of joints MotoROS2 uses internally).
Easier to test and potentially to reuse.
Not just when there are no JointTolerance instances.
Note: they are appended to the main ActionServer_FJT source file as the function(s) tested are local to that compilation unit (ie: static).
They're not needed outside this compilation unit.
Need space for at least the number of joint positions in the trajectory point.
Instead of the maximum possible number always.
Work-around doesn't seem needed anymore.
A debug log warning only right now. We could consider making it a fatal error and actually return it.
This is a temporary implementation, as it would be better to check the goal_tolerance field can be parsed when validating a new goal.
64c6524
to
c552d58
Compare
@yai-rosejo and/or @ted-miller: could I perhaps ask you to test this implementation on your hw? |
Definitely. I can't do it today (and probably not tomorrow), but I'll get it done. I realize this PR has lingered for quite a while now. |
} | ||
|
||
//it's OK if we are passed more JointTolerance instances than we have joints, | ||
//as technically a client could send duplicate tolerance specs (ie: multiple |
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.
Is this common practice? It seems to me that this is a bad idea. If I accidently duplicate a joint, then I would be very confused when my intended tolerance isn't applied.
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.
not common practice per se. I just didn't feel like making it an issue.
We could upgrade it to one though, and return a specific error code if duplicated joint names are passed as part of the goal.
//couldn't find joint | ||
if (ptol_idx == joint_names->size) | ||
{ | ||
//TODO(gavanderhoorn): make this a fatal error? |
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.
I assume (hope) that you mean fatal to the trajectory request (return not OK) and not a fatal assertion.
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.
Yes, even more 'local' perhaps: fatal as in: exit this function with an appropriate return code.
Functionally, everything seems to be working well on hardware. |
Co-authored-by: Ted Miller <ted.miller@motoman.com>
Co-authored-by: Ted Miller <ted.miller@motoman.com>
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.
I'm fine with merging this.
This PR is to solve multiple issues dealing with goal tolerances referenced in #233
This PR does not fix the issues with the Ros_Debug_BroadcastMsg function and doubles.
Testing:
tolerance_issue_04162024.zip
sudo docker run -it --net=host -v /dev:/dev --privileged microros/micro-ros-agent:humble udp4 -p 8888
ros2 service call /start_traj_mode motoros2_interfaces/srv/StartTrajMode
python3 fjt_client.py