# Orientation

navX2-MXP measures a total of 9 sensor axes (3 gyroscope axes, 3 accelerometer axes and 3 magnetometer axes) and fuses them into a 3-D coordinate system. In order to effectively use the values reported by navX2-MXP, a few key concepts must be understood in order to correctly install navX2-MXP on a robot.

## 3-D Coordinate System

When controlling a robot in 3 dimensions a set of 3 axes are combined into a 3-D coordinate system, as depicted below:

In the diagram above, the green rounded arrows represent Rotational motion, and the remaining arrows represent Linear motion.

 Axis Orientation Linear motion Rotational Motion X (Pitch) Left/Right – Left / + Right + Tilt Backwards Y (Roll) Forward/Backward + Forward / – Backward + Roll Left Z (Yaw) Up/Down + Up / – Down + Clockwise/ – Counter-wise

More details are available on the Terminology page.

## Reference Frames

Note that the 3-axis coordinate system describes relative motion and orientation; it doesn’t specify the orientation with respect to any other reference.  For instance, what does “left” mean once a robot has rotated 180 degrees?

To address this, the concept of a reference frame was developed.  There are three separate three-axis “reference frames” that should be understood:

 Coordinate System Technical Term X Axis Y Axis Field World Frame Side of Field Front (Head) of Field Robot Body Frame Side of Robot Front (Head) of Robot navX2 MXP Board Frame See diagram Below See diagram below

### Joysticks and Reference Frames

Since a three-axis joystick is typically used to control a robot, the robot designer must select upon which Reference Frame the driver joystick is based.  This selection of Reference Frame typically depends upon the drive mode used:

 Drive mode Reference Frame Coordinate Orientation Standard Drive Body Frame Forward always points to the front (head) of the robot Field-oriented Drive World Frame Forward always points to the front (head) of the field

## navX2-MXP Board Orientation (Board Frame)

### Aligning Board Frame and Body Frame

In order for the navX2-MXP sensor readings to be easily usable by a robot control application, the navX2-MXP Coordinate System (Board Frame) must be aligned with the Robot Coordinate system (Body Frame).

### Aligning the Yaw (Z) axis and Gravity

The navX2-MXP motion processor takes advantage of the fact that gravity can be measured with its onboard accelerometers, fusing this information with the onboard gyroscopes to yield a very accurate yaw reading with a low rate of drift.  In order to accomplish this, the yaw (Z) axis must be aligned with the “gravity axis” (the axis that points directly up and down with respect to the earth).

When installing navX2-MXP on a robot, the navX-MXP yaw (Z) axis and the gravity axis must be aligned.

### Default navX2-MXP Board Orientation

The default navX2-MXP circuit board orientation is with the navX2-MXP logo on the Rear Left,  with the top of the circuit board pointing up (with respect to the earth).

Since Body Frame and Board Frame coordinates should be aligned, and because the Yaw axis must be aligned with gravity, by default you must orient the navX2-MXP with the top of the board facing up, and with the Y axis (on the circuit board) pointing to the front of the robot.

If you need to mount the navX2-MXP circuit board in a different orientation (vertically, horizontally, or upside down), you can use the OmniMount feature to transform the orientation.