LibEPN (Easy Pose Notation) is a Java library designed to provide an easy-to-use interface for 3D position and orientation. The library is heavily dependant on Quaternions, and makes use of the following dependencies:
I use this library in various personal and school projects relating to pose estimation, robotics, and computer vision.
Step 1. Add the RetryLife maven server to your build.gradle
file:
repositories {
maven {
name 'retrylife-release'
url 'https://release.maven.retrylife.ca/'
}
}
Step 2. Add this library as a dependency:
dependencies {
implementation 'ca.retrylife:easy-pose-notation:1.+'
implementation 'ca.retrylife:easy-pose-notation:1.+:sources'
implementation 'ca.retrylife:easy-pose-notation:1.+:javadoc'
}
The following should be noted when working with coordinates:
alpha
,beta
, andgamma
refer respectively to theZ
,X
andY
axes of rotation.- The coordinate system assumes that:
- If you are at
(x: 0, y: 1, z: 0)
facing(0,0,0)
, theY
axis will be coming "towards" you,X
will be increasing to your left, andZ
will be increasing towards the sky.
- If you are at
- All angles will increase to the left around any axis assuming you are in line with the axis, looking at
(0,0,0)
- All coordinate and angle systems follow that of Google's device orientation specification, and the world frame coordinate system used by MIT's Drake.
The following is a basic usage example. See the JavaDoc for full API reference.
// Create a pose at (10,0,0) rotated around the Z axis to the left by 45 degrees
Pose p = new Pose(
new SimpleMatrix(new double[][]{{10,0,0}}),
QuaternionUtil.quaternionFromEulerAngles(Math.toRadians(45), 0, 0)
);
// Print the pose's quaternion
System.out.println(p.getRotation());
// Print the pose's rotation as euler angles
System.out.println(p.getEulerRotation());
// Print the pose's position
System.out.println(p.getPosition());
// Print the pose's "surface normal
System.out.println(p.getNormal());
This library also contains a sub-library called EPN4FRC. This is a small binding between LibEPN and WPILib's Pose2d coordinate system for the FIRST Robotics Competition. EPN4FRC in-source documentation can be found here.
This library was heavily supported by the following sources:
- Wikipedia: Quaternions
- Wikipedia: Conversion between quaternions and Euler angles
- 3blue1brown: Visualizing Quaternions
- 3blue1brown: Quaternions and 3d rotation, explained interactively