Robotic Mechanics and Modeling/Kinematics/Additional Examples for Rotations and Coordinates

Example 1 (Spring '20 - Team 1)
An astronaut is floating in space looking down at the earth. The coordinates of the astronaut's space craft are $$\langle1.4,0.65,0.78\rangle$$ km with respect to the astronaut's reference frame. the The astronaut's partner informs him of an asteroid passing by. In order to see it, the astonaut must rotate $$67^\circ$$ to the left (around the z-axis), then $$54^\circ$$down (around the new y-axis), and then $$38^\circ$$ on his side (the new x-axis). What are the coordinates of the space craft in the astronauts new reference frame.

This whole code falls in one single block but it has been separated into chunks for ease of explanation.

The following code is the initial setup for the program. First we input, the angles in which the astronaut has to rotate by, alpha will be used for the z rotation, beta will be used for the y rotation and gamma will be used for the x rotation. Notice that the angles are converted to radians in Python. The following code shows the rotation matrices for the z, y and x rotations accordingly. The final part of code will provide a sequence of dot products of these matrixes that will give the Euler rotations that the astronaut experiences. This code block gives a name to the Euler sequence and presents the location of the spacecraft in the original frame (a_p). Afterwards a series of elements corresponding to the x, y z coordinates of the spacecraft are made for ease of plotting. The vectors x_a, y_a, z_a are for the inital point of the spacecraft, x_b, y_b, z_b represent the new location of the aircraft which is expressed by the dot product of the original location and the Euler sequence. The cooridnates of the spacecraft with respect to the new cooridnate system is $$\langle 0.61,1.52,-0.54\rangle$$. These next two sets of code are responsible for plotting the position of the spacecraft relative to the astronaut and the new direction in which the astronaut is facing. The result is shown in the following figures.

Example 2 (Spring '20 - Team 2)
A two scuba divers are diving in the Great Blue Hole for the first time. They are following the buddy protocol as they continue to dive down deeper to a depth of $$\langle6,4,-8\rangle$$. Suddenly, Diver 1 lost his buddy and couldn't see him anymore. In order to find his buddy Diver 1 needs to rotate 45 about the X, Y, and Z axes. What are the coordinates in Diver 1's new reference frame?

To start, the following libraries need to be imported for the script The first step to solve the problem is to define the angles of rotation the Diver needs to rotate, and define the Euler angle rotation matrix in the X Y and Z directions. This can be done in the following way Once everything is defined, the method of rotation from the initial reference frame (a) to the new reference frame (b) is take the dot product of the Euler angle rotation matrix's transpose and the initial position vector. This is shown in the following code. Once the rotation is completed, the vectors can be plotted for a visual representation

Example 3 (Spring '20 - Team 3)
A bus driver is training a new hire. To test his knowledge of the routes, he asks him to point out where the next stop is. Confused by his recent lecture on Robotics, the new hire points to the stop, but the trainer realizes his trainee was looking for the stop in the wrong reference frame. The new hire claims that the new stop is half a mile in the x-direction, half a mile in the y-direction and half a mile in the z-direction. The trainer says this is true, but only when the x-coordinate system is rotated by 50 degree, the y-coordinate system is rotated by 100 degrees, and the z-coordinate system is rotated by 70 degrees. The trainer sets out a coordinate axis to help the new hire understand this rotation better.

The first thing that must be done to solve this problem is to import the proper libraries and to define the three angles, denoted as "alpha", "beta", and "gamma". An Euler angle rotation matrix must be defined.with these angles, and so must the original location of the point. Remember that the new hire believed that the stop was at a vector of $$\langle 5, 5, 5 \rangle$$ in miles away from where they were. That array must be transposed while the rotation matrix must be inverted. Once the dot product is taken between them, the new coordinates can be figured out and the axis and points can be graphed. With these parameters we see that the resulting bP is at ta vector $$\langle -0.61, 0.55, 0.27\rangle$$ in the original reference frame. Now the trainer wants to show the new hire just how much of an impact his mistake could have been so he asks the new hire to calculate the distance between the axis endpoints and more importantly, the total distance between points aP and bP. We know the values of the vectors x_a, x_b, y_a, y_b, z_a, z_b (These are the components of the end points for the vector axis lines) and so if we take the difference between each of those components for the x, y, and z vectors respectively, square them and then take the square root of the sum, we can find the distance between the end points of the quivers which define _a, x_b, y_a, y_b, z_a, z_b. You can also take the distance between the point a_p and b_p through a similar process where you break them down and use the distance formula between all of the components. The distance between the two end of the x axis vectors is:1.49 miles. The distance between the two end of the y axis vectors is: 0.36 miles. The distance between the two end of the z axis vectors is: 1.46 miles. the distance between the two points, p, is: 1.14 miles.