Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support continuous (unbounded) joints properly #59

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

sea-bass
Copy link
Collaborator

@sea-bass sea-bass commented Sep 29, 2023

This PR correctly handles how to deal with continuous joints by ensuring that none of the RSL samples use the full floating-point span. Also did some slight cleanup along the way.

The key here is that, if a joint is continuous, our sampling now is casting a "spread" of +/- pi radians around the current state. That way the sampling is somewhat limited.

Closes #57

@sea-bass sea-bass self-assigned this Sep 29, 2023
@sea-bass
Copy link
Collaborator Author

sea-bass commented Sep 29, 2023

Tested with the Kinova Gen3 and found another bug with the joint value clamping + fixed it. Now it should be good!

2023-09-29.10-29-28.mp4

Copy link
Contributor

@eholum eholum left a comment

Choose a reason for hiding this comment

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

Very cool! I don't have a lot of background here but I also pulled this up with the gen3 config and it seems to do the job! Just adding food for thought with my comments, I don't have strong opinions on any of these.

include/pick_ik/robot.hpp Outdated Show resolved Hide resolved
src/robot.cpp Outdated
var.span = var.max - var.min;

if (!(var.span >= 0 && var.span < std::numeric_limits<double>::max())) var.span = 1;
var.span = var.bounded ? var.max - var.min : kUnboundedVariableSpan;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should var.span just be a function?

Copy link
Collaborator Author

@sea-bass sea-bass Nov 10, 2023

Choose a reason for hiding this comment

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

I think we want this to be a variable so it doesn't have to be needlessly recalculated multiple times... but with your next comment, I like the idea of providing abstractions to clip variables to limits / generate random values, and then no other code besides these functions would touch the span member variable.

src/robot.cpp Outdated Show resolved Hide resolved
@sea-bass
Copy link
Collaborator Author

Thanks @eholum -- I made some member functions in the Variable struct to help abstract this away.

In doing so, I also:

  • Found a small bug in the memetic implementation that wasn't actually initializing fitness values and consequently setting a bunch of nans.
  • Got rid of a bunch of redundant floating-point calculations which should make the algorithm marginally faster.

@sea-bass sea-bass requested a review from eholum November 13, 2023 14:53
Copy link
Contributor

@eholum eholum left a comment

Choose a reason for hiding this comment

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

I had the wrong endpoint frame configured but tested and I get good performance from servo with the Gen3.

Screen.Recording.2023-11-15.at.10.10.30.AM.mov

@sea-bass sea-bass merged commit 3cf3437 into main Nov 15, 2023
4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the support-continuous-joints branch November 15, 2023 15:26
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Continuous joints not supported (silently)
2 participants