Code Monkey home page Code Monkey logo

Comments (4)

cmastalli avatar cmastalli commented on June 8, 2024

Hi @ajordana,

Thanks for telling us about this limitation in our Python bindings.

You can change the lower/upper bounds on inequality constraints using this #1171.

I'll close this issue, but feel free to ask any questions.

from crocoddyl.

ajordana avatar ajordana commented on June 8, 2024

Thank you very much @cmastalli! I was able to create a constrained LQR by inheriting from ActionModelAbstract.

However, I noticed the following: when I create a constrained LQR by inheriting from DifferentialActionModelAbstract, I am able to set g_ub and g_lb but it seems that the Euler integration resets them to their default value.

Here is an example:

import numpy as np
import crocoddyl


class DifferentialActionModelLQR(crocoddyl.DifferentialActionModelAbstract):
    def __init__(self):
        nx = 4
        nu = 2
        nr = 1
        ng = 4
        nh = 0
        
        state = crocoddyl.StateVector(nx)
        crocoddyl.DifferentialActionModelAbstract.__init__(self, state, nu, nr, ng, nh)

        self.g_lb = np.array([-np.inf] * ng)
        self.g_ub = np.array([10.0] * ng)

    def calc(self, data, x, u=None):
        pass

    def calcDiff(self, data, x, u=None):
        pass

lqr_diff = DifferentialActionModelLQR()
print("Differential model g_ub = ", lqr_diff.g_ub)
dt = 0.01
lqr = crocoddyl.IntegratedActionModelEuler(lqr_diff, dt)
print("Integrated model g_ub = ", lqr.g_ub)

Is there something wrong in what I am doing?

from crocoddyl.

cmastalli avatar cmastalli commented on June 8, 2024

@ajordana -- please see #1180. It should fix your issue.

from crocoddyl.

ajordana avatar ajordana commented on June 8, 2024

Yes, this fixes the issue. Thank you!

from crocoddyl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.