Uninformative error message when calling AddMinimumDistanceLowerBoundConstraint on InverseKinematics objec #21541
Labels
component: planning and control
Optimization-based planning and control, and search- and sampling-based planning
type: feature request
Hi all,
I ran into an uninformative error message when trying to call ' AddMinimumDistanceLowerBoundConstraint' on an InverseKinematics object. I had incorrectly constructed the IK object without passing the plant_context (like this "ik = InverseKinematics(plant)") and subsequently called "ik.AddMinimumDistanceLowerBoundConstraint(0.01, 0.1)" which throws the error:
"ValueError: Kinematic constraint: Cannot get a valid geometry::QueryObject. Either the plant's geometry query input port is not properly connected to the SceneGraph's geometry query output port, or the plant_context_ is incorrect. Please refer to AddMultibodyPlantSceneGraph on connecting MultibodyPlant to SceneGraph."
The solution in my case was simply to pass my plant_context like so "ik = InverseKinematics(plant, plant_context)" to prevent the IK constructor from creating its own. Would it be possible to add this information to this error message? E.g.
"Kinematic constraint: Cannot get a valid geometry::QueryObject. Either the plant's geometry query input port is not properly connected to the SceneGraph's geometry query output port, or the plant_context_ is incorrect. Please refer to AddMultibodyPlantSceneGraph on connecting MultibodyPlant to SceneGraph. If this error is thrown while adding a constraint to InverseKinematics, try constructing the object while passing the plant_context in the constructor: InverseKinematics(plant, plant_context) "
Thanks!
The text was updated successfully, but these errors were encountered: