Flask APIs

Introduction

The Flask API will occupy the robot and block other processes. Make sure to stop the Flask process if you need to use the robot for other tasks.

This is the flask api and backend of the command center, to launch this, navigate to the directory and run the launch script:

launch-flask-api 

If successful, you should see something similiar to this:

---------------------------------------------
STARTING HACKERBOT FLASK API
---------------------------------------------

---------------------------------------------
SUCCESS! Hackerbot Web Application is Running!
Flask Backend:  http://localhost:5000
                http://10.1.10.110:5000
Log file: /home/bobby/hackerbot/logs/hackerbot_flask_202503251849.txt
---------------------------------------------

To stop the process, run the stop script:

stop-flask-api 

You should see something like this in your console:

---------------------------------------------
STOPPING HACKERBOT FLASK API
---------------------------------------------
Stopping Flask backend (PID: 101864)...
Force killing Flask backend...
Flask backend stopped.
---------------------------------------------
CHECKING SERIAL PORT /dev/ttyACM1
---------------------------------------------
Serial port /dev/ttyACM1 is not occupied.
---------------------------------------------
HACKERBOT FLASK API STOPPED

API Reference

This section provides a reference for all RESTful endpoints used to control the Hackerbot platform. These APIs are organized by module: Core, Base, Head, and Arm.

🧪 Quick Examples

Ping the Core

curl -X POST http://<host>/api/v1/core \
  -H "Content-Type: application/json" \
  -d '{"method": "ping"}'

Start the Base

curl -X POST http://<host>/api/v1/base \
  -H "Content-Type: application/json" \
  -d '{"method": "start"}'

Drive the Robot

curl -X POST http://<host>/api/v1/base/actions \
  -H "Content-Type: application/json" \
  -d '{"linear_velocity": 0.0, "angle_velocity": 65}'

Navigation

curl -X POST http://<host>/api/v1/base/maps \
  -H "Content-Type: application/json" \
  -d '{"method": "goto", "x": 0.0, "y": 0.0, "angle": 0.0, "speed":0.4}'

Make the Robot Speak

curl -X POST http://<host>/api/v1/base \
  -H "Content-Type: application/json" \
  -d '{"method": "speak", "model_src": "en_GB-semaine-medium", "text": "Tacos!", "speaker_id": null}'

Move the head

curl -X POST http://<host>/api/v1/head \
     -H "Content-Type: application/json" \
     -d '{"method": "look", "yaw":180.0, "pitch":180.0, "speed":90}'

Last updated