Unverified Commit 02386959 authored by Carlos Mastalli's avatar Carlos Mastalli Committed by GitHub
Browse files

Merge pull request #1016 from spykspeigel/devel

[state] added a setter  and fixed a bug in JIntegrateTransport
parents 919ee974 cc73406a
Pipeline #17324 passed with stage
in 68 minutes and 46 seconds
// BSD 3-Clause License
// Copyright (C) 2019-2020, LAAS-CNRS, University of Edinburgh
// Copyright (C) 2019-2022, LAAS-CNRS, University of Edinburgh
// Copyright note valid unless otherwise stated in individual files.
// All rights reserved.
......@@ -53,11 +53,11 @@ void exposeStateAbstract() {
":param x0: previous state point (dim state.nx).\n"
":param x1: current state point (dim state.nx).\n"
":return x1 [-] x0 value (dim state.ndx).")
.def("integrate", pure_virtual(&StateAbstract_wrap::integrate), bp::args("self", "x", "dx"),
.def("integrate", pure_virtual(&StateAbstract_wrap::integrate_wrap), bp::args("self", "x", "dx"),
"Compute the state manifold integration.\n\n"
"It returns the value of x [+] dx operation. x and dx are points in the state.diff(x0,x1) (in M)\n"
"and its tangent, respectively. Note that the operator result lies on M too.\n"
":param x: state point (dim. state.nx) (dim state.nx).\n"
":param x: state point (dim. state.nx).\n"
":param dx: velocity vector (dim state.ndx).\n"
":return x [+] dx value (dim state.nx).")
.def("Jdiff", pure_virtual(&StateAbstract_wrap::Jdiff_wrap), bp::args("self", "x0", "x1", "firstsecond"),
......@@ -80,7 +80,7 @@ void exposeStateAbstract() {
"\\partial{integrate(x, dx)}{dx}. By default, this function returns the derivatives of\n"
"the first and second argument (i.e. firstsecond='both').\n"
"partial derivative by setting firstsecond='first' or firstsecond='second'.\n"
":param x: state point (dim. state.nx) (dim state.nx).\n"
":param x: state point (dim. state.nx).\n"
":param dx: velocity vector (dim state.ndx).\n"
":param firstsecond: derivative w.r.t x or dx or both\n"
":return the partial derivative(s) of the integrate(x, dx) function")
......@@ -89,15 +89,21 @@ void exposeStateAbstract() {
"Parallel transport from integrate(x, dx) to x.\n\n"
"This function performs the parallel transportation of an input matrix whose columns\n"
"are expressed in the tangent space at integrate(x, dx) to the tangent space at x point\n"
":param x: state point (dim. state.nx) (dim state.nx).\n"
":param x: state point (dim. state.nx).\n"
":param dx: velocity vector (dim state.ndx).\n"
":param Jin: input matrix (number of rows = state.nv).\n"
":param firstsecond: derivative w.r.t x or dx")
.add_property("nx", bp::make_function(&StateAbstract_wrap::get_nx), "dimension of state tuple")
.add_property("nx", bp::make_function(&StateAbstract_wrap::get_nx),
bp::make_setter(&StateAbstract_wrap::nx_, bp::return_internal_reference<>()),
"dimension of state tuple")
.add_property("ndx", bp::make_function(&StateAbstract_wrap::get_ndx),
bp::make_setter(&StateAbstract_wrap::ndx_, bp::return_internal_reference<>()),
"dimension of the tangent space of the state manifold")
.add_property("nq", bp::make_function(&StateAbstract_wrap::get_nq), "dimension of the configuration tuple")
.add_property("nq", bp::make_function(&StateAbstract_wrap::get_nq),
bp::make_setter(&StateAbstract_wrap::nq_, bp::return_internal_reference<>()),
"dimension of the configuration tuple")
.add_property("nv", bp::make_function(&StateAbstract_wrap::get_nv),
bp::make_setter(&StateAbstract_wrap::nv_, bp::return_internal_reference<>()),
"dimension of tangent space of the configuration manifold")
.add_property("has_limits", bp::make_function(&StateAbstract_wrap::get_has_limits),
"indicates whether problem has finite state limits")
......@@ -22,6 +22,10 @@ namespace python {
class StateAbstract_wrap : public StateAbstract, public bp::wrapper<StateAbstract> {
using StateAbstract::lb_;
using StateAbstract::ndx_;
using StateAbstract::nq_;
using StateAbstract::nv_;
using StateAbstract::nx_;
using StateAbstract::ub_;
StateAbstract_wrap(int nx, int ndx) : StateAbstract(nx, ndx), bp::wrapper<StateAbstract>() {}
......@@ -245,8 +249,8 @@ class StateAbstract_wrap : public StateAbstract, public bp::wrapper<StateAbstrac
throw_pretty("Invalid argument: "
<< "dx has wrong dimension (it should be " + std::to_string(ndx_) + ")");
return bp::call<Eigen::MatrixXd>(this->get_override("JintegrateTransport").ptr(), x, dx, (Eigen::MatrixXd)Jin,
return bp::call<Eigen::MatrixXd>(this->get_override("JintegrateTransport").ptr(), (Eigen::VectorXd)x,
(Eigen::VectorXd)dx, (Eigen::MatrixXd)Jin, firstsecond);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment