Buttons for robot control
In this section, we will add implement buttons to the web interface to drive the robot.
- The first step is adding four buttons to
index.html
. We will be making use of HTML Table to add four buttons (Code snippet shortened for brevity and refer to http://www.w3schools.com/html/html_tables.asp for more information on HTML tables):
<table style="width:100%; max-width: 500px; height:300px;"> <tr> <td> <form action="/forward" method="POST"> <input type="submit" value="forward" style="float: left; width:80% ;"> </br> </form> </td> ... </table>
- In
web_interface.py
, we need to implement a method that acceptsPOST
requests from the buttons. For example, the method to accept requests from/forward
can be implemented as follows:
@app.route('/forward', methods = ['POST']) def forward...