This tutorial explores development on a robot that is controlled using HTTP requests.
We begin by showing an example of Python code that runs locally in your browser. Since real hardware is not needed yet, we use the special hardshare owner "test". Besides the standard Python library, other packages will be automatically installed if you import
them.
print("hola")
When the code is executed, {{ MISTY_URL }}
is replaced with the proxy URL through which commands can be sent directly to a Misty robot.
"""
Output will have the form of
charge: 99.0 %
state: Charging
"""
import requests
res = requests.get("{{ MISTY_URL }}/api/battery")
assert res.ok
payload = res.json()
print(f"charge: {payload['result']['chargePercent']*100} %")
print("state:", payload['result']['state'])