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

Integration terminated since the maximum number of function calls is reached #32

Closed
xeonz1 opened this issue Feb 5, 2022 · 3 comments
Closed

Comments

@xeonz1
Copy link

xeonz1 commented Feb 5, 2022

Hi,

On Iteration 0 of SLQ solver, I get an exception from the integrator (ODE45_OCS2):

Integration terminated since the maximum number of function calls is reached. State at termination time -0.928457

I initialized the trajectory as

    ocs2::SystemObservation initObservation;
    initObservation.state = interface.initialState;
    initObservation.input = ocs2::vector_t::Zero(robo::INPUT_DIM);
    initObservation.mode = 0;
    // Initial command
    ocs2::TargetTrajectories initTargetTrajectories(
        {0.0}, {initObservation.state}, {initObservation.input});

    // run dummy
    leggedRobotDummySimulator.run(initObservation, initTargetTrajectories);

and the mpc node as

    robo::RobotInterface interface(taskFilePath, targetTrajectoryFilePath);
    /*ros*/
    ros::init(argc, argv, interface.model.name);
    ros::NodeHandle nodeHandle;
    std::shared_ptr<ocs2::RosReferenceManager> rosReferenceManagerPtr(
        new ocs2::RosReferenceManager(interface.model.name, interface.refManager));
    rosReferenceManagerPtr->subscribe(nodeHandle);
    /*mpc*/
    ocs2::MPC_DDP mpc(interface.mpcSetting, interface.ddpSetting,
                      interface.rollout, interface.ocp, interface.initializer);
    mpc.getSolverPtr()->setReferenceManager(rosReferenceManagerPtr);
    ocs2::MPC_ROS_Interface mpcNode(mpc, interface.model.name);
    mpcNode.launchNodes(nodeHandle);

The starting time and initial state are defined in the task.info file. I think it is trying to run iteration on the initial trajectory but have no idea about why it comes to this exception. I wrote the code for dynamics built from pinocchio and CppAD instead of using the provided pinocchio interfaces.
Update
After debugging for a while I found the exception is raised when SLQ integrateRiccatiEquationNominalTime calls integrateTimes.
Update
I tested the fullcentroidaldynamics version of the _leg

ged robot_ example, and soon it becomes unstable.
https://user-images.githubusercontent.com/56295370/152655845-19a45f25-f174-4710-b10a-bb3f68637009.mp4

@xeonz1 xeonz1 changed the title Negative termination time using ODE45 Integration terminated since the maximum number of function calls is reached Feb 5, 2022
@facontidavide
Copy link

We are having the same problem with a quadruped model... any advice?

@xeonz1
Copy link
Author

xeonz1 commented Feb 23, 2022

We are having the same problem with a quadruped model... any advice?

Sorry, but I am not on this already. Maybe its related to the stability of your dynamics/initialization or the constraints you added which has made the algorithm fails to produced stable solution.

@farbod-farshidian
Copy link
Contributor

It seems that there has been an issue with the legged robot example. In the new release 10.1, this issue is resolved. Moreover, you will get up to 20% speedup.

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