meldogdo/RoboNav
RoboNav enables intelligent task execution and navigation for autonomous service robots in hospitality, retail, and logistics. It integrates a Flask-based server, mobile app, and Node.js backend for real-time task management, secure authentication, and multi-robot coordination. Developed under Professor Yili Tang at Western University.
RoboNav: Intelligent Robot Navigation & Task Automation
Overview
RoboNav is an intelligent task execution and navigation system designed to enhance the efficiency of autonomous service robots used in hospitality, retail, and logistics. The project builds upon an existing infrastructure where commercial robots (e.g., OrionStar and other service robots) feature built-in Android-based control systems that communicate with an existing Flask-based web application hosted on an external server with a database backend.
As part of our capstone project at Western University, RoboNav introduces:
- A mobile application for assigning tasks, queuing navigation requests, and monitoring robot activity.
- A dedicated Node.js backend service that acts as a bridge between the mobile app and the Flask-based system, ensuring real-time synchronization, secure task execution, and seamless data flow.
- Automated task execution and multi-robot coordination for optimized navigation and workload distribution in high-traffic environments.
By integrating with the Flask-based server, RoboNav ensures efficient communication between the mobile app, robots, and web-based control interface, improving overall operational efficiency across multiple locations.
This project is developed under the supervision of Professor Yili Tang at Western University.
Technologies Used
Backend:
- Server:
Node.jswithExpress.jsfor handling API requests. - Database:
MySQLfor data storage, managed withmysql2. - Authentication:
JWT (JSON Web Token)for secure user authentication, with password hashing viabcrypt. - Email Services:
Nodemailerfor sending registration confirmation and password reset emails. - Logging:
Winstonfor structured logging and error tracking. - Development Tools:
Nodemonfor live server reloading during development.Kill-Portfor freeing up ports before restarting the server.
Frontend
- Framework:
Android (Java, XML)– Native Android development using Java with XML for UI layouts. - Networking:
Volley– Handles API requests and responses efficiently. - UI Components:
EditText,TextView,RecyclerView,Toasts– Standard Android UI elements for user interaction. - Authentication:
JWT (JSON Web Token)– Token-based authentication retrieved from the backend and securely stored usingEncryptedSharedPreferences. - Error Handling: Custom error messages parsed from API responses for better UX.
- Dependency Management:
Gradle– Handles third-party libraries and project configurations. - JSON Parsing:
org.json– Parses API responses into structured data.
Project Structure
│── /backend
│ │── /config
│ │ │── auth.js # OAuth2 and JWT configuration
│ │ │── db.js # MySQL database connection setup
│ │
│ │── /controllers
│ │ │── authController.js # Handles user authentication (register, login, password reset)
│ │ │── robotController.js # Manages robot tasks, locations, and instructions
│ │
│ │── /database
│ │ │── backup.sql # Backup database provided by professor
│ │ │── init.sql # Initial database schema and setup script
│ │
│ │── /logs
│ │ │── app.log # Application logs (generated automatically)
│ │
│ │── /middleware
│ │ │── authMiddleware.js # Middleware for JWT authentication
│ │
│ │── /routes
│ │ │── authRoutes.js # Defines routes for authentication endpoints
│ │ │── robotRoutes.js # Defines routes for robot management and tasks
│ │
│ │── /utils
│ │ │── logger.js # Winston logger configuration for structured logging
│ │
│ │── .env # Environment variables for sensitive configurations
│ │── .gitignore # Specifies files to exclude from version control
│ │── app.js # Express application setup and middleware configuration
│ │── index.js # Main server entry point
│ │── nodemon.json # Nodemon settings for auto-restart and port cleanup
│ │── package.json # Project dependencies and scripts
│
│── /frontend
│ │── /app/src/main/java/com/robonav/app
│ │ ├── activities/ # App screens for navigation & user interaction
│ │ │ ├── ChangePasswordActivity # Allows users to change their password
│ │ │ ├── CreateRobotActivity # Screen to register a new robot
│ │ │ ├── CreateTaskActivity # Screen to create tasks for robots
│ │ │ ├── ForgotPasswordActivity # Handles password reset requests
│ │ │ ├── HomeActivity # Initial login screen
│ │ │ ├── MainActivity # Main dashboard containing navigation
│ │ │ ├── ResetPasswordActivity # Handles resetting password after verification
│ │ │ ├── SignUpActivity # User registration screen
│ │ │
│ │ ├── adapters/ # Custom adapters for mapping backend data to UI components
│ │ │ ├── RobotAdapter # Handles displaying robots in lists/RecyclerView
│ │ │ ├── TaskAdapter # Handles displaying tasks in lists/RecyclerView
│ │ │
│ │ ├── fragments/ # Modular UI components for navigation & content
│ │ │ ├── HomeFragment # Displays main home dashboard functionality
│ │ │ ├── NavigationFragment # Manages navigation controls & UI
│ │ │ ├── UtilitiesFragment # Contains additional user tools & features
│ │ │
│ │ ├── interfaces/ # Event listeners for UI updates
│ │ │ ├── OnUpdateListener # Handles updating data on specific events
│ │ │
│ │ ├── models/ # Data models representing API responses
│ │ │ ├── Robot # Defines robot structure as a Java object
│ │ │ ├── Task # Defines task structure as a Java object
│ │ │
│ │ ├── utilities/ # Helper functions for various app features
│ │ │ ├── ConfigManager # Reads `config.properties` for backend URL & settings
│ │ │ ├── FragmentUtils # Manages fragment transitions & UI functions
│ │ │ ├── JsonUtils # Converts JSON API responses into Java models
│ │ │ ├── VolleySingleton # Ensures single API request instance when needed
│ │
│ │── /app/src/main/res/layout/ # XML UI layouts for activities & fragments
│ │── /app/src/main/res/drawable/ # Image assets (icons, backgrounds, etc.)
│ │── /app/src/main/assets/config.properties # Backend server IP, port, and protocol (HTTP/HTTPS)
│
│ │── AndroidManifest.xml # Defines app permissions, activities, and services
│ │── build.gradle # Gradle dependencies and project configurations
│ │── settings.gradle # Project-level Gradle settings
│
│── README.md # This documentation
Backend API
Installation & Setup
1. Clone the Repository
git clone https://github.com/meldogdo/RoboNav.git
cd RoboNav/backend2. Install Dependencies
npm installOr use:
npm run prestartThis will automatically install dependencies before starting the server.
3. Set Up Environment Variables
Create a .env file in the /backend directory and configure:
# Database Configuration
DB_HOST= # Database hostname or IP (default: localhost)
DB_PORT= # Database port (default: 3306 for MySQL)
DB_USER= # Database username
DB_PASSWORD= # Database password
DB_NAME= # Name of the database
# Server Configuration
SERVER_HOST= # Server host (default: 127.0.0.1 for local)
SERVER_PORT= # Port for the backend server (default: 8080)
# Authentication Configuration
JWT_SECRET= # Secret key for signing JWT tokens
# Email Configuration
EMAIL_USER= # Email used for sending registration & password reset emails
CLIENT_ID= # OAuth2 Client ID from Google Cloud Console
CLIENT_SECRET= # OAuth2 Client Secret from Google Cloud Console
REFRESH_TOKEN= # OAuth2 Refresh Token from Google OAuth Playground (for Gmail API)4. Start the Backend Server
Development Mode (Auto-restart with Nodemon)
npm run devProduction Mode
npm startAPI Endpoints
Authentication Routes
POST /api/open/users/register→ Register a new userGET /api/open/users/confirm-email→ Confirm user email via tokenPOST /api/open/users/login→ Authenticate user and return JWTPOST /api/open/users/request-reset→ Request a password reset emailPOST /api/open/users/verify-reset→ Verify reset code before setting a new passwordPOST /api/protected/users/reset-password→ Reset password (JWT required)POST /api/protected/users/change-password→ Change password (JWT required)
Robot Routes (Protected)
GET /api/protected/robot/tasks→ Retrieve all robot tasksPOST /api/protected/robot/task/create→ Create a new robot taskDELETE /api/protected/robot/task/:taskId/delete→ Delete a robot taskPOST /api/protected/robot/task/:taskId/start→ Start a robot taskPOST /api/protected/robot/task/:taskId/stop→ Stop a running robot taskPOST /api/protected/robot/task/:taskId/resume→ Resume a stopped robot taskPOST /api/protected/robot/task/instruction→ Add an instruction to a task
Robot Management Routes (Protected)
GET /api/protected/robot/robots→ List all registered robotsPOST /api/protected/robot/create→ Register a new robotDELETE /api/protected/robot/:robotId/delete→ Remove a robot from the systemGET /api/protected/robot/:robotId/location→ Retrieve the latest location of a robot
Location & Position Routes (Protected)
GET /api/protected/robot/:robotId/position→ Retrieve the last recorded position of a robotPOST /api/protected/robot/save-current-position→ Save the robot’s current positionDELETE /api/protected/location/:locId→ Remove a saved location by IDGET /api/protected/robot/location/:locId→ Get coordinates by location IDGET /api/protected/robot/:robotId/locations→ List all locations assigned to a robotGET /api/protected/robot/locations→ Retrieve all saved locations
Robot Callback & Instruction Routes (Protected)
GET /api/protected/robot/callbacks→ Retrieve the 25 most recent callback events from all robots.GET /api/protected/robot/callbacks?robotId={robotId}→ Retrieve the 25 most recent callback events for a specific robot (robotIdis required).GET /api/protected/robot/instructions→ Retrieve the 25 most recent instructions sent to all robots.GET /api/protected/robot/instructions?robotId={robotId}→ Retrieve the 25 most recent instructions for a specific robot (robotIdis required).
Logging & Error Handling
The project uses Winston for structured logging to track application events and errors.
- Logs are stored in
/backend/logs/app.log. - Both console logging and file logging are enabled.
- Errors and important events are recorded for debugging and monitoring.
Error Handling
The backend includes structured error handling to ensure stability and meaningful API responses:
- Consistent Error Responses: API errors follow a standardized format with HTTP status codes.
- Database & Query Errors: Logged and handled gracefully to avoid system crashes.
- Unhandled Exceptions: Caught by a global error handler to prevent app failures.
- Authentication Errors: Unauthorized requests return proper
401or403responses.
Frontend (Android App)
Installation & Setup
1. Clone the Repository
git clone https://github.com/meldogdo/RoboNav.git
cd RoboNav/frontend2. Open in Android Studio
- Open Android Studio.
- Select Open an Existing Project.
- Navigate to
RoboNav/frontendand open it.
3. Configure API URL
By default, the app fetches the backend URL from a configuration file:
Edit /app/src/main/res/raw/config.properties
# Backend Configuration
BACKEND_IP=10.0.2.2
BACKEND_PORT=8080
USE_HTTPS=falseBACKEND_IP→ Change this to match your backend server's IP.BACKEND_PORT→ Adjust this if your backend is running on a different port.USE_HTTPS→ Set totrueif your backend uses HTTPS.
For Local Backend on Emulator
If using an Android Emulator, keep BACKEND_IP=10.0.2.2 (this routes to localhost).
For Local Backend on a Real Device
If testing on a physical device, update BACKEND_IP to your computer's local network IP (e.g., 192.168.x.x).
4. Build & Run
- Ensure USB debugging is enabled on your Android device or use the Android Emulator.
- Click Run (
▶️ ) in Android Studio.
App Overview & Features
1. Authentication & User Management
- Login:
- The app starts with
MainActivity, which immediately opensHomeActivity(Login Screen). - Users can log in using admin/password as default credentials or create a new account.
- The app starts with
- Registration:
- Users register by providing an email, username, and password.
- A confirmation link is sent via email, and clicking it enables login.
- Forgot Password:
- Users can request a one-time password (OTP) via email if they forget their password.
- Entering the OTP logs the user in and allows them to set a new password.
- Post-Login Actions:
- Upon logging in, users are directed to
HomeFragment, where they can log out or change their password.
- Upon logging in, users are directed to
2. Home Fragment (Main Dashboard)
- Robot & Task Management:
- The HomeFragment displays two sliders: one for robots and one for tasks.
- Users can create robots or tasks using respective buttons.
- Clicking a robot or task opens a popup with actions:
- For Robots: View details and delete.
- For Tasks: Start, stop, resume, delete (depending on its current state).
- Task Details: Displays currently queued instructions, providing insight into what the robot will execute next.
- Automatic Data Refresh:
- When switching between fragments or performing CRUD operations (create, delete, update), the UI automatically refreshes.
3. Navigation Fragment (Task Execution)
- Task Selection & Navigation:
- Users select a task from a dropdown and assign locations to it.
- Tasks created in
HomeFragmentcontain only a name and robot ID (a shell task). - After selecting a task and location, users press the "Queue Navigation" button to add the location to the task’s execution queue.
- Executing a Task:
- Returning to
HomeFragment, the user can start, stop, resume, or delete a task. - Resume continues from the last recorded execution step.
- Tasks can only be deleted when completed, stopped, or not started.
- Returning to
- Instruction Output:
- An output box displays the 25 most recent instructions executed by a selected robot.
- Users can filter instructions by selecting a specific robot from the dropdown.
4. Utilities Fragment (Location Management)
- Location-Based Utilities:
UtilitiesFragmentprovides three location management tools:- Save Current Robot Location: Saves the robot’s current coordinates.
- Delete a Robot’s Locations: Remove specific stored locations.
- Get Coordinates of a Location: Retrieve GPS data for a saved location.
- System Callbacks:
- An output box displays the 25 most recent system callbacks from all robots.
- Users can filter callbacks to view the 25 most recent logs for a specific robot.
Contributors
- Christopher Higgins
- Bryson Crook
- Mohamed El Dogdog