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

Array subscript out of range #216

Open
mskripnik opened this issue Dec 19, 2024 · 2 comments
Open

Array subscript out of range #216

mskripnik opened this issue Dec 19, 2024 · 2 comments
Labels
bug-community Something isn't working in the community version

Comments

@mskripnik
Copy link

mskripnik commented Dec 19, 2024

I get sometimes "array subscript out of range" exception for very short trajectories. Here's what I've found in the debugger:
image
Might this be a numerical issue not properly handled in Ruckig?

@mskripnik mskripnik changed the title Array index out of bound Array subscript out of range Dec 19, 2024
@mskripnik
Copy link
Author

Here is the code to reproduce:

int main()
{
    ruckig::Ruckig<2> ruckig;
    ruckig::InputParameter<2> ruckig_input;
    ruckig::Trajectory<2> trajectory;

    double current_px = 446.62116880136932;
    double current_py = 42.735729882548974;
    double current_vx = 4.4408920985006262e-16;
    double current_vy = -1.6205012520938689e-18;
    double current_ax = 0;
    double current_ay = -4.0512531302346743e-17;

    double target_px = 446.62116880136932;
    double target_py = 42.735729882548974;
    double target_vx = 0;
    double target_vy = 0;
    double target_ax = 0;
    double target_ay = 0;

    double v_max = 500;
    double a_max = 1000 * 0.5;
    double j_max = 10000 * 0.5;

    ruckig_input.current_position     = {current_px, current_py};
    ruckig_input.current_velocity     = {current_vx, current_vy};
    ruckig_input.current_acceleration = {current_ax, current_ay};

    ruckig_input.target_position     = {target_px, target_py};
    ruckig_input.target_velocity     = {target_vx, target_vy};
    ruckig_input.target_acceleration = {target_ax, target_ay};

    ruckig_input.max_velocity     = {v_max, v_max};
    ruckig_input.max_acceleration = {a_max, a_max};
    ruckig_input.max_jerk         = {j_max, j_max};

    ruckig_input.control_interface = ruckig::ControlInterface::Position;
    ruckig_input.synchronization   = ruckig::Synchronization::Phase;

    ruckig.calculate(ruckig_input, trajectory);

    array<double, 2> p, v, a;
    trajectory.at_time(0, p, v, a);

    return 0;
}

@pantor
Copy link
Owner

pantor commented Dec 19, 2024

Thanks for reporting!

This (and also other issues like #215) are of course fixed in the Pro version. I'll still keep this open for reference.

@pantor pantor added the bug-community Something isn't working in the community version label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-community Something isn't working in the community version
Projects
None yet
Development

No branches or pull requests

2 participants