Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checks in SemiImplicitEuler #17

Open
fabinsch opened this issue Jul 26, 2022 · 3 comments
Open

Add checks in SemiImplicitEuler #17

fabinsch opened this issue Jul 26, 2022 · 3 comments
Assignees

Comments

@fabinsch
Copy link
Collaborator

check if it is second-order dynamics @quentinll

for example this test here fails:

ode = create_linear_ode(3, 2)
dt = 0.1
dyn = dynamics.IntegratorSemiImplEuler(ode, dt)
assert isinstance(dyn.createData(), dynamics.ExplicitIntegratorData)
ode_int_run(ode, dyn)

while for create_linear_ode(4, 2) it passes. see full test function here: https://github.com/Simple-Robotics/proxddp/blob/main/tests/python/test_integrators.py

@quentinll
Copy link
Member

For the moment, IntegratorSemiImplEuler only works for systems whose state dimension is a pair integer (we make the hypothesis that x = [q,v] where dim(q)=dim(v), which is quite restrictive ...). This explains why this test fails.

@fabinsch
Copy link
Collaborator Author

fabinsch commented Jul 27, 2022

maybe we can do the following for now ? #21

it is an assert. so it will not trigger when compiled in RELEASE mode or with the NDEBUG flag.
If it triggers in debug mode, it looks like the following

python: /home/fschramm/workspace/proxddp/include/proxddp/modelling/dynamics/integrator-semi-euler.hxx:12: proxddp::dynamics::IntegratorSemiImplEulerTpl<Scalar>::IntegratorSemiImplEulerTpl(const std::shared_ptr<proxddp::dynamics::ODEAbstractTpl<_Scalar> >&, proxddp::dynamics::IntegratorSemiImplEulerTpl<Scalar>::Scalar) [with _Scalar = double; proxddp::dynamics::IntegratorSemiImplEulerTpl<Scalar>::Scalar = double]: Assertion `((this->ndx1) % 2 == 0) && "IntegratorSemiImplEuler must be used with even ndx."' failed.
[1]    346945 abort      python test_integrators.py

which i think is understandable ? what do you think @quentinll

@quentinll
Copy link
Member

This looks fine to me @fabinsch
For later, it would be better to add a class of second order dynamics. This class would be enforced for this integrator and it would provide the dim(q) and dim(v) informations. This would make it possible to consider systems for which dim(q) != dim(v).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants