Difference between revisions of "Rest api"

From RobotinoWiki
(Installation)
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Installation ==
+
==Introduction==
{|cellspacing="20" cellpadding="10"
+
{|class="wikitable" cellpadding="20" vertical-align="top"
|- style="vertical-align:top"
+
|-
 
|[[Image:Robotino_rest_icon_64.png]]
 
|[[Image:Robotino_rest_icon_64.png]]
|REST-API is already running at <nowiki>http://RobotinoIP</nowiki>.
+
|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.
! style="text-align:left; width:20em; background-color:#dddddd"|
 
=== Package links ===
 
nothing to install
 
 
|}
 
|}
  
 
==GET==
 
==GET==
  
==PUT==
+
===/cam0===
 +
Get camera image from cam0. The response is image/jpeg.
 +
====Matlab example====
 +
<pre>
 +
img=webread('http://192.168.0.1/cam0')
 +
imshow(img)
 +
</pre>
 +
 
 +
===/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.
 +
<pre>
 +
{
 +
  [val0,val1,val2,...,val7]
 +
}
 +
</pre>
 +
 
 +
===/data/digitalinputarray===
 +
Data of all digital inputs.
 +
<pre>
 +
{
 +
  [val0,val1,val2,...,val7]
 +
}
 +
</pre>
 +
values being true or false
 +
 
 +
===/data/bumper===
 +
Status of Robotinos bumper
 +
<pre>
 +
{
 +
  "value" : value
 +
}
 +
</pre>
 +
value being true or false.
 +
 
 +
===/data/distancesensorarray===
 +
Readings from Robotinos distance sensors
 +
<pre>
 +
{
 +
  [val1,val2,...,val9]
 +
}
 +
</pre>
 +
 
 +
===/data/scan0===
 +
Data of the first Laser ranefinder.
 +
<pre>
 +
{
 +
  "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" : []
 +
}
 +
</pre>
 +
 
 +
===/data/odometry===
 +
Robotino's odometry.
 +
<pre>
 +
{
 +
  [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
 +
</pre>
 +
 
 +
==PUT or POST==
  
 
===/data/omnidrive===
 
===/data/omnidrive===
Line 17: Line 111:
 
<pre>
 
<pre>
 
{
 
{
   "vx": "x-vel in m/s",
+
   [vx,vy,omega]
  "vy" : "y-vel in m/s",
+
}
  "omega" : "rot-vel in rad/s"
+
 
 +
vx : x-vel in m/s"
 +
vy : "y-vel in m/s"
 +
omega : rot-vel in rad/s
 +
</pre>
 +
====Matlab example====
 +
<pre>webwrite('http://192.168.1.192/data/omnidrive',[vx vy omega])</pre>
 +
 
 +
===/data/digitaloutputarray===
 +
<pre>
 +
{
 +
  [val0,val1,....val7]
 +
}
 +
</pre>
 +
value being true or false
 +
 
 +
===/data/relayarray===
 +
<pre>
 +
{
 +
  [val0,val1]
 +
}
 +
</pre>
 +
val0,val1 being false or true
 +
 
 +
===/data/uploadProgram===
 +
Upload Robotino View program to /home/robotino/programs.
 +
<pre>
 +
{
 +
  "name" : "filename with extension",
 +
  "size" : size of raw (unencoded) binary data,
 +
  "data" : file data base64 encoded
 +
}
 +
</pre>
 +
 
 +
'''Response'''
 +
<pre>
 +
{
 +
  "message" : "message what happend on the server",
 +
  "success" : boolean showing if operation was successfull
 
}
 
}
 
</pre>
 
</pre>

Latest revision as of 13:17, 18 March 2019

Introduction

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.

GET

/cam0

Get camera image from cam0. The response is image/jpeg.

Matlab example

img=webread('http://192.168.0.1/cam0')
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/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 ranefinder.

{
  "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

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/digitaloutputarray

{
  [val0,val1,....val7]
}

value being true or false

/data/relayarray

{
  [val0,val1]
}

val0,val1 being false or true

/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
}