我试图创建一个定制的ForceElement
,如下所示
class FrontWheelForce(ForceElement):
def __init__(self, plant):
front_wheel = plant.GetBodyByName("front_wheel")
front_wheel_node_index = front_wheel.index()
pdb.set_trace()
ForceElement.__init__(self, front_wheel.model_instance())
但是在ForceElement.__init__(self, front_wheel.model_instance())
行上得到以下错误
TypeError: FrontWheelForce: No constructor defined!
请看文档here中的
ForceElement
;“ForceElement允许在多体树模型中建模状态和时间相关的力”。也就是说,作为车轮扭矩函数的力元素不能建模为ForceElement
。我相信你想要的是一个FrontWheelSystem
,作为一个LeafSystem
,输出你想要建模的力。您可以通过任一执行器将模型的外力施加到设备上 连接到get_actuation_input_port()
,或作为外部施加的空间力连接到get_applied_spatial_force_input_port()
。你知道吗你没有给我们看父母的定义。你知道吗
我有点惊讶你没有看到这个诊断:
我想你使用的框架会引发“无构造函数” 提醒您还有一些代码要实现 在使用父类之前。你知道吗
把一些评论归纳成正确的答案
作者:ekhumoro
作者:Eric Cousineau
参考号: pybind11 docs,^{}binding
相关问题 更多 >
编程相关推荐