A JavaFX application that simulates the Forward Kinematics of a 2-Degree-of-Freedom (2-DOF) SCARA robot arm. This project demonstrates the use of Homogeneous Transformation Matrices (HTM) to calculate joint positions and end-effector coordinates based on user-defined link lengths and joint angles.
- Overview
- Mathematical Logic
- Features
- Prerequisites
- Installation & Setup Guide
- Troubleshooting
- Contributing
This project was developed for a Robotic System Development course (CSC4702) at the University level. It provides an interactive visualization of a planar robot arm with two revolute joints operating in 2D space.
The application demonstrates fundamental concepts in robotics:
- Forward Kinematics: Computing end-effector position from joint angles
- Homogeneous Transformation Matrices: Mathematical framework for coordinate transformations
- Real-time Simulation: Dynamic visualization of robot configurations
Users can input geometric parameters (link lengths
The core of this simulation relies on Forward Kinematics using Homogeneous Transformation Matrices.
Given a frame
Where the transformation matrix
-
Base Transformation (
$T_1$ ): Rotation of Joint 1 ($q_1$ ) relative to the fixed base frame. -
Intermediate Transformation (
$T_{1 \to 2}$ ): Translation along link$a_1$ followed by rotation of Joint 2 ($q_2$ ). -
Global Transformation (
$T_{Global}$ ): Computed by matrix multiplication:$$T_{Global} = T_1 \cdot T_{1 \to 2}$$ -
End-Effector Position: The final coordinate is found by multiplying the global transformation matrix by the local end-effector vector
$[a_2, 0, 1]^T$ .
- 🎛️ Dynamic Inputs: Adjustable link lengths (
$a_1, a_2$ ) and joint angles ($q_1, q_2$ ) via text fields - 🎨 Real-time Visualization: Interactive drawing of links, joints, and end-effector position using JavaFX Canvas
- 🧮 Matrix Implementation: Custom matrix multiplication logic handles the transformation chain
- 🔄 Reverse Motion Animation: Smooth animation showing the arm returning to its home position (0°, 0°)
- 📐 Coordinate Display: Shows calculated X and Y coordinates of the end-effector
- 🖱️ User-friendly Interface: Clean GUI with labeled inputs and visual feedback
To avoid version conflicts (like "Unsupported class file major version"), you must use a compatible JDK.
- Java Development Kit (JDK) 21 (LTS Recommended)
⚠️ Warning: Do not use Java 24 or newer, as it is currently incompatible with standard Gradle builds and may cause "version 68" class file errors. - IntelliJ IDEA (Community or Ultimate Edition)
- Gradle (Bundled with the project, no separate installation needed)
Open your terminal or Git Bash and run:
git clone https://github.com/Nitezio/SCARAKinematicsApp.git
cd SCARAKinematicsApp- Open IntelliJ IDEA.
- Select File > Open and navigate to the
SCARAKinematicsAppfolder. - Important: When prompted, choose "Load Gradle Project" or "Trust Project".
Most build errors happen here. Follow this step carefully to prevent build failures.
- In IntelliJ, go to Settings (Windows:
Ctrl+Alt+S, Mac:Cmd+,). - Navigate to Build, Execution, Deployment > Build Tools > Gradle.
- Look for Gradle JVM at the bottom of the settings panel.
- Ensure it is set to Java 21.
- If it says "Java 24" or isn't available:
- Click the dropdown menu
- Select Download JDK...
- Choose Version 21 (any vendor: Oracle OpenJDK, Amazon Corretto, etc.)
- Click Download
- If it says "Java 24" or isn't available:
- Click Apply and OK.
- Look for the Gradle tab on the right sidebar of IntelliJ.
- Click the Reload All Gradle Projects icon (🔄 elephant with circular arrows).
- Wait for the sync to complete (status bar at the bottom will show progress).
- In the Project Explorer, navigate to:
src/main/java/org/example/scarakinematicsapp/ - Right-click on
Launcher.java(NOTSCARAKinematicsApp.java) - Select Run 'Launcher.main()'
💡 Why Launcher? JavaFX requires a module workaround. Running the App class directly will cause a "Runtime components missing" error. The Launcher class bypasses this requirement by using a non-Application entry point.
| Error Message | Solution |
|---|---|
| "JavaFX runtime components are missing" | You are likely running SCARAKinematicsApp.java. Stop and run Launcher.java instead. |
| "Unsupported class file major version 68" | You are using Java 24. Go to Settings > Build Tools > Gradle and change Gradle JVM to Java 21. Then reload the Gradle project. |
| "Reference to undefined variable" | Click the Reload All Gradle Projects icon (🔄) in the Gradle sidebar to re-sync dependencies. |
| "Module not found: javafx.controls" | Gradle dependencies not loaded. Go to File > Invalidate Caches > Check "Clear file system cache and Local History" > Invalidate and Restart. |
| Blank window or no drawing appears | Check the console for errors. Ensure all input fields have valid numeric values. Try resizing the window to trigger a redraw. |
- Clean and rebuild: Go to Build > Clean Project, then Build > Rebuild Project
- Delete build cache: Close IntelliJ, delete the
.gradleandbuildfolders in your project directory, then reopen and sync - Verify Java version: Run
java -versionin terminal to confirm JDK 21 is installed system-wide
Contributions are welcome! If you'd like to contribute to this project:
- Fork this repository by clicking the "Fork" button at the top right
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/SCARAKinematicsApp.git cd SCARAKinematicsApp - Create a new branch for your feature:
git checkout -b feature-name
- Make your changes and commit them with descriptive messages:
git add . git commit -m 'Add feature: description of your changes'
- Push to your fork:
git push origin feature-name
- Open a Pull Request on the original repository:
- Go to the original repo on GitHub
- Click "Pull Requests" > "New Pull Request"
- Select your fork and branch
- Describe your changes and submit
- ✅ Write clear, commented code
- ✅ Follow existing code style and structure
- ✅ Test your changes before submitting
- ✅ Update documentation if you add new features
- ✅ Be respectful and constructive in discussions
- Developed as part of CSC4702: Robotic System Development coursework
- Special thanks to the course instructor and teaching assistants
- Built with JavaFX for modern GUI development
- Mathematical foundations based on standard robotics textbooks (Craig, Spong, etc.)
If you have questions, suggestions, or find any issues:
If you found this project helpful, consider giving it a ⭐ star!
Made with ❤️ for robotics education