-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based on the documentation of euler angles, the bounds for holonomic computation of elevation is from 90 to -90 degrees. this bound needs to be enforced by the rotation object.
- Loading branch information
1 parent
487f90c
commit 8bbf216
Showing
3 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/java/src/junit/test/neuronrobotics/utilities/ApacheCommonsRotationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package junit.test.neuronrobotics.utilities; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.apache.commons.math3.geometry.euclidean.threed.Rotation; | ||
import org.apache.commons.math3.geometry.euclidean.threed.RotationConvention; | ||
import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder; | ||
import org.junit.Test; | ||
|
||
import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR; | ||
|
||
public class ApacheCommonsRotationTest { | ||
|
||
@Test | ||
public void test() { | ||
int failCount = 0; | ||
int iterations = 10; | ||
RotationOrder[] list = { RotationOrder.XYZ | ||
|
||
}; | ||
RotationConvention[] conventions = { RotationConvention.FRAME_TRANSFORM, RotationConvention.VECTOR_OPERATOR }; | ||
for (RotationConvention convention : conventions) { | ||
System.out.println("\n\nUsing convention " + convention.toString()); | ||
for (RotationOrder order : list) { | ||
System.out.println("\n\nUsing rotationOrder " + order.toString()); | ||
|
||
double tilt = Math.toRadians((Math.random() * 359) - 179.5); | ||
double elevation = Math.toRadians((Math.random() * 180) -90); | ||
double azumus = Math.toRadians((Math.random() * 359) - 179.5); | ||
|
||
Rotation tester = new Rotation(order, convention, azumus, elevation, tilt); | ||
|
||
double [] vals = tester.getAngles(order, convention); | ||
|
||
double tiltNew = vals[2]; | ||
double elevationNew = vals[1]; | ||
double azumusNew = vals[0]; | ||
|
||
assertEquals(tilt, tiltNew, 0.001); | ||
assertEquals(elevation, elevationNew, 0.001); | ||
assertEquals(azumus, azumusNew, 0.001); | ||
|
||
|
||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters