RyanZotti / Self-Driving-Car

1.02k stars 327 forks source link

REST API #110

Closed innat closed 2 years ago

innat commented 6 years ago

I'm facing some problem to use it on RPi , Can you please suggest me how to implement Restful Api on Raspberry Pi ? This is my first time i use REST API and implementing it on RPi and it's making some confusion to me.

RyanZotti commented 6 years ago

@innat-2k14 I use the REST API to send commands to the car. You can find the exact code here: https://github.com/RyanZotti/Self-Driving-Car/blob/master/drive_api.py

The way I have written the code is probably not easy to understand, and there is no doubt I could have designed it better somehow. My web server has three APIs in the same script: 1) hosts a super basic html page with javascript to accept commands, i.e., arrow keys, from the user 2) accepts data from the javascript API caller from (1) and converts the data to commands that the car understands, and 3) sorts through all of the tracked commands and writes them to a file.