# Metrics Measured by Perch

## We get this questions a lot - so we wanted to clarify how we are gathering data and turning it into the metrics we output. See below for more!

### 3D Position

Perch uses a 3D camera to directly measure the position of objects in the field of view of the camera. Every image that the Perch camera captures contains information about how far away objects are from the camera itself.

Using a complex tracking pipeline developed by engineers at Perch, the camera processes the image to find the objects we’re interested in (namely, a barbell). Once the barbell is located in the image, the device will use the distance data from the 3D camera and some geometry to triangulate where the barbell is in 3D space. Otherwise known as determining the 3D coordinate of the barbell for this particular point in time.

3D position, as its name suggests, consists of three spatial dimensions. The names we use for these dimensions are X, Y, and Z. We define Z as up and down (parallel to gravity), X as forwards and backwards (in the perspective of the athlete), and Y as side to side (in the perspective of the athlete).

### 3D Path (Barbell Path)

The 3D path of an object -- in our case, the barbell -- is nothing more than a sequence of 3D coordinates with time stamps. By processing images rapidly as the 3D camera captures them, we collect many 3D coordinates and collect them together to form a 3D path.

The 3D path represents precisely where in 3D space the barbell moved over time. This is the core data that Perch captures, and every other metric is calculated using this 3D path.

### Displacement

Displacement is simply calculated by subtracting a starting 3D position and from an ending position. If you isolate only one of the axes, for example the Z axis, you then have the vertical displacement between those positions. For example, in the case of a back squat, the displacement on the Z axis can be interpreted as the squat depth.

### Velocity

The equation for velocity is always the same: displacement (aka. distance) divided by time. Since we are able to go from 3D position to 3D Path and finally calculate displacement, we’re halfway there. Every 3D coordinate also has a corresponding time associated with it, and we can subtract the times starting and ending 3D coordinates to calculate the amount of time elapsed between those two positions.

By dividing the displacement by the time that elapsed between them, you are calculating velocity.

### Mean Velocity

Mean velocity (or average velocity) as used in VBT is defined as the average velocity of a complete movement (e.g. the concentric portion of a rep).

Calculating mean velocity is exactly the same as calculating any other velocity, except the start and end 3D positions you choose are the beginning and end of the movement respectively.

For example, to calculate the concentric mean velocity (on the Z axis) of a rep, we perform three calculations:

1. We subtract the Z value of the coordinate of the bottom of the rep (the beginning of the concentric movement) from the highest point at the end of the rep (the final coordinate of the concentric movement) to calculate the displacement.
2. We subtract the times of the same two coordinates chosen above to calculate the duration of the concentric movement
3. Finally, we divide the displacement by the duration to get the velocity

### Peak Velocity

Calculating peak velocity is once again very similar to other velocity calculations, however it differs in selection of the coordinates.

Peak velocity is defined as the greatest instantaneous velocity during a movement. Here, “instantaneous” means between two consecutive coordinates. Naturally, there is some amount of time between each coordinate we measure, so using two adjacent coordinates is not truly instantaneous, but is sufficiently close.

As an example, to find the peak concentric velocity (on the Z axis), we do the following:

1. Compute the instantaneous velocity using every pair of consecutive coordinates from the lowest to the highest point of the movement (following the same procedure as defined above)
2. The largest of these instantaneous velocities is your peak concentric velocity

### Power

The equation for power is defined as Work divided by time: P = W / t

With some algebra and substitution using other physics equations, the equation for power can be rewritten in a few helpful ways:

W = F d     F = m a     V = d / t

P = F d / t

P = F V    P = m a V

In our case, the force is how much force the athlete is applying to the babell. While we’ve already covered how we can calculate velocity (the Vterm), we can’t directly measure the force. However, we can calculate it in a couple different ways depending on the context.

### Mean Power

Mean power can be described as the average amount of power over the duration of the movement. To calculate, we can reuse the mean velocity we’ve already calculated above for the V term in our power equations.

The force (F) in our equation is similarly the average force applied by the athlete during the movement. Because the bar is at rest before and after the movement, the average force is equal to the force required to oppose gravity (aka, the force of gravity) on the barbell. As such, the force is the mass of the barbell (in kilograms) multiplied by the acceleration due to gravity (9.8 m/s).

With the math established, calculating mean power is as simple as substituting the mass of the barbell (converted to kilograms, m) and the mean velocity (in meters per second, V) into the following equation:

Mean Power = m x 9.8 x V

### Peak Power

Calculating peak power requires a bit more complexity, as was the case with peak velocity.

In order to calculate the peak power output for a movement, we calculate the instantaneous power at every point during the movement, and select the largest.

Here is the general procedure for how we calculate peak power for a concentric movement:

1. Using the same procedure as in peak velocity, calculate the instantaneous velocity for every pair of points in the movement
2. Using every consecutive pair of instantaneous velocities computed in 1, compute the instantaneous acceleration (acceleration is change in velocity divided by time)
3. For each instantaneous measurement of velocity and acceleration, plug in the following variables
1. The instantaneous acceleration (a)
2. The instantaneous velocity (V)
3. The weight in kilograms of the barbell (m)

Peak Power = m x a x V

1. Select the largest value, this is your peak power

### Time to Peak Power (T2PP)

Based on the calculation for Peak Power above (Peak Power = m x a x V), the time to peak power is the duration in seconds it takes to achieve that peak power, based on the start of the concentric portion of the rep.  This is displayed as T2PP as an abbreviation in the app.

### Time to Peak Velocity (T2PV)

Based on the calculation for Peak Velocity above, the time to peak velocity is the duration in seconds it takes to achieve that peak velocity, based on the start of the concentric portion of the rep.  This is displayed as T2PV as an abbreviation in the app.

### Velocity at 100ms AKA v100 (V100)

The v100 is a new metric that will help to track explosiveness of athletes, among other things.  This is based similarly to calculations above of time to peak velocity and power, but instead measures the velocity at which the bar is moving within the first 100 milliseconds of the concentric portion of the rep.  This is displayed as V100 as an abbreviation in the app.