FloatingArrayDesign / MoorDyn

a lumped-mass mooring line model intended for coupling with floating structure codes
BSD 3-Clause "New" or "Revised" License
66 stars 37 forks source link

Added canonical Euler angles for outputs #167

Closed RyanDavies19 closed 7 months ago

RyanDavies19 commented 8 months ago

Based on discussion in #163

Adds canonical Euler angles function from Eigen to replace the Euler angle function. This resolves an issue where outputted roll could not be negative, and where certain input body rotations would not be reflected in the output rotation values. This only changes the values written to output files, not internal dynamics.

Below are outputs before and after the change for a coupled body rotating periodically.

Before: outputs before change

After: after_adjustment

@AlexWKinley thanks for putting together the suggested code for this, I only had to make some minor changes.

We can move this into Misc.cpp if we feel it goes better there. I put it where it is because that's where the Quat2Euler functions are.

RyanDavies19 commented 8 months ago

Update: I changed the body test so that it now passes. Based on the print statements the body needs to have a quat along the x axis with 90 angle. Before canonical angles, this was an axis in the positive x direction with a -90 deg angle. Now the axis is in the negative x direction with a +90 deg angle. Because they are equivalent then the test should be considered passing. I also compared to MDF with an attached rod and the behavior/orentation remains the exact same as it did before canonical Euler angles