いくつかの三角関数を含む軌道最適化問題を解決するために、直接転写を使用しようとしています。
次の変数タイプがあります
a[i] = array([<Expression "(state_0(0) + 0.001 * state_0(4))">,
<Expression "(state_0(1) + 0.001 * state_0(5))">,
<Expression "(state_0(2) + 0.001 * state_0(6))">,
<Expression "(state_0(3) + 0.001 * state_0(7))">,
<Expression "...omitted...">,
<Expression "...omitted...">,
<Expression "...omitted...">,
<Expression "...omitted...">], dtype=object)
b[i] = array([Variable('state_1(0)', Continuous),
Variable('state_1(1)', Continuous),
Variable('state_1(2)', Continuous),
Variable('state_1(3)', Continuous),
Variable('state_1(4)', Continuous),
Variable('state_1(5)', Continuous),
Variable('state_1(6)', Continuous),
Variable('state_1(7)', Continuous)], dtype=object)
次のように制約を作成しようとしています
mp.AddConstraint(b[i] <= a[i])
しかし、次のエラーが表示されます
RuntimeError: You should not call `__bool__` / `__nonzero__` on `Formula`. If you are trying to make a map with `Variable`, `Expression`, or `Polynomial` as keys (and then access the map in Python), please use pydrake.common.containers.EqualToDict`.