Skip to content

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

Closed
wants to merge 0 commits into from

Conversation

PDKy
Copy link

@PDKy PDKy commented Aug 8, 2025

This change is Reviewable

}


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;

Choose a reason for hiding this comment

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

Recommend renaming n_lambda.

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

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.

Comment on lines 341 to 361
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);
}

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

<< ", " << 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,

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

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.

Copy link

@ebianchi ebianchi left a comment

Choose a reason for hiding this comment

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

See comments throughout.

@PDKy PDKy closed this Aug 14, 2025
@PDKy PDKy force-pushed the push_anything_dev branch from 34f0f15 to 1e4098d Compare August 14, 2025 19:17
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.

2 participants