Difference between revisions of "Rest api"
m (add link to tutorial) |
(→/data/relayarray) |
||
(18 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
|- | |- | ||
|[[Image:Robotino_rest_icon_64.png]] | |[[Image:Robotino_rest_icon_64.png]] | ||
− | |With the latest robotino-daemons package Robotino's web-interface is based on a Restful server listening at port 80 on Robotino. The server not only makes data available to Robotino's web interface but can also be used to access Robotino's sensors and actors. | + | |With the latest robotino-daemons package Robotino's web-interface is based on a Restful server listening at port 80 on Robotino. The server not only makes data available to Robotino's web interface but can also be used to access Robotino's sensors and actors. Rest Api is part of all images from V4 and later. |
− | |||
|} | |} | ||
Line 14: | Line 13: | ||
<pre> | <pre> | ||
img=webread('http://192.168.0.1/cam0') | img=webread('http://192.168.0.1/cam0') | ||
+ | imshow(img) | ||
+ | </pre> | ||
+ | |||
+ | ===/sensorimage=== | ||
+ | Get image showing distance sensors and bumper. The response is image/png. | ||
+ | ====Matlab example==== | ||
+ | <pre> | ||
+ | img=webread('http://192.168.0.1/sensorimage') | ||
imshow(img) | imshow(img) | ||
</pre> | </pre> | ||
Line 41: | Line 48: | ||
Data of all analog inputs. | Data of all analog inputs. | ||
<pre> | <pre> | ||
− | |||
[val0,val1,val2,...,val7] | [val0,val1,val2,...,val7] | ||
− | |||
</pre> | </pre> | ||
Line 49: | Line 54: | ||
Data of all digital inputs. | Data of all digital inputs. | ||
<pre> | <pre> | ||
− | |||
[val0,val1,val2,...,val7] | [val0,val1,val2,...,val7] | ||
− | + | </pre> | |
+ | values being true or false | ||
+ | |||
+ | ===/data/digitaloutputstatus=== | ||
+ | Status of all digital outputs. | ||
+ | <pre> | ||
+ | [val0,val1,val2,...,val7] | ||
+ | </pre> | ||
+ | values being true or false | ||
+ | |||
+ | ===/data/relaystatus=== | ||
+ | Status of all relays. | ||
+ | <pre> | ||
+ | [val0,val1] | ||
</pre> | </pre> | ||
values being true or false | values being true or false | ||
Line 58: | Line 75: | ||
Status of Robotinos bumper | Status of Robotinos bumper | ||
<pre> | <pre> | ||
− | |||
"value" : value | "value" : value | ||
− | |||
</pre> | </pre> | ||
value being true or false. | value being true or false. | ||
Line 67: | Line 82: | ||
Readings from Robotinos distance sensors | Readings from Robotinos distance sensors | ||
<pre> | <pre> | ||
− | |||
[val1,val2,...,val9] | [val1,val2,...,val9] | ||
− | |||
</pre> | </pre> | ||
===/data/scan0=== | ===/data/scan0=== | ||
− | Data of the first Laser | + | Data of the first Laser rangefinder. |
<pre> | <pre> | ||
{ | { | ||
Line 93: | Line 106: | ||
Robotino's odometry. | Robotino's odometry. | ||
<pre> | <pre> | ||
− | |||
[x,y,rot,vx,vy,omega,seq] | [x,y,rot,vx,vy,omega,seq] | ||
− | |||
x : x position in m | x : x position in m | ||
Line 104: | Line 115: | ||
omega : rot vel in rad/s | omega : rot vel in rad/s | ||
seq : sequence number | seq : sequence number | ||
+ | </pre> | ||
+ | |||
+ | ===/data/imageversion=== | ||
+ | Get version of Robotino's OS image. | ||
+ | <pre> | ||
+ | { | ||
+ | "version" : "imagever" | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ===/data/poweroutputcurrent=== | ||
+ | Get current in A from Robotino's power output (motor4) | ||
+ | <pre> | ||
+ | { | ||
+ | "current" : value | ||
+ | } | ||
</pre> | </pre> | ||
Line 111: | Line 138: | ||
Set forwward and rotational velocity. You have to send data periodically at least every 200ms. If no data is received for more than 200ms Robotino will stop. | Set forwward and rotational velocity. You have to send data periodically at least every 200ms. If no data is received for more than 200ms Robotino will stop. | ||
<pre> | <pre> | ||
− | |||
[vx,vy,omega] | [vx,vy,omega] | ||
− | |||
vx : x-vel in m/s" | vx : x-vel in m/s" | ||
Line 121: | Line 146: | ||
====Matlab example==== | ====Matlab example==== | ||
<pre>webwrite('http://192.168.1.192/data/omnidrive',[vx vy omega])</pre> | <pre>webwrite('http://192.168.1.192/data/omnidrive',[vx vy omega])</pre> | ||
+ | |||
+ | ===/data/digitaloutput=== | ||
+ | <pre> | ||
+ | { | ||
+ | "num" : NUM , | ||
+ | "val" : VAL | ||
+ | } | ||
+ | </pre> | ||
+ | NUM in range [0,7] and val being true or false | ||
===/data/digitaloutputarray=== | ===/data/digitaloutputarray=== | ||
+ | <pre> | ||
+ | [val0,val1,....val7] | ||
+ | </pre> | ||
+ | value being true or false | ||
+ | |||
+ | ===/data/relay=== | ||
<pre> | <pre> | ||
{ | { | ||
− | + | "num" : NUM , | |
+ | "val" : VAL | ||
} | } | ||
</pre> | </pre> | ||
− | + | NUM in range [0,1] and VAL being true or false | |
===/data/relayarray=== | ===/data/relayarray=== | ||
+ | <pre> | ||
+ | [val0,val1] | ||
+ | </pre> | ||
+ | val0,val1 being false or true | ||
+ | |||
+ | ===/data/poweroutput=== | ||
<pre> | <pre> | ||
{ | { | ||
− | + | "value" : value | |
} | } | ||
</pre> | </pre> | ||
− | + | value in the range -100 to 100 | |
===/data/uploadProgram=== | ===/data/uploadProgram=== | ||
Upload Robotino View program to /home/robotino/programs. | Upload Robotino View program to /home/robotino/programs. | ||
<pre> | <pre> | ||
− | |||
"name" : "filename with extension", | "name" : "filename with extension", | ||
"size" : size of raw (unencoded) binary data, | "size" : size of raw (unencoded) binary data, | ||
"data" : file data base64 encoded | "data" : file data base64 encoded | ||
− | |||
</pre> | </pre> | ||
'''Response''' | '''Response''' | ||
<pre> | <pre> | ||
− | |||
"message" : "message what happend on the server", | "message" : "message what happend on the server", | ||
"success" : boolean showing if operation was successfull | "success" : boolean showing if operation was successfull | ||
− | |||
</pre> | </pre> |
Latest revision as of 11:24, 23 September 2020
Contents
- 1 Introduction
- 2 GET
- 2.1 /cam0
- 2.2 /sensorimage
- 2.3 /data/festoolcharger
- 2.4 /data/powermanagement
- 2.5 /data/charger0
- 2.6 /data/charger1
- 2.7 /data/controllerinfo
- 2.8 /data/services
- 2.9 /data/servicestatus/xxx
- 2.10 /data/analoginputarray
- 2.11 /data/digitalinputarray
- 2.12 /data/digitaloutputstatus
- 2.13 /data/relaystatus
- 2.14 /data/bumper
- 2.15 /data/distancesensorarray
- 2.16 /data/scan0
- 2.17 /data/odometry
- 2.18 /data/imageversion
- 2.19 /data/poweroutputcurrent
- 3 PUT or POST
Introduction
GET
/cam0
Get camera image from cam0. The response is image/jpeg.
Matlab example
img=webread('http://192.168.0.1/cam0') imshow(img)
/sensorimage
Get image showing distance sensors and bumper. The response is image/png.
Matlab example
img=webread('http://192.168.0.1/sensorimage') imshow(img)
/data/festoolcharger
Get data from Festool Li-Ion batteries.
/data/powermanagement
Get information about voltage and system current.
/data/charger0
Data for build in charger 0
/data/charger1
Data for build in charger 1
/data/controllerinfo
HW and SW version.
/data/services
Data of Robotino specific services.
/data/servicestatus/xxx
Status of service xxx.
/data/analoginputarray
Data of all analog inputs.
[val0,val1,val2,...,val7]
/data/digitalinputarray
Data of all digital inputs.
[val0,val1,val2,...,val7]
values being true or false
/data/digitaloutputstatus
Status of all digital outputs.
[val0,val1,val2,...,val7]
values being true or false
/data/relaystatus
Status of all relays.
[val0,val1]
values being true or false
/data/bumper
Status of Robotinos bumper
"value" : value
value being true or false.
/data/distancesensorarray
Readings from Robotinos distance sensors
[val1,val2,...,val9]
/data/scan0
Data of the first Laser rangefinder.
{ "seq" : sequence number, "stamp" : time stamp, "angle_min" : minimum angle, "angle_max" : maximum angle, "angle_increment" : angle increment, "time_increment" : time increment, "scan_time" : scan time, "range_min" : minimum range, "range_max" : maximum range, "ranges" : [], "intensities" : [] }
/data/odometry
Robotino's odometry.
[x,y,rot,vx,vy,omega,seq] x : x position in m y : y position in m rot : rotation in rad vx : x vel in m/s vy : y vel in m/s omega : rot vel in rad/s seq : sequence number
/data/imageversion
Get version of Robotino's OS image.
{ "version" : "imagever" }
/data/poweroutputcurrent
Get current in A from Robotino's power output (motor4)
{ "current" : value }
PUT or POST
/data/omnidrive
Set forwward and rotational velocity. You have to send data periodically at least every 200ms. If no data is received for more than 200ms Robotino will stop.
[vx,vy,omega] vx : x-vel in m/s" vy : "y-vel in m/s" omega : rot-vel in rad/s
Matlab example
webwrite('http://192.168.1.192/data/omnidrive',[vx vy omega])
/data/digitaloutput
{ "num" : NUM , "val" : VAL }
NUM in range [0,7] and val being true or false
/data/digitaloutputarray
[val0,val1,....val7]
value being true or false
/data/relay
{ "num" : NUM , "val" : VAL }
NUM in range [0,1] and VAL being true or false
/data/relayarray
[val0,val1]
val0,val1 being false or true
/data/poweroutput
{ "value" : value }
value in the range -100 to 100
/data/uploadProgram
Upload Robotino View program to /home/robotino/programs.
"name" : "filename with extension", "size" : size of raw (unencoded) binary data, "data" : file data base64 encoded
Response
"message" : "message what happend on the server", "success" : boolean showing if operation was successfull