Embedding Web Augmented Reality (WebAR) with Inter...
Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Ever since the evolution of AR and VR has consistently produced new prospects to visualize objects in varied dimensions. My quest for establishing a “wow experience” for the customer has invariably taught me to include something intuitive on top of the existing services. I am working with customers who use various capabilities of SAP Leonardo Internet of Things, and whenever there is a demo, they are eager to know something the field engineers can use especially in Industry floors, site visits or live device health condition. Holo Lens, Oculus Rift, and other VR Glasses are there that deals with the issue, but site engineers rarely adopt the headsets and prefer for some mobile apps. We all notice that AR apps are complicated and consume a lot of mobile space and memory. With this limitation, Web Augmented Reality or WebAR has now come more prominent compared to the static AR apps that run with specific OSs.
A-Frame is a popular open-source web framework for building virtual reality experiences. It runs 100% in your web browser; this means no app to install! There is no need for a specific device, either e.g. Pixel or iPhone. It runs on all mobile platforms: Android, iOS11 and Windows mobile.
Scenario
In this blog post, we will use SAP IoT Device Management API to consume the live sensor data and publish it on WebAR. We will use a barcode that acts as a marker for the 3D image to superimpose on it.
Pre-requisite:
Internet of Things Service Cockpit
SAP Cloud Foundry
CF installed in CLI
Sensor Setup
Let’s Code.
First thing first, we should have access to the Internet of Things Service Cockpit.
Onboard a sensor by following this tutorial Send Data with MQTT and use Paho client to send data to the IoT cockpit. Visualize the incoming device data.
Navigate to the Useful Links tab on the left-hand side and go to API Docs > Device Management API
From the list of APIs we will only use:
Execute the above API with orderBy=timestamp desc, skip=0, and top=1 for which we will get a response like:
Download the barcode 6 from this link and print it.
Deploy the application to SAP Cloud Foundry
Open the command prompt from the project folder and login to the cloud foundry and execute:
> cf push
Copy the URI form the deployed application.
Open the URL on a mobile browser and scan the barcode 6 to see the action.
Note:
For iOS use Safari.
For Android use Chrome.
Conclusion
This setup can be used for building any bespoke application and can be merged with any existing service. AR on top of IoT can be integrated into many use-cases to enhance visualizations. Considering this application to be used by field engineers, surveyors and supervisors for various industries can be helpful, as they can track the live status of the devices. Please check the below demo for the complete application usage.