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

ConcreteRobot uses ranker for PlantoTSR #503

Merged
merged 14 commits into from
Feb 16, 2019
Merged

ConcreteRobot uses ranker for PlantoTSR #503

merged 14 commits into from
Feb 16, 2019

Conversation

gilwoolee
Copy link
Contributor

@gilwoolee gilwoolee commented Feb 8, 2019

This PR updates ConcreteRobot class to use ConfigurationRanker when calling planToTSR. It changes the planToTSR logic a little bit accordingly.


Before creating a pull request

  • Document new methods and classes
  • Format code with make format

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@fe6ba16). Click here to learn what that means.
The diff coverage is 0%.

@@            Coverage Diff            @@
##             master     #503   +/-   ##
=========================================
  Coverage          ?   77.66%           
=========================================
  Files             ?      262           
  Lines             ?     6784           
  Branches          ?        0           
=========================================
  Hits              ?     5269           
  Misses            ?     1515           
  Partials          ?        0
Impacted Files Coverage Δ
src/distance/ConfigurationRanker.cpp 100% <ø> (ø)
src/planner/dart/ConfigurationToTSRPlanner.cpp 100% <ø> (ø)
...ude/aikido/distance/NominalConfigurationRanker.hpp 100% <ø> (ø)
.../aikido/planner/dart/ConfigurationToTSRPlanner.hpp 100% <ø> (ø)
include/aikido/distance/ConfigurationRanker.hpp 100% <ø> (ø)
...igurationToConfiguration_to_ConfigurationToTSR.hpp 100% <ø> (ø)
...igurationToConfiguration_to_ConfigurationToTSR.cpp 6% <0%> (ø)

Copy link
Contributor

@aditya-vk aditya-vk left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! We should also probably update the new planner API: ConfigurationToTSR and ConfigurationToConfiguration_to_ConfigurationToTSR to have a ranker?

include/aikido/robot/util.hpp Outdated Show resolved Hide resolved
include/aikido/robot/ConcreteRobot.hpp Outdated Show resolved Hide resolved
include/aikido/robot/util.hpp Outdated Show resolved Hide resolved
include/aikido/robot/ConcreteRobot.hpp Outdated Show resolved Hide resolved
aditya-vk and others added 3 commits February 12, 2019 11:09
Co-Authored-By: gilwoolee <gilwoo301@gmail.com>
Co-Authored-By: gilwoolee <gilwoo301@gmail.com>
@gilwoolee
Copy link
Contributor Author

Thanks for the PR! We should also probably update the new planner API: ConfigurationToTSR and ConfigurationToConfiguration_to_ConfigurationToTSR to have a ranker?

They already are. Ranker is one of the constructor arguments in ConfigurationToConfigurationPlanner and ConfigurationToConfiguration_to_ConfigurationToTSR as this is a property of the planner not the problem. I changed them to ConstConfigurationRanker as well.

brianhou
brianhou previously approved these changes Feb 14, 2019
Copy link
Contributor

@brianhou brianhou left a comment

Choose a reason for hiding this comment

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

Looks mostly good! Just a couple minor questions.

src/robot/util.cpp Outdated Show resolved Hide resolved
src/robot/util.cpp Outdated Show resolved Hide resolved
aditya-vk
aditya-vk previously approved these changes Feb 14, 2019
Copy link
Contributor

@aditya-vk aditya-vk left a comment

Choose a reason for hiding this comment

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

Looks great!

Co-Authored-By: gilwoolee <gilwoo301@gmail.com>
@gilwoolee gilwoolee dismissed stale reviews from aditya-vk and brianhou via 6f830bc February 14, 2019 05:30
Copy link
Contributor

@brianhou brianhou left a comment

Choose a reason for hiding this comment

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

Actually, I think we should update the dart::ConfigurationToConfiguration_to_ConfigurationToTSR adapter to use the ranker? Also, we need to update the changelog.

@gilwoolee
Copy link
Contributor Author

Actually, I think we should update the dart::ConfigurationToConfiguration_to_ConfigurationToTSR adapter to use the ranker? Also, we need to update the changelog.

@brianhou it was already using a ranker. I just changed it to use the Const version.

@gilwoolee gilwoolee added this to the Aikido 0.3.0 milestone Feb 14, 2019
@brianhou
Copy link
Contributor

I don't think the plan method actually uses the ranker anywhere, though?

CHANGELOG.md Outdated Show resolved Hide resolved
Co-Authored-By: gilwoolee <gilwoo301@gmail.com>
@gilwoolee
Copy link
Contributor Author

I don't think the plan method actually uses the ranker anywhere, though?

aikido/src/planner/dart/ConfigurationToConfiguration_to_ConfigurationToTSR.cpp

Line 88 in 41032c7

while (generator->canSample())

lol!!! haha since I didn't make that change in this PR I didn't check... Let me fix that :P

…tionRanker's rank method const, address PR comments
@gilwoolee
Copy link
Contributor Author

@brianhou @aditya-vk please take another look!

std::vector<MetaSkeletonStateSpace::ScopedState> configurations;

// Use a ranker
ConstConfigurationRankerPtr configurationRanker(mConfigurationRanker);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to create another pointer here? Can we not do:

if (!mConfigurationRanker)
{
    mConfigurationRanker = NominalConfigurationRanker;
}

In robot/utils/planToTSR, the ranker has been taken with a const pointer so I guess that's fine there. Alternatively, we can leave this like this and change the data member to const since we are initializing it in the constructor anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Summarizing my slack discussion with @aditya-vk , I think we should keep it as is, for the following reasons:

  1. if the planner is created with mConfigurationRanker = nullptr, the expectation is that a NominalConfigurationRanker would be created when this method is called and be initialized with the startState. So if we change the member variable as you suggested, the planner now has been mutated and it cannot be reused in the same way. Next time it is called, it'd use this ranker.
  2. To fix, the ideal solution would be the second way you suggested, to have it as const mConfigurationRanker so that it never gets changed. Unfortunately, to my best understanding, because this class becomes a TSRPlanner via the templated adapter, it does not have access to mConfigurationRanker during the initialization, i.e. I can't do : mConfigurationRanker(std::move(ranker)) { ... } . It only has access to the constructor parameters of the PlannerAdapter, which is the stateSpace and metaSkeleton. See stackoverflow .

Hence, in order to keep the member variable as-is (as if it's a const) and initialize it in constructor if it's passed in, I think we need to keep it the way I have it now.

@aditya-vk @brianhou please confirm!

Copy link
Contributor

Choose a reason for hiding this comment

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

That's right, there's no way to have it in the initialization list. Hmm.
I think what we have now is good then. Since we don't give an option to change the ranker at all unless a new planner is created, I think it should be fine 👍

aditya-vk
aditya-vk previously approved these changes Feb 15, 2019
Copy link
Contributor

@aditya-vk aditya-vk left a comment

Choose a reason for hiding this comment

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

Left a nit comment, otherwise good to go! Travis seems to be complaining about formatting.

Copy link
Contributor

@aditya-vk aditya-vk left a comment

Choose a reason for hiding this comment

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

LGTM!

@gilwoolee gilwoolee merged commit dd47dde into master Feb 16, 2019
@gilwoolee gilwoolee deleted the robot_uses_ranker branch February 16, 2019 23:22
@gilwoolee gilwoolee mentioned this pull request Feb 17, 2019
5 tasks
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.

3 participants