Skip to content

Hasith-Dissanayake/Robot-Car-Controller-Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚙️ Robot Car Backend Proxy

A Java-based web servlet that serves as a bridge between the mobile controller and the ESP32 hardware. This component ensures that commands are correctly routed and provides a central point for managing the robot car's network configuration.

🛠️ Technical Overview

  • Language: Java 8+
  • Framework: Java EE Servlet API
  • JSON Handler: GSON (Google)
  • Deployment: Apache Tomcat / NetBeans

🚀 Why a Proxy?

  • Network Abstracton: Allows the mobile app to communicate with a fixed server URL (or ngrok) without worrying about the ESP32's local IP changes.
  • Security: Adds a layer of control between the external internet and your local IoT hardware.
  • Scalability: Easily add logging, authentication, or multi-car support in the future.

🛠️ Setup Instructions

Prerequisites

  • Java JDK 8 or higher
  • Apache Tomcat (or any Servlet container)
  • NetBeans IDE (Recommended for easy deployment)
  • GSON Library (Included in lib/)

Configuration

  1. Open the project in NetBeans.
  2. Locate src/java/controller/RobotCar.java.
  3. Update the ESP32_URL constant with your ESP32's actual IP address:
    private static final String ESP32_URL = "http://192.168.x.x/control";

Deployment

  1. Right-click the project in NetBeans and select Clean and Build.
  2. Select Run. This will typically deploy the project to your local Tomcat server.
  3. The servlet will be available at: http://localhost:8080/RobotCarControllerBackend/control

📡 API Endpoints

POST /control

Used by the mobile app to send commands.

  • Parameters: cmd (String) - e.g., F, B, L, R, S.
  • Response: JSON object indicating success or failure.
    { "status": "success" }

GET /control

Used to verify that the servlet is running.

  • Response: Plain text status message.

📦 Dependencies

  • GSON: Used for JSON response generation.
  • Java Servlet API: Core web functionality.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors