Warning : This integration is outdated and might not work right out of the box or at all.
We are not currently officially maintaining this integration, it’s community based.
Augmenta-js
A Javascript library using Websocket
Demo
Try the live examples here
Examples
To run the examples you can click here or run them locally on a web server for local development such as Servez and open the repo’s folder.
There is two examples : a very simple one using no other librairies than this one, and a more complex example adapted from a three js example.
- Augmenta-js/Simple Example/simpleExample.html
- Augmenta-js/three js example/examples/webgl_gpgpu_bird.html
Important note :If you run AugmentaFusion and the examples on a local server (such as Servez) on the same computer you will be able to use both secure connection and regular connection. However - as AugmentaFusion is not able to send secure connection to browsers - if you want to run the examples on a different computer you will have to set your local server in http instead of https. You will also have to make sure secure connections are disabled on both client (these examples or your own example) and server (AugmentaFusion) sides. If you want to try the examples on the github page you will just have to disbale secure connections in the example interface and in AugmentaFusion (the github page is set in http by default for that matter).
Documentation
Initialize augmenta manager and open websocket connection
plain textvar augmentaManager = new AugmentaManager() augmentaManager.startAugmentaWebsocket()
Default websocket url : ws://127.0.0.1:8080.
Once the connection is opened, the augmenta manager receives and parses all the messaged from the websocket address.
Change websocket url
You can change the websocket’s address either by changing the port and/or the ip or by changing the entire url directly. The websocket connection will be automatically closed and reopened if the address is valid. Make sure the address is the same as your websocket output running in fusion.
plain textaugmentaManager.changePort(port)
plain textaugmentaManager.changeIP(ip)
plain textaugmentaManager.websocketurl = websocketurl
With
port
a number or a string, ip
a string and websocketurl
a stringplain textaugmentaManager.useSecureConnection = true
Allows you to enable or disable secure conection (by default disablbed)
Custom functions for augmenta’s event
You can change the default functions called whenever the augmenta manager receives a message or closes/opens a websocket connection.
plain textaugmentaManager.setObjectEntered(objectEntered)
plain textaugmentaManager.setObjectUpdated(objectEntered)
plain textaugmentaManager.setObjectWillLeave(objectEntered)
With
objectEntered
, objectUpdated
and objectWillLeave
javascript functions taking an instance of class AugmentaObject as only argument.plain textaugmentaManager.setWebsocketOpened(websocketOpened)
plain textaugmentaManager.setWebsocketClosed(websocketClosed)
With
websocketOpened
and websocketClosed
javascript functions taking no argument.plain textaugmentaManager.setFusionUpdated(objectEntered)
With
fusionUpdated
a javascript function taking an instance of class Fusion as only argument.Extra
You can change the time an inactive object is stored by the augmenta manager.
plain textaugmentaManager.timeOut = timeOut
With
timeOut
the number of frame an object can remain inactive before being removed from the scene.Access augmenta and fusion’s info
For instances of class
AugmentaManager
you can access :augmentaObjects
A dictionary containing all augmenta objects in the current frame of typeAugmentaObject
indexed by theiroid
.
newestObject
The youngest augmenta object of typeAugmentaObject
in the current frame
oldestObject
The oldest augmenta object of typeAugmentaObject
in the current frame
augmentaScene
The current augmenta scene of classAugmentaScene
.
fusion
An instance of classFusion
storing fusion’s informations.
For instances of class
AugmentaObject
you can access:frame
id
oid
age
centroid
(of classvec2
)
velocity
(of classvec2
)
orientation
boundingRect
(of classBoundingRect
)
height
lastSeen
the scene’s frame it was last seen in
color
(for display purposes only)
If extra data are also sent you can also access:
highest
the position of the highest point (of classvec2
)
distance
reflectivity
For instances of class
AugmentaScene
you can access:frame
objectCount
scene
(of classvec2
)
For instances of class
Fusion
you can access:offset
the offset in scene in meters (of classvec2
)
videoOut
the size of the video output in meters (of classvec2
)
videoOutInPixels
the size of the video output in pixels (of classvec2
)
Other informations you might need :
plain textaugmentaManager.getPixelPerMeter()
To know the pixel density in width and height.
plain textaugmentaManager.getObjectRelativePosition(oid)
To get an object’s relative position in the scene. Returns a
vec2
.