Modeling the Shoulder

Modeling the Shoulder

Our goal in modeling the magnet is to be able to find the arm’s position given a magnetometer’s reading. In order to do that, we need to fix the magnet’s position on the arm. This will limit the total possible positions in which the magnet can be located, and it will allow us to locate the position of the arm given a magnets position. First, we will model the magnet’s range of motion on the shoulder. Then, we will combine that with the magnetometer’s position and the magnetic field produced by the magnet to localize the magnet on the arm and to identify the position of the shoulder joint.

For modeling the magnet’s position relative to the shoulder, we will define the origin as the center of the rotator cuff, so that when the arm moves, the origin is the center of rotation. A person will face in the positive y direction, the z axis will be the vertical axis, and the x axis will run in parallel with the shoulders, with the positive x direction being away from the shoulder. We will place the magnet on the humerus, right below the deltoid, and define the position of the magnet as m with m’ being the unit vector in the magnet’s direction, and d being the distance between the magnet and the center of the rotator cuff. For our model, we will assume that the magnet is always facing perpendicular to the humorous, and that it is always equidistant from the center of the rotator cuff. While these assumptions may not hold true, the model can be adjusted later to correct for any errors.


In order to model the shoulder, we will use a rotational coordinate system as pictured in the diagram above. Yaw, rotation around the z axis, or moving the arm forward and back at a constant height will be denoted as Ψ, with Ψ = 0 in the direction of the positive x axis, with a positive Ψ in the forward direction. Pitch, the angle formed by the arm and the positive axis, that measures movement of the arm up and down will be denoted by Θ. Roll, rotation around the x axis, or twisting your arm will be denoted by φ, with positive φ being forward rotation. We can model the magnet’s location by the following equations of a sphere of radius d, where mx, my, and mz are the x,y  and z coordinates of the magnet respectively because of the assumption that the magnet is always equidistant from the center of the rotator cuff.

To model Vm, the unit vector in the direction that the magnet is pointing, we will start by modeling the Vm0, the unit vector in the direction that the magnet is pointing where φ  = 0. Then, we will rotate it around the position vector to model change in φ . We know that Vm0 is the same as the position vector at Θ – π/2 because the magnet is rotated π/2 rad in the Θ direction from the position vector. Thus the following equations indicate the magnet’s direction such that φ  = 0, where Vm0x, Vm0y, and Vm0z are the vector components of Vm0 in the x, y, and z directions respectively.




Next, to rotate Vm0  in the φ direction, we need to rotate it around the position vector. Based on Rodrigues’ Rotation Formula, we can express Vm = Vm0 * cos(φ) + (Vm0 × m‘) * sin(φ) . The following equations indicate the magnet’s direction after being rotated φ rad, where Vmx , Vmy, and Vmz  are the vector components of Vm in the x, y, and z  directions respectively.

Now that we have modeled the magnet’s position and orientation on the shoulder, we can model it’s effect on the magnetometer at any shoulder location. The coordinate system will remain the same for modeling the magnetic field as for modeling the position and orientation of the magnet. The magnetometer will be located on the shoulder blade, right below the spine of the scapula and will be denoted as t. We will have three vectors as shown in the diagram to the right, Vm, the vector in which the magnet is facing, Vr, the vector from the magnet to the magnetometer, and Vp the vector orthogonal to Vr in the plane formed by Vm and Vr.


We will make an assumption that the magnet is at a far enough distance from the magnetometer such that the magnet can be treated as a dipole, thus the shape of the magnet does not affect B, the magnetic field read by the magnetometer. Based on the magnetic field created by a dipole, we can model the magnetic field by finding it’s components in the Vt and Vp directions Band BΘ respectively . In the following equations is the magnetic moment constant, Θm is the angle between the magnet, and r is the distance between the magnet and the magnetometer.
To find Θm  and r we will first define Vr , which is the vector from the magnet to the magnetometer by the following equation.
Next, we can find the Θm, by using the dot product, where Vr  •  Vm = |Vm| •|Vr| • cos(Θm) , thus we can express r and Θm as with the following equations.

Lastly, we need to calculate Vp. We can do that by projecting Vm onto Vt, and subtracting that projection from Vm, where the projection of Vonto Vt can be expressed as Vt • (Vm • Vt)/(V• Vt). This leaves us with the component of Vm that is perpendicular to Vt, however, since we want Vp directed away from direction of Vm, we will find its inverse. Knowing Vr and Vm we can calculate Vp, a vector perpendicular to Vr in the field formed by Vr and Vm by the following equation.

Lastly, we will multiply Br and BΘ  by the unit vectors of Vr and Vp to find the component vectors of the B, the magnetic field read by the magnetometer, and combine them to find B.

Using the magnetometer’s readings as input, we can find the Ψ, Θ, and φ, such that the calculated B equals the magnetic field read by the magnetometer. This lets us identify the position of the arm, and the position of the magnet.

One issue that arises with this model is that for every magnetic field, there exist two locations that will produce the same magnetometer reading. If we fix φ to equal 0, such that the shoulder does not rotate, then we only get one solution, however, this limits the model significantly. On the other hand, if we know a previous position of the shoulder and the motion of the arm, we would be able to choose between the two solutions to identify the position of the arm.

With this model in place, the next step would be to apply the model to the real world. I will need to figure out how to exclude the earths magnetic field from the magnetometer’s reading, how to remove noise from the magnetometer moving when the shoulder moves, and how to fix the location of the magnetometer on the shoulder to know where the magnetic field is being measured.