This project aims to develop an AI-assisted software tool to aid robotics engineers in defining and simulating the kinematics of robotic designs, specifically focusing on 6-DOF robotic arms. The software will accept CAD files (IGES and STL formats), compute forward and inverse kinematics, and generate simulated motion visualizations.
- It includes forward kinematics (calculating the position and orientation of the robot’s end-effector from given joint parameters)
- Inverse kinematics (determining the joint parameters that provide a desired position of the end-effector).
- Integrating AI into this domain can enhance the capability to solve complex kinematic problems more efficiently and adaptively.
- CAD File Support: Accepts IGES and STL files for the robot design.
- Kinematic Calculations:
- Forward Kinematics: Compute the position and orientation of the robot's end-effector given the joint parameters.
- Inverse Kinematics: Determine the joint angles required for a desired end-effector position and orientation.
- Simulation and Visualization: Generate a visual representation of the robot's motion based on kinematic calculations.
- Integration with MATLAB/Simulink: Utilize MATLAB's Robotics Toolbox for simulation and visualization.
- AI Integration: Train and integrate a machine learning model to predict or refine kinematic parameters.
- Python 3.x
trimesh
library for STL file parsingpythonocc
library for IGES file parsingnumpy
for numerical computationsscipy
for optimization in inverse kinematics- MATLAB with Robotics Toolbox for simulation and visualization
- Flask (for web-based interface)
-
Clone the repository:
git clone https://github.com/SteveProkovas/AI-Assisted-Robotics-Kinematics-Software cd AI-Assisted-Robotics-Kinematics-Software
-
Install Python dependencies:
pip install trimesh pythonocc-core numpy scipy flask
-
Ensure MATLAB is installed and has the Robotics Toolbox available.
-
Run the Flask Server:
python app.py
-
Access the web interface: Open your web browser and navigate to
http://127.0.0.1:5000
. -
Upload CAD Files:
- Use the web interface to upload your IGES or STL files.
-
Kinematic Calculations:
- Configure the kinematic parameters and run the forward and inverse kinematics calculations.
-
Simulate and Visualize:
- Use the interface to trigger the MATLAB/Simulink simulation and visualize the robot's motion.
AI-Assisted-Robotics-Kinematics-Software/
├── app.py # Flask application entry point
├── static/
│ └── styles.css # CSS for web interface
├── templates/
│ └── index.html # HTML template for web interface
├── kinematics/
│ ├── forward.py # Forward kinematics implementation
│ ├── inverse.py # Inverse kinematics implementation
│ └── dh_transform.py # DH parameter transformation function
├── cad/
│ ├── parse_stl.py # STL file parsing
│ └── parse_iges.py # IGES file parsing
├── matlab/
│ └── simulate.m # MATLAB script for simulation and visualization
├── ai/
│ └── train_model.py # AI model training script
└── README.md # This README file
This project is developed using the Fountain Model. The Fountain Model is a combination of iterative and waterfall methodologies, which allows for continuous refinement and feedback incorporation while maintaining a structured approach to development. It is particularly suited for projects that require extensive testing and refinement, such as robotics software.
-
STL Files: Use the
trimesh
library to read and parse STL files.import trimesh def parse_stl(file_path): mesh = trimesh.load_mesh(file_path) return mesh
-
IGES Files: Use the
pythonocc
library to read and parse IGES files.from OCC.IGESControl import IGESControl_Reader def parse_iges(file_path): reader = IGESControl_Reader() reader.ReadFile(file_path) reader.TransferRoots() shape = reader.OneShape() return shape
This module provides a simple and flexible implementation of forward kinematics for robotic arms using Denavit-Hartenberg (DH) parameters. It calculates the position and orientation of the robot's end-effector based on joint parameters. Forward kinematics is the process of calculating the position and orientation of a robot's end-effector given the joint parameters. This module uses the DH parameter convention, which provides a systematic way to describe the geometry of robotic manipulators.
Ensure you have Python installed. This module requires numpy
for matrix operations.
You can install numpy
using pip:
pip install numpy
Represents a single DH parameter set for a robot joint/link.
class DHParameter:
def __init__(self, theta, d, a, alpha):
self.theta = theta
self.d = d
self.a = a
self.alpha = alpha
Computes the transformation matrix for given DH parameters.
def dh_transformation_matrix(theta, d, a, alpha):
return np.array([
[np.cos(theta), -np.sin(theta)*np.cos(alpha), np.sin(theta)*np.sin(alpha), a*np.cos(theta)],
[np.sin(theta), np.cos(theta)*np.cos(alpha), -np.cos(theta)*np.sin(alpha), a*np.sin(theta)],
[0, np.sin(alpha), np.cos(alpha), d],
[0, 0, 0, 1]
])
Takes a list of DHParameter
objects and computes the overall transformation matrix from the base frame to the end-effector frame.
def forward_kinematics(dh_parameters):
T = np.eye(4)
for param in dh_parameters:
T_i = dh_transformation_matrix(param.theta, param.d, param.a, param.alpha)
T = np.dot(T, T_i)
return T
Define DH parameters for a simple 2-DOF robot arm and calculate the transformation matrix.
import numpy as np
from kinematics import DHParameter, forward_kinematics
# Define DH parameters for a simple 2-DOF robot arm
dh_params = [
DHParameter(np.radians(45), 1, 1, np.radians(90)),
DHParameter(np.radians(30), 0, 1, 0)
]
# Calculate forward kinematics
T = forward_kinematics(dh_params)
print("Transformation matrix from base to end-effector:")
print(T)
The transformation matrix from the base to the end-effector will be printed. This matrix describes the position and orientation of the end-effector in the base frame.
from scipy.optimize import minimize
def inverse_kinematics(target_pose, dh_params, initial_guess):
def objective_function(joint_angles):
current_pose = forward_kinematics(dh_params, joint_angles)
position_error = np.linalg.norm(target_pose[:3, 3] - current_pose[:3, 3])
orientation_error = np.linalg.norm(target_pose[:3, :3] - current_pose[:3, :3])
return position_error + orientation_error
result = minimize(objective_function, initial_guess, method='BFGS')
return result.x
-
Testing:
- Test the software with various robot designs and configurations to ensure accuracy and robustness.
- Validate kinematic calculations and simulation results against known benchmarks.
-
Refinement:
- Refine the AI model based on feedback and test results.
- Optimize the simulation and visualization components for performance and usability.
Contributions are welcome! Please submit a pull request or open an issue to discuss improvements or bug fixes.
This project is licensed under the Apache 2.0 License. See the LICENSE
file for details.
For any questions or support, please contact [email protected]