Sculli's API
Implementation
The current implementation of Sculli's API is installed on a Raspberry Pi Model 3B+ and is running as a Flask app written in Python. In order for the API to function, the Communications Agent needs to be installed and running from the same location as the API.
Users can actuate the robot by sending GET commands to the server hosting the Flask API app running on port 5000. For more information, you can reference the architecture to see the processes of the systems described in detail.
Note the current source code on GitHub does not support operation in Linux, and was modified for the Raspberry Pi Deployment to detect the Serial ports on a Linux environment. This update will be added to the main branch on GitHub soon.
Use
The main route in the API used to actuate the robot is as follows:
/<servo>/<directive>/<detail>
Servo Options
EYESV: This servo enables vertical movement of the eyes inside the skull.
EYESH: This servo enables horizontal movement of the eyes inside the skull.
JAW: This servo enables the jaw's vertical movement.
NECKPIVOT: This servo enables the neck to pivot horizontally.
Directive Options
MOVE: This directive enables servo movement to a specific position, ranging from 700 to 2100 with 1500 being the center position (ideally)
SPEED: This option enables setting the step size for each increment of each servo's movement, which allows for controlling movement speed for each individual servo.
PIN: This directive enables dynamic assignment of PIN connections for each servo, so every build of the robot does not need to use the same hard coded pin assignments for their servo wiring.
Detail Options
Detail options vary based on the directive portion of the command.
For MOVE directives: INTEGER value in the range of 1400 - 1900 (approximately depending on individual build differences)
For SPEED directives: INTEGER value between 1 and 1000. 1000 will effectively tell the servo to actuate directly to the target position with no steps in between
For PIN directives: INTEGER value between 1 and 14, corresponding with the PIN the servo is wired to on the Arduino board
Alternate Routes
An additional route for checking the status of the command can be seen that is a vestige of the previous implementation of the firmware. This feature will be re-enabled at a future time when the enhancement can be made to the firmware to accommodate it without sacrificing performance.
Examples
(using browser)
Movement Commands
http://127.0.0.1:5000/JAW/MOVE/1500
This command centers the jaw position by setting the target position to 1500.http://127.0.0.1:5000/EYESV/MOVE/1900
This command actuates the eyes to look up as much as possible.http://127.0.0.1:5000/EYESH/MOVE/1300
This command actuates the eyes to look to the left side as much as possible.http://127.0.0.1:5000/NECKPIVOT/MOVE/1500
This command centers the neck and head position by setting the target position to 1500.
Speed Commands
http://127.0.0.1:5000/JAW/SPEED/25
This command sets the JAW servo speed to 25http://127.0.0.1:5000/EYESV/SPEED/100
This command sets the EYESVERTICAL servo speed to 100http://127.0.0.1:5000/EYESH/SPEED/1300
This command sets the EYESHORIZONTAL servo speed to 1300http://127.0.0.1:5000/NECKPIVOT/SPEED/1
This command sets the NECKPIVOT servo speed to 1 (not recommended, 15 min).
Pin Commands
http://127.0.0.1:5000/JAW/PIN/5
Sets the PIN for the JAW servo to Pin 5 on the Arduino and reconnects the servo.http://127.0.0.1:5000/EYESV/PIN/9
Sets the PIN for the EYESVERTICAL servo to Pin 9 on the Arduino and reconnects the servo.http://127.0.0.1:5000/EYESH/PIN/7
Sets the PIN for the EYESHORIZONTAL servo to Pin 8 on the Arduino and reconnects the servo.http://127.0.0.1:5000/NECKPIVOT/PIN/3
Sets the PIN for the NECKPIVOT servo to Pin 8 on the Arduino and reconnects the servo.