A comprehensive Python application for controlling and simulating the ROT3U robotic arm, featuring forward/inverse kinematics, trajectory planning, and real-time visualization.
- β Forward Kinematics: Calculate end-effector position from joint angles
- β Inverse Kinematics: Calculate joint angles from target positions
- β Real-time Visualization: 2D plotting of robot configurations
- β Arduino Integration: Hardware control and communication
- β Trajectory Planning: Smooth path generation between waypoints
- β Modern GUI: User-friendly interface built with CustomTkinter
- β Workspace Analysis: Reachability and collision detection
- β Multiple Solutions: Elbow-up and elbow-down configurations
- Python 3.8 or higher
- pip (Python package installer)
- NumPy (numerical computations)
- Matplotlib (visualization)
- CustomTkinter (modern GUI)
- PySerial (Arduino communication)
- roboticstoolbox-python (advanced trajectory planning - fallback available)
- spatialmath-python (3D spatial transformations)
- OpenCV (computer vision features)
- Jupyter notebook (development environment)
- ROT3U Robotic Arm
- 6x Servo Motors (5-DOF + 1 gripper)
- Arduino Uno or compatible
- USB cable for Arduino connection
- Power supply for servos
-
Clone the repository:
git clone https://github.com/jaysh/5-1DOF_kinematics.git cd 5-1DOF_kinematics
-
Install Python dependencies:
Option A - Minimal installation (recommended):
pip install -r requirements_minimal.txt
Option B - Full installation with optional features:
pip install -r requirements.txt
Note: The minimal installation includes only essential dependencies. Optional dependencies in
requirements.txt
are commented out - uncomment them if you need advanced features like roboticstoolbox. -
Run the application:
python code/main.py
cd code
python main.py
For help and command-line options:
python main.py --help
The application provides three main tabs:
- Input: Joint angles in degrees for each servo
- Output: End-effector position (X, Y, Z) in centimeters
- Features:
- Real-time angle validation
- Joint limit indicators
- Workspace information
- Input: Target position (X, Y, Z) and orientation (Phi)
- Output: Required joint angles with visualization
- Features:
- Multiple solution display
- Forward kinematics verification
- 2D robot arm plotting
- Reachability checking
- Configuration: COM port, baud rate, servo mode
- Arduino Communication: Connection management
- Servo Modes: Sequential or simultaneous movement
-
Arduino Wiring:
- Connect servos to Arduino PWM pins
- Ensure proper power supply for servos
- Upload compatible firmware to Arduino
-
Communication Settings:
- Linux: Default port
/dev/ttyACM0
- Windows: Use
COM3
,COM4
, etc. - Baud Rate: 9600 (default)
- Linux: Default port
-
Servo Configuration:
- Joint limits are predefined but can be modified
- Servo angles range from 0Β° to 180Β°
- Link 1 (Shoulder to Elbow): 10.5 cm
- Link 2 (Elbow to Wrist): 10.0 cm
- Link 3 (Wrist to End-Effector): 16.8 cm
Joint | Name | Range (degrees) |
---|---|---|
0 | Base Rotation | 0Β° - 180Β° |
1 | Shoulder Pitch | 0Β° - 180Β° |
2 | Elbow Pitch | 0Β° - 180Β° |
3 | Wrist Pitch | 0Β° - 150Β° |
4 | Wrist Roll | 0Β° - 180Β° |
5 | Gripper | 0Β° - 180Β° |
- Maximum Reach: ~37.3 cm
- Minimum Reach: ~0.5 cm
- Working Height: -37.3 cm to +37.3 cm
5-1DOF_kinematics/
βββ code/ # Main application code
β βββ kinematics/
β β βββ __init__.py
β β βββ Kinematics.py # Core kinematics algorithms
β βββ GUI/
β β βββ __init__.py
β β βββ gui.py # Main GUI application
β β βββ functions.py # GUI support functions
β β βββ responses.py # Error messages
β βββ Module3.py # Trajectory generation utilities
β βββ main.py # Application entry point
β βββ robot.ipynb # Jupyter notebook for analysis
βββ src/ # Arduino firmware
β βββ testCode.cpp # Arduino control code
βββ docs/ # Documentation
βββ testdata/ # Test data and examples
βββ requirements.txt # Python dependencies
βββ README.md # This file
The project follows a modular architecture:
Kinematics.py
: Core robotics algorithms with DH parametersgui.py
: Modern GUI using CustomTkinterModule3.py
: Trajectory planning and utility functionsfunctions.py
: Arduino communication and validation
from kinematics.Kinematics import Kinematic
# Initialize kinematics
robot = Kinematic()
# Forward kinematics
joint_angles = [0, 45, 90, 45, 0, 0] # degrees
transform = robot.forward_kinematics([math.radians(a) for a in joint_angles])
# Inverse kinematics
target_pos = [15, 0, 20] # cm
solutions = robot.inverse_kinematics(target_pos)
Run the Jupyter notebook for interactive testing:
jupyter notebook code/robot.ipynb
angle1,angle2,angle3,angle4,angle5,angle6,mode\n
- angles: Servo angles in degrees
- mode:
s
for sequential,c
for concurrent movement
90,45,135,90,0,45,s\n # Sequential movement
0,90,90,45,180,0,c\n # Concurrent movement
STOP\n # Emergency stop
STATUS\n # Request status
This project is excellent for learning:
- Robotics Fundamentals: Forward/inverse kinematics, DH parameters
- Python Programming: GUI development, scientific computing
- Mathematics: Linear algebra, trigonometry, coordinate transformations
- Hardware Integration: Arduino programming, servo control
- Robotics courses and laboratories
- Control systems education
- Computer science projects
- Engineering design challenges
-
Import Errors
pip install -r requirements.txt
-
Arduino Connection Failed
- Check COM port in Settings tab
- Verify Arduino is connected and powered
- Ensure correct drivers are installed
-
No Solution Found
- Target position may be outside workspace
- Check joint limits and constraints
- Try different orientations (phi angle)
-
GUI Display Issues
- Update graphics drivers
- Try different matplotlib backends
- Check display scaling settings
Enable verbose logging by modifying main.py
:
import logging
logging.basicConfig(level=logging.DEBUG)
- Denavit-Hartenberg Parameters
- Inverse Kinematics Methods
- Robotics Toolbox Documentation
- ROT3U Design Files
- Lead Developer & Project Manager -Jaysh Khan
- Mathematical Implementation and testing - Zain ul Abideen, Syed Furqan Ali,Rana Talal Ahmed
This project is open source. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- 3D visualization improvements
- Additional trajectory planning algorithms
- Mobile app development
- Advanced collision detection
- Machine learning integration
- Documentation improvements
- 3D Visualization: Full 3D robot model rendering
- Simulation: Virtual robot environment
- Path Planning: Obstacle avoidance algorithms
- ROS Integration: Robot Operating System compatibility
- Computer Vision: Camera-based control
- Machine Learning: Automated trajectory optimization
Happy Coding! π
For questions or support, please open an issue on GitHub or contact the development team.