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

Feature/ik panda #340

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Feature/ik panda #340

wants to merge 12 commits into from

Conversation

Joobz
Copy link
Collaborator

@Joobz Joobz commented Mar 7, 2022

This PR changes and adds some functions in kinematics:

  • poseGoalObjectives(): add prior to link COM poses.
  • jointAngleObjectives(): modified it so we can add any mean to the prior. Previously it was always centered at the origin.
  • jointAngleLimits(): add a jointLimitFactor only to the angles, compared to the one in joints that adds a factor to all dynamics related variables.
  • initialValues(): modified it so we can start from non-random points for arbitrary joints.
  • inverseWithPose(): IK with a given COM pose for the 7th link.

There are also some changes to Robot and Joint files that @dellaert changed because we ran into some problems.

@Joobz Joobz requested review from dellaert and gchenfc March 7, 2022 20:05
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.

Looks great! All comments are minor.

See minor comments, ignore comments about using std::map instead of gtsam::Values for joint angles, though goal_poses comment still applies.

gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
gtdynamics/universal_robot/Joint.cpp Show resolved Hide resolved
tests/testKinematicsSlice.cpp Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Show resolved Hide resolved
Copy link
Collaborator Author

@Joobz Joobz left a comment

Choose a reason for hiding this comment

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

Wow, sorry for commenting comment by comment giving you probably a lot of notifications... I just found about the reviewing the changes directly. I will know for the next time!

Also, I have done some more commits that should be addressing the comments. The most important change is the creation of PoseGoals, a container similar to the ContactGoals one., like you asked @gchenfc

@Joobz Joobz requested review from gchenfc and dellaert March 9, 2022 05:38
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.

Just the couple minor things.

Also, in the future, reply "Done" on comments you fixed/addressed so that we only have to look at comments still in question. (can you do that on the previous review comments as well?)

I think it's fine to comment on the comments instead of "starting a review".

Comment on lines +116 to +117
///< Map of time to PoseGoal
using PoseGoals = std::map<size_t, PoseGoal>;
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to have multiple pose goals for a single timestep? In which case maybe std::map<size_t, std::vector<PoseGoal>> would be more appropriate? Or if you don't need it I guess you can leave it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not in the painting case, only one pose per timestep is necessary, I think having multiple poses per timestep on a 7-DoF doesn't make much sense as we would be over constraining the problem, right?

gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/Kinematics.h Outdated Show resolved Hide resolved
gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
gtdynamics/kinematics/KinematicsSlice.cpp Outdated Show resolved Hide resolved
@Joobz Joobz requested a review from gchenfc March 9, 2022 16:47
@@ -183,7 +183,7 @@ class Kinematics : public Optimizer {
template <class CONTEXT>
gtsam::Values initialValues(
const CONTEXT& context, const Robot& robot, double gaussian_noise = 0.1,
const gtsam::Values& initial_joints = gtsam::Values()) const;
const gtsam::Values& initial_joints = gtsam::Values(), bool use_fk = false) const;
Copy link
Member

Choose a reason for hiding this comment

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

What does this flag do? Please amend doxygen above

Copy link
Member

@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.

Could not finish entire review but please take my comments (really the same comment twice) and generalize them to the rest of the PR, then re-request my review.

@@ -126,13 +126,20 @@ NonlinearFactorGraph Kinematics::poseGoalObjectives<Slice>(
const gtsam::Values& goal_poses) const {
gtsam::NonlinearFactorGraph graph;

for (const gtsam::Key& key : goal_poses.keys()) {
Copy link
Member

Choose a reason for hiding this comment

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

No, that is not how you iterate over a map in c++ :-) So

for (auto&& it : goal_poses) {
const Key& key = it->first;
const gtsam::Pose3& desired_pose = it->second;
}

/**
* @fn Create a pose prior for a given link for each given pose.
* @param context Slice or Interval instance.
* @param pose_goals goals for poses
Copy link
Member

Choose a reason for hiding this comment

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

You are still not explaining what pose_goals is. size_t can be many things, what does it mean? Does it pertain to all contexts?

/**
* @fn Factors that minimize joint angles.
* @param context Slice or Interval instance.
* @param robot Robot specification from URDF/SDF.
* @param joint_priors Values where the mean of the priors is specified. The
Copy link
Member

Choose a reason for hiding this comment

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

Same comment. You use Values. Does that mean in your case you specify different priors for every time step? Or, is it simply robot-specific in which case aa std::map with joint indices would be the right thing. I already commented on this but not getting ansers. And, answers should end up in the documentation...

@varunagrawal
Copy link
Collaborator

@Joobz please finish up this PR before you head out, else it will stay in review purgatory. :)

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.

4 participants