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

WIP: Refactor trajectory #278

Merged
merged 31 commits into from
Nov 1, 2021
Merged

WIP: Refactor trajectory #278

merged 31 commits into from
Nov 1, 2021

Conversation

dellaert
Copy link
Member

This branch is currently prototype code Frank and @danbarla made together to resolve #257
PR comment should be updated as we go.

Copy link
Member Author

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

Dan, I think this going exactly in the right direction !!!

phases_.insert(phases_.end(), phases_i.begin(), phases_i.end());
}

for (auto&& phase : phases_) {
Copy link
Member Author

Choose a reason for hiding this comment

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

document. But, also, should it be only done for walk_cycle.phases() ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

contact_points_ was a member of WalkCycle and I moved it to trajectory because we took out walk_cycle_ as a member from Trajectory (also did this for other members functions from WalkCycle).
To build the contact_points_ vector now I Take from each phase in the trajectory the unique contact points and add them them to contact_points_. Is there a reason to do this only for the walk_cycle.phases()? These contact_points_ should be unique (that's what was done in WalkCycle as well).

throw std::runtime_error("Contact Point was not found.");
}

NonlinearFactorGraph FootContactState::contactPointObjectives(
Copy link
Member Author

Choose a reason for hiding this comment

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

I think we might want to put this in KinematicsPhase instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am a bit confused by this. We have a pointGoalObjectives method under KinematicsPhase (which calls a similar method in KinematicsInterval). Both FootContactState::contactPointObjectives and KInematicsPhase::pointGoalObjectives push pointGoalFactors to the factor graph (differently). I am not sure what is the difference and when each of them is used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Something to chat about; maybe prepare one slide for meeting on refactored structure?

@danbarla danbarla marked this pull request as ready for review October 4, 2021 13:57
@danbarla
Copy link
Collaborator

danbarla commented Oct 4, 2021

@dellaert ready for review

@danbarla danbarla self-requested a review October 14, 2021 17:47
Copy link
Member Author

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

OK, this is getting very close. Biggest issue is the Phase methods that I don't think should exists as Interval already implements them, and you should be able to call those with a Phase (as it is an interval).

Also, phase should be, like trajectory, generic. Added comments below.

@gchenfc gchenfc mentioned this pull request Oct 27, 2021
@dellaert
Copy link
Member Author

@danbarla pls re-request review when you want me to take another look.

Copy link
Member Author

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

Done !!! I did not see you merge in master, so please do that before merging this PR. Also, there is one issue with static_cast you have to fix, but other than that, done!

Since I am the author of the original PR, I can't actually approve. I'll ask Gerry to do a final review and approve.

@dellaert dellaert requested a review from gchenfc October 28, 2021 12:26
@dellaert
Copy link
Member Author

@gchenfc could you do a final (loose, more FYI) review and approve?

boost::dynamic_pointer_cast<const FootContactConstraintSpec>(
constraint_spec);
if (!foot_contact_spec) {
throw std::runtime_error(
Copy link
Member Author

Choose a reason for hiding this comment

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

You should not throw an error, though: just ignore specs that are not footholds. Some other class we build later might take care of other constraints, like orientation etc…

Copy link
Collaborator

Choose a reason for hiding this comment

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

removed the error throw and added checks in all functions that cast.
done.

Copy link
Member

@gchenfc gchenfc left a comment

Choose a reason for hiding this comment

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

Cool

My interpretation of the main changes:

  • Lots of functionality from Trajectory moved to WalkCycle
  • Phase refactored to inherit from Interval, and lots of functionality moved into FootContactConstraintSpec

And then all the necessary adjustments to support those changes.

Correct me if I'm wrong!

Comment on lines 26 to +30
* @class Phase class stores information about a robot stance
* and its duration.
*/
using ContactPointGoals = std::map<std::string, gtsam::Point3>;

class Phase {
public:
class Phase : public Interval {
Copy link
Member

Choose a reason for hiding this comment

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

This confuses me a little bit

So Interval is purely a time-specification, while Phase adds robot constraint/stance information? In that case it doesn't feel like Phase is a type of Interval but rather some motion description that includes an Interval?

@dellaert
Copy link
Member Author

So close :-) what’s the clang issue?

@danbarla
Copy link
Collaborator

3 tests are failing, getting the gtsam "Indeterminant linear system exception". Weird.

@dellaert dellaert merged commit e49222e into master Nov 1, 2021
@dellaert dellaert deleted the feature/refactor_trajectory branch November 1, 2021 19:23
@dellaert
Copy link
Member Author

dellaert commented Nov 1, 2021

Merged, bravo!

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.

Refactor Phase/WalkCycle/Trajectory
3 participants