# Orientation

VMX-pi 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 VMX-pi, a few key concepts must be understood in order to correctly install VMX-pi 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 discussion on the 3-D Coordinate system is 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 invented.  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 navX- Micro 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

## VMX-pi Board Orientation (Board Frame)

### Aligning Board Frame and Body Frame

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

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

The VMX-pi 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 VMX-pi on a robot, the VMX-pi yaw (Z) axis and the gravity axis must be aligned.

### Default VMX-pi Board Orientation

The default VMX-pi circuit board orientation is with the VMX-pi logo on the Front Right,  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 navX-Micro 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 VMX-pi circuit board in a different orientation (vertically, horizontally, or upside down), you can use the OmniMount feature to transform the orientation.