This backend application provides the calculations required for inverse kinematics of a 3-DOF robotic arm. It communicates with the frontend via WebSocket and computes the joint angles and trajectory points based on input coordinates and configuration.
- Calculates joint angles (( heta_1, heta_2, heta_3)) using inverse kinematics formulas.
- Computes and sends transformation matrices and joint coordinates.
- Handles real-time WebSocket communication with the frontend.
- Utilizes FastAPI for lightweight and high-performance backend implementation.
- Clone the repository:
git clone https://github.com/yourusername/backend-repo-name.git
- Navigate to the project folder:
cd backend-repo-name
- Create a virtual environment and activate it:
python -m venv env source env/bin/activate # For Windows, use env\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Run the server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
-
Input:
- Accepts target coordinates ((X, Y, Z)) and configuration options (
arm
andelbow
) from the frontend via WebSocket.
- Accepts target coordinates ((X, Y, Z)) and configuration options (
-
Inverse Kinematics Calculations:
- Computes joint angles using trigonometric equations and robot parameters.
- Transformation matrices ((T_{0_1}, T_{0_2}, T_{0_3}, T_{0_4})) are calculated to determine joint positions.
-
Output:
- Returns the calculated joint angles and joint coordinates as JSON data to the frontend for visualization.
- WebSocket Endpoint:
/ws
- Handles real-time communication between the frontend and backend.
- Python: Programming language.
- FastAPI: Framework for building the backend.
- SymPy: Library for symbolic mathematics, used for matrix operations.
- Uvicorn: ASGI server for running FastAPI.
{
"X": -149.09,
"Y": 848.20,
"Z": 20.23,
"arm": -1,
"elbow": -1
}
{
"theta1_deg": 30.0,
"theta2_deg": 45.0,
"theta3_deg": 60.0,
"coords_0_1": [100.0, 200.0, 300.0],
"coords_0_2": [150.0, 250.0, 350.0],
"coords_0_3": [200.0, 300.0, 400.0],
"coords_0_4": [250.0, 350.0, 450.0]
}
This project is licensed under the Mozilla Public License Version 2.0