Skip to content

Commit ac60bd1

Browse files
committed
std::pair ref not exposed
1 parent d84c65b commit ac60bd1

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

bindings/python/src/modelling/expose-cost-stack.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include "aligator/modelling/costs/sum-of-costs.hpp"
55

6-
#include <eigenpy/std-map.hpp>
76
#include <eigenpy/std-pair.hpp>
7+
#include <eigenpy/variant.hpp>
88

99
namespace aligator {
1010
namespace python {
@@ -21,6 +21,7 @@ void exposeCostStack() {
2121
using CostItem = CostStack::CostItem;
2222
using CostMap = CostStack::CostMap;
2323
eigenpy::StdPairConverter<CostItem>::registration();
24+
eigenpy::VariantConverter<CostKey>::registration();
2425

2526
bp::class_<CostStack, bp::bases<CostAbstract>>(
2627
"CostStack", "A weighted sum of other cost functions.", bp::no_init)
@@ -33,15 +34,18 @@ void exposeCostStack() {
3334
// "Components of this cost stack.")
3435
.def(
3536
"addCost",
36-
+[](CostStack &self, const PolyCost &cost, const Scalar weight)
37-
-> CostItem & { return self.addCost(cost, weight); },
37+
+[](CostStack &self, const PolyCost &cost, const Scalar weight) {
38+
// return
39+
self.addCost(cost, weight);
40+
},
3841
("self"_a, "cost", "weight"_a = 1.),
3942
bp::return_internal_reference<>())
4043
.def(
4144
"addCost",
4245
+[](CostStack &self, CostKey key, const PolyCost &cost,
43-
const Scalar weight) -> CostItem & {
44-
return self.addCost(key, cost, weight);
46+
const Scalar weight) {
47+
// return
48+
self.addCost(key, cost, weight);
4549
},
4650
("self"_a, "key", "cost", "weight"_a = 1.),
4751
bp::return_internal_reference<>())

0 commit comments

Comments
 (0)