The Euler Rotation Tool is a Python-based application designed to visualize and animate the rotation of a body frame relative to a world frame using Euler angles. This tool is particularly useful for understanding the effects of sequential rotations and the resulting orientation of objects in three-dimensional space. It is an educational resource aimed at students and professionals in computer science, mechanical engineering, robotics, and related fields.
- Rotation Visualization: Visualize the rotation of a body frame using Euler angles (phi, theta, psi).
- Path Tracking: Track and display the path of the body frame's origin as it moves and rotates.
- Interactive Animation: Animate the rotation and translation of the body frame over time.
- Customizable Trajectories: Define custom trajectories for translation and rotation.
To use the Euler Rotation Tool, you need to have Python and the following libraries installed:
numpy
matplotlib
You can install these dependencies using pip:
pip install numpy matplotlib
-
Clone the Repository:
git clone https://github.com/yourusername/euler-rotation-tool.git cd euler-rotation-tool
-
Run the Application:
python euler_rotation_tool.py
-
Customize Trajectories: You can customize the translation and rotation trajectories by modifying the trajectory_function in the
euler_rotation_tool.py
file.
The following example demonstrates how to define a smooth trajectory for the body frame:
def trajectory_function(t):
dx = 0.01 * np.sin(t)
dy = 0.01 * np.cos(t)
dz = 0.01 * t / 10
dphi = 0.01 * np.sin(t / 2)
dtheta = 0.01 * np.cos(t / 2)
dpsi = 0.01 * np.sin(t / 3)
return dx, dy, dz, dphi, dtheta, dpsi
The Euler Rotation Tool uses a combination of translation and rotation matrices to update the position and orientation of the body frame. The rotations are applied in the ZYX order, which means the body frame is first rotated around the Z-axis, then the Y-axis, and finally the X-axis.
- Frame Class: Represents a coordinate frame with methods for translation and rotation.
- plot_frames Function: Plots the world and body frames along with the path of the body frame's origin.
- update Function: Updates the position and orientation of the body frame for each frame of the animation.
The rotation matrices for the ZYX order are defined as follows:
- Rotation around the Z-axis:
- Rotation around the Y-axis:
- Rotation around the X-axis:
The combined rotation matrix
The translation vector
The new position
Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.
For any questions or inquiries, please contact ronen.g.aniti@gmail.com.