-
Notifications
You must be signed in to change notification settings - Fork 33
add feature for changing force between obj-obj obj-wall to planar #393
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
Conversation
solvers/lcs_factory.cc
Outdated
} | ||
|
||
|
||
int num_direction_contacts = with_z_lambda? 2 * n_contacts * num_friction_directions : 2*num_friction_directions*(n_contacts - num_planar_contacts) + 2 * 1 * num_planar_contacts; |
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.
Recommend renaming n_lambda
.
solvers/lcs_factory.cc
Outdated
multibody::GeomGeomCollider collider(plant, contact_geoms[i]); | ||
auto [phi_i, J_i] = collider.EvalPolytope(context, num_friction_directions); | ||
auto [p_WCa, p_WCb] = collider.CalcWitnessPoints(context); | ||
// TODO(yangwill): think about if we want to push back both witness points |
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.
If this is still relevant, leave it in.
solvers/lcs_factory.cc
Outdated
if (num_direction_contacts_vector[i] == 1) { | ||
Eigen::Vector3d planar_normal; | ||
planar_normal << 0, 0, 1; | ||
auto [phi_i, J_i] = collider.EvalPlanar(context, planar_normal); | ||
auto [p_WCa, p_WCb] = collider.CalcWitnessPoints(context); | ||
contact_points.push_back(p_WCa); | ||
phi(i) = phi_i; | ||
J_n.row(i) = J_i.row(0); | ||
J_t.block(2 * std::accumulate(num_direction_contacts_vector.begin(),num_direction_contacts_vector.begin()+i,0), 0, 2 * num_direction_contacts_vector[i], | ||
n_v) = J_i.block(1, 0, 2 * num_direction_contacts_vector[i], n_v); | ||
|
||
} else { | ||
auto [phi_i, J_i] = | ||
collider.EvalPolytope(context, num_direction_contacts_vector[i]); | ||
auto [p_WCa, p_WCb] = collider.CalcWitnessPoints(context); | ||
contact_points.push_back(p_WCa); | ||
phi(i) = phi_i; | ||
J_n.row(i) = J_i.row(0); | ||
J_t.block(2 * std::accumulate(num_direction_contacts_vector.begin(),num_direction_contacts_vector.begin()+i,0), 0, 2 * num_direction_contacts_vector[i], | ||
n_v) = J_i.block(1, 0, 2 * num_direction_contacts_vector[i], n_v); | ||
} |
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.
The only difference between the if
and else
is which normal to use. Suggest structure like:
if (num_direciton_contacts_vector[i] == 1) { // Do EvalPlanar }
else { // Do EvalPolytope }
// Then after the if/else do all the other commands, starting with collider.CalcWitnessPoints
solvers/lcs_factory.cc
Outdated
<< ", " << inspector.GetName(pair.second()) | ||
<< ") with phi = " << phi_i << " between world points [" | ||
<< p_world_contact_a.transpose() << "], [" | ||
<< p_world_contact_b.transpose() << "]" << std::endl; | ||
} | ||
|
||
bool LCSFactory::IsObjToObjContact(const drake::multibody::MultibodyPlant<double>& plant, |
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.
Flagging here that our in-person discussion considered making this more general purpose than detecting obj-obj filenames and instead defining a new vector that can label obj-obj interactions as "planar" (and same with obj-wall, and label e.g. ee-obj interactions as not planar, etc.).
@@ -14,6 +14,8 @@ publish_frequency: 0 | |||
penalize_changes_in_u_across_solves: false # Penalize (u-u_prev) instead of u. | |||
num_friction_directions: 2 | |||
|
|||
with_z_lambda: true |
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.
Suggest removing this parameter and instead define one like contact_pair_types_are_planar = [false, false, false, true, true]
which would mean EE-ground, EE-obj, and obj-ground pairs are 3D and obj-obj and obj-wall pairs are planar.
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.
See comments throughout.
34f0f15
to
1e4098d
Compare
This change is