DigitalTwins - TizenTeam/webthing-iotjs GitHub Wiki
DigitalTwins (DRAFT)
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:
- https://github.com/pando-project/iotjs/pull/1884# (Merged)
- https://github.com/pando-project/iotjs/pull/1886# (Merged)
- https://bitbucket.org/nuttx/nuttx/pull-requests/494/generic-auto-romfs/diff
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:
- http://localhost:8088/?url=https://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-&bearer=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjQxNjFiY2M4LTg2MTgtNGZhNy1iNDFhLTgwNGMyZjJjY2JlZiJ9.eyJjbGllbnRfaWQiOiJsb2NhbC10b2tlbiIsInJvbGUiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZSI6Ii90aGluZ3M6cmVhZHdyaXRlIiwiaWF0IjoxNTYyMTYxNzI0LCJpc3MiOiJodHRwczovL3Nvc2cubW96aWxsYS1pb3Qub3JnIn0.Qvya9ozJo4VogfEDL0Gs1EFQhe_DgFp_2GICmOk-swTjGbFzpOFyo5DMDEJF2qu5NT5zq0AHig5l_ktT7fP5Ig&verbose=1&useWs=yes&wsUrl=wss://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-
- http://rzr.github.io/twins/aframe/?url=https://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-&verbose=yes&useWs=yes&wsUrl=wss://sosg.mozilla-iot.org/things/http---192.100.0.13-8888-&bearer=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjQxNjFiY2M4LTg2MTgtNGZhNy1iNDFhLTgwNGMyZjJjY2JlZiJ9.eyJjbGllbnRfaWQiOiJsb2NhbC10b2tlbiIsInJvbGUiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZSI6Ii90aGluZ3M6cmVhZHdyaXRlIiwiaWF0IjoxNTYyMTYxNzI0LCJpc3MiOiJodHRwczovL3Nvc2cubW96aWxsYS1pb3Qub3JnIn0.Qvya9ozJo4VogfEDL0Gs1EFQhe_DgFp_2GICmOk-swTjGbFzpOFyo5DMDEJF2qu5NT5zq0AHig5l_ktT7fP5Ig
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
-
http://purl.org/rzr/tmp/example Then config will stay in localstorage so direct link will work:
CLOUD:
For development purposes app can run in cloud.
url=https://twins.glitch.me
curl -X PUT -d '{ "arm": 42 }' $url/properties/arm
- http://rzr.github.io/twins/aframe/# (on HTTP)
- https://twins.glitch.me/properties
- https://glitch.com/edit/#!/twins
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.
- https://github.com/rzr/twins
- https://github.com/rzr/generic-sensors-lite
- https://github.com/rzr/webthing-go
- https://github.com/rzr/iotjs-express
- https://github.com/rzr/color-sensor-js
- https://github.com/rzr/webthings-webapp
- https://github.com/rzr/mozilla-iot-generic-sensors-adapter
- https://github.com/rzr/mastodon-lite
Good luck
MORE:
- XR Notes
- https://community.st.com/s/feed/0D50X0000ArV5ykSQC
- https://github.com/rzr/webthing-iotjs/issues/3 (Released)
- https://social.samsunginter.net/@rzr/102139995659879619
- https://sketchfab.com/3d-models/ux3d-industrial-robot-d8e8948191684a66a2f31c2e17e3481f#