当前位置: 首页>>代码示例>>Python>>正文


Python MultibodyPlant.get_generalized_contact_forces_output_port方法代码示例

本文整理汇总了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)
开发者ID:RobotLocomotion,项目名称:drake,代码行数:31,代码来源:plant_test.py


注:本文中的pydrake.multibody.plant.MultibodyPlant.get_generalized_contact_forces_output_port方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。