Skip to content

DigitalTwins

Philippe Coval edited this page Oct 9, 2019 · 20 revisions

DigitalTwins (DRAFT)

Concept

PoC

TUTORIAL:

Tutorial

USAGE:

SIMULATE:

The webthing is served and can be queried using http client

git clone https://github.com/rzr/twins ; cd twins
make start

url=http://localhost:8888

curl ${url}/properties
#| {"torso":0,"shoulder":0,"arm":0,"hand":0}

curl -X PUT -d '{ "arm": 42 }' $url/properties/arm
#| {"arm":42}

VR view can be used alternatively:

cd twins/aframe
npm install
PORT=8088 npm start

Some params can be added to configure app:

Next the device can be connected to mozilla-iot Gateway

PHYSICAL:

STM32F7 based MCU is running webthing-iotjs with IoTjs for NuttX (until TizenRT is supporting this board).

More details soon:

For instance target

url=http://192.100.0.243:8888
curl -X PUT -d '{ "arm": 42 }' $url/properties/arm
curl -X PUT -d '{ "arm": -42 }' $url/properties/arm

GATEWAY / Remote Access:

Once connected to mozilla gateway it can be controlled from the Web UI, or curl commands using JWT issued from security menu.

bearer='eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjQxNjFiY2M4LTg2MTgtNGZhNy1iNDFhLTgwNGMyZjJjY2JlZiJ9.eyJjbGllbnRfaWQiOiJsb2NhbC10b2tlbiIsInJvbGUiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZSI6Ii90aGluZ3M6cmVhZHdyaXRlIiwiaWF0IjoxNTYyMTYxNzI0LCJpc3MiOiJodHRwczovL3Nvc2cubW96aWxsYS1pb3Qub3JnIn0.Qvya9ozJo4VogfEDL0Gs1EFQhe_DgFp_2GICmOk-swTjGbFzpOFyo5DMDEJF2qu5NT5zq0AHig5l_ktT7fP5Ig'
curl_args="-H \"Authorization: Bearer $bearer\""

url='https://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-'

make demo curl_args="$curl_args" target_url="$url"

VR view can be used alternatively:

cd twins/aframe
npm install
PORT=8088 npm start

Websockets can be also used:

Some settings should be set:

url:
https://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-
wsUrl:
wss://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-
bearer:
eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjQxNjFiY2M4LTg2MTgtNGZhNy1iNDFhLTgwNGMyZjJjY2JlZiJ9.eyJjbGllbnRfaWQiOiJsb2NhbC10b2tlbiIsInJvbGUiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZSI6Ii90aGluZ3M6cmVhZHdyaXRlIiwiaWF0IjoxNTYyMTYxNzI0LCJpc3MiOiJodHRwczovL3Nvc2cubW96aWxsYS1pb3Qub3JnIn0.Qvya9ozJo4VogfEDL0Gs1EFQhe_DgFp_2GICmOk-swTjGbFzpOFyo5DMDEJF2qu5NT5zq0AHig5l_ktT7fP5Ig

CLOUD:

For development purposes app can run in cloud.

url=https://twins.glitch.me
curl -X PUT -d '{ "arm": 42 }' $url/properties/arm

Then twin can be visualized using:

DEVEL:

I think this one is a good entry door, tell me if you’re able to replicate:

Once you have replicated the earlier example, this one is good about XR binding:

Last one about the REST API to define abstract things and deal with I/O (sensors etc):

For your curiosity other related subprojects, once you’re comfortable with ones I just mentioned above.

Good luck

MORE:

LICENSE: CC-BY-SA-4.0

INDEX

Clone this wiki locally