本文整理匯總了Python中pydrake.multibody.plant.MultibodyPlant.get_generalized_contact_forces_output_port方法的典型用法代碼示例。如果您正苦於以下問題:Python MultibodyPlant.get_generalized_contact_forces_output_port方法的具體用法?Python MultibodyPlant.get_generalized_contact_forces_output_port怎麽用?Python MultibodyPlant.get_generalized_contact_forces_output_port使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pydrake.multibody.plant.MultibodyPlant
的用法示例。
在下文中一共展示了MultibodyPlant.get_generalized_contact_forces_output_port方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_model_instance_port_access
# 需要導入模塊: from pydrake.multibody.plant import MultibodyPlant [as 別名]
# 或者: from pydrake.multibody.plant.MultibodyPlant import get_generalized_contact_forces_output_port [as 別名]
def test_model_instance_port_access(self):
# Create a MultibodyPlant with a kuka arm and a schunk gripper.
# the arm is welded to the world, the gripper is welded to the
# arm's end effector.
wsg50_sdf_path = FindResourceOrThrow(
"drake/manipulation/models/" +
"wsg_50_description/sdf/schunk_wsg_50.sdf")
iiwa_sdf_path = FindResourceOrThrow(
"drake/manipulation/models/" +
"iiwa_description/sdf/iiwa14_no_collision.sdf")
plant = MultibodyPlant(time_step=2e-3)
parser = Parser(plant)
iiwa_model = parser.AddModelFromFile(
file_name=iiwa_sdf_path, model_name='robot')
gripper_model = parser.AddModelFromFile(
file_name=wsg50_sdf_path, model_name='gripper')
plant.Finalize()
# Test that we can get an actuation input port and a continuous state
# output port.
self.assertIsInstance(
plant.get_actuation_input_port(iiwa_model), InputPort)
self.assertIsInstance(
plant.get_state_output_port(gripper_model), OutputPort)
self.assertIsInstance(
plant.get_generalized_contact_forces_output_port(
model_instance=gripper_model),
OutputPort)