drake - 如何在 MultibodyPlant 中设置特定实体的摩擦属性(或任何 GeometryProperties)?
问题描述
我想知道如何设置物体的摩擦属性MultibodyPlant
。
更具体地说,我有一个从 SDF 读取的模型实例,我想在该模型实例中添加或更改特定物体的摩擦属性。
解决方案
有几种方法可以设置摩擦属性。除了您非常具体的问题之外,我还将概述多个工作流程。(作为旁注,虽然其中一些已记录在案,但不一定可以在 doxygen 中发现 - 甚至渲染 - 这是一个需要解决的突出问题,存在问题)。
- 在 urdf/sdf 中定义。
- Drake 为标签提供了与接触属性(包括摩擦等)相关的自定义
<geometry>
标签。URDF/SDF 中的标签相同,但使用方式略有不同(基于 SDF 与 URDF 的风格)。可以在此处找到 sdf 的详细信息, 在此处找到 urdf 的详细信息。
- Drake 为标签提供了与接触属性(包括摩擦等)相关的自定义
- 通过 API 添加新几何并在定义中包含摩擦。
- MultibodyPlant 有一个用于将几何体分配给身体的 API。有多种变体:
- 将几何图形添加到实体并显式定义摩擦
- 这是一个遗留的糖 API。偏爱
ProximityProperties
作为首选 API 的 API。
- 这是一个遗留的糖 API。偏爱
- 一般定义 ProximityProperties
- 在这种情况下,唯一的问题是,我的邻近属性来自哪里?
- 将几何图形添加到实体并显式定义摩擦
#include "drake/geometry/proximity_properties.h" #include "drake/multibody/plant/multibody_plant.h" // Omitting drake:: namespaces for clarity. MultibodyPlant<double> plant; // Populate plant with bodies. ProximityProperties contact_props; AddContactMaterial({}, {}, CoulombFriction<double>(mu_s, mu_d), &contact_props); // Assume we've defined body, X_BG, shape, and name elsewhere. plant.RegisterCollisionGeometry(body, X_BG, shape, name, contact_props);
- MultibodyPlant 有一个用于将几何体分配给身体的 API。有多种变体:
- 添加/更新到 urdf/sdf 中定义的几何图形
- 在这种情况下,我们需要
SceneGraph
根据它与实体的关联来更改几何定义。这意味着,从 开始Body
,我们需要得到GeometryId
. 我们将假设已经完成并且您拥有GeometryId
此工作流程。
SceneGraph<double> sg; const GeometryId g_id = ...; CoulombFriction<double> friction(mu_s, mu_d); ProximityProperties new_props; const ProximityProperties* curr_props = sg.model_inspector().GetProximityProperties(g_id); if (curr_props != nullptr) { new_props = *curr_props; } // Replaces old friction definition, or adds it if previously absent. new_props.UpdateProperty("material", "coulomb_friction", friction); sg.AssignRole(g_id, new_props, RoleAssign::kReplace);
- 在这种情况下,我们需要
推荐阅读
- java - 一旦子线程完成执行,它会继续执行主线程行吗?
- python - discord.py:如何获取用户名的首字母?
- php - Laravel Distinct 查询在我的项目中不起作用
- django - 从 axios 到 Django Rest Server 的 POST 信号错误处理
- php - PHP:PSR-15 Outbound Middlewares,通过中间件修改响应?
- deeplearning4j - DL4J:输入大小错误 - 预期矩阵
- python - Twitter 的 Tweet_ID 在 Twitter 平台上是唯一的吗?
- android - 如何在 android studio 中对齐语句?
- google-search-console - Google Search Console 站点地图错误 URL 无效
- webrtc - 如何使用 Kurento 媒体服务器实现屏幕共享选项 WebRTC