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

Assertion on unaligned arrays failing (sometimes) #12

Open
Tommsy64 opened this issue Dec 19, 2018 · 2 comments
Open

Assertion on unaligned arrays failing (sometimes) #12

Tommsy64 opened this issue Dec 19, 2018 · 2 comments

Comments

@Tommsy64
Copy link

I am trying to run the following on the roboRIO:

public void initialize() {
    DcMotor motor = new DcMotor(12.0, 5330 * 2.0 * Math.PI / 60.0 / 12.75, 2 * 2.7, 2 * 131.0, 2 * 2.41 * 12.75);
    CoupledChassis chassis = new CoupledChassis(motor, motor, 0.0762, 0.5, 25.0);
    CoupledCausalTrajGen gen = new CoupledCausalTrajGen(chassis);

    TrapezoidalProfile profile = new TrapezoidalProfile();

    List<HermiteQuintic.Waypoint> waypoints = new ArrayList<>();
    waypoints.add(new HermiteQuintic.Waypoint(Vec2.cartesian(0, 0), Vec2.cartesian(5, 0), Vec2.cartesian(0, 0)));
    waypoints.add(new HermiteQuintic.Waypoint(Vec2.cartesian(4, 4), Vec2.cartesian(0, 5), Vec2.cartesian(0, 0)));

    List<HermiteQuintic> hermites = HermiteFactory.generateQuintic(waypoints);
    ArcParameterizer param = new ArcParameterizer();
    param.configure(0.01, 0.01);
    List<? extends Curve2d> curves = param.parameterize(hermites);

    gen.configure(curves, profile);

    CoupledState state = new CoupledState();

    for (double t = 0; !state.finished && t < 5; t += 0.01) {
        state = gen.generate(state, t);
        echo(state);
    }

    motor.close();
    chassis.close();
    gen.close();
    param.close();
    profile.close();
}

private static void echo(CoupledState state) {
    Object obj[] = new Object[] {
            state.time, state.config.position.x(), state.config.position.y(),
            state.config.heading, state.kinematics.distance, state.kinematics.velocity, state.kinematics.acceleration,
            state.curvature, 0, 0, 0,
    };
    log.debug("{}", obj);
}

However, it will crash (sometime before reaching the echo(state); line) with the following message from eigen:

java: /__w/1/s/libs/eigen/Eigen/src/Core/DenseStorage.h:109:
Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = double; int Size = 8; int MatrixOrArrayOptions = 0]: Assertion `(internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (15)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed

Other times, the entire command runs successfully.

I am using Pathfinder and Pathfinder-JNI 2.0.0-prealpha.
Running the same code on my local windows environment does seem to crash.

@ajbt200128
Copy link

Has there been any updates on this issue? Presumably defining #define EIGEN_DONT_VECTORIZE and
#define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT in the pathfinder.h cpp file then it will solve some of these issues, but for whatever reason when a coupledstate is created the same error arises

@JaciBrunning
Copy link
Member

You can apply the diff from #13 to fix this issue currently. I haven't merged it since it conflicts with my staging local changes and I don't have time to fix it just yet.

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