Perceptmobile: Azure Percept Obstacle Avoidance LEGO Car

Published May 14 2021 08:00 AM 4,206 Views
Senior Member

Azure Percept is a platform of hardware and services that simplifies use of Azure AI technologies on the edge. The development kit comes with an intelligent camera, Azure Percept Vision, and it can also be extended with Azure Percept Audio, a linear microphone array. Azure Percept works out of the box with Azure services such as Cognitive Services, Machine Learning, Live Video Analytics, and others to deliver vision and audio insights in real time. Scenarios like object detection, spatial analytics, anomaly detection, keyword spotting, and others can easily be solved with use of pre-built Azure AI models for edge.

 

I build "Perceptmobile", an Azure Percept-powered obstacle avoidance LEGO Boost car, as a weekend project and in this post I will walk you through all steps how it was built.

 

Perceptmobile-side.png

 

In the standard LEGO Boost package you can find instructions on how to build 4 different models and one of them is M.T.R. 4 model, which I modified a bit to fit the needs of this project. Model was used as a base on top of which I placed Azure Percept with Azure Percept Vision camera. LEGO Boost package also comes with 3 cones that I took pictures of and trained the Custom Vision model. Custom vision models can easily be deployed to the Azure Percept via Azure Percept Studio, and you can easily test it with camera stream.

 

With NodeJS I made a small backend that is based on quickstart "Send telemetry from a device to an IoT hub and read it with a back-end application" and with use of Express I served results on the localhost. For the frontend application I used "Lego Boost Browser Application" which is a great React application for controlling LEGO Boost from the browser via Web Bluetooth API. With it you can easily connect to your LEGO Boost, and the application gives you a nice interface where you are not only able to control motors and other sensors, but you are also able to write different commands and programming logic.

 

In following video you can see full walkthrough how to build this project:

 

 

Quickstart: Send telemetry from a device to an IoT hub and read it with a back-end application (Node.js) can be found here.

 

Azure CLI commands used:

 

az iot hub show --query properties.eventHubEndpoints.events.endpoint --name {YourIoTHubName}

az iot hub show --query properties.eventHubEndpoints.events.path --name {YourIoTHubName}

az iot hub policy show --name service --query primaryKey --hub-name {YourIoTHubName}

 

 

Pictures used for model training and relevant code is available in GitHub repository.

 

4 Comments
%3CLINGO-SUB%20id%3D%22lingo-sub-2352666%22%20slang%3D%22en-US%22%3EPerceptmobile%3A%20Azure%20Percept%20Obstacle%20Avoidance%20LEGO%20Car%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2352666%22%20slang%3D%22en-US%22%3E%3CP%3EAzure%20Percept%20is%20a%20platform%20of%20hardware%20and%20services%20that%20simplifies%20use%20of%20Azure%20AI%20technologies%20on%20the%20edge.%20The%20development%20kit%20comes%20with%20an%20intelligent%20camera%2C%20Azure%20Percept%20Vision%2C%20and%20it%20can%20also%20be%20extended%20with%20Azure%20Percept%20Audio%2C%20a%20linear%20microphone%20array.%20Azure%20Percept%20works%20out%20of%20the%20box%20with%20Azure%20services%20such%20as%20Cognitive%20Services%2C%20Machine%20Learning%2C%20Live%20Video%20Analytics%2C%20and%20others%20to%20deliver%20vision%20and%20audio%20insights%20in%20real%20time.%20Scenarios%20like%20object%20detection%2C%20spatial%20analytics%2C%20anomaly%20detection%2C%20keyword%20spotting%2C%20and%20others%20can%20easily%20be%20solved%20with%20use%20of%20pre-built%20Azure%20AI%20models%20for%20edge.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20build%20%22Perceptmobile%22%2C%20an%20Azure%20Percept-powered%20obstacle%20avoidance%20LEGO%20Boost%20car%2C%20as%20a%20weekend%20project%20and%20in%20this%20post%20I%20will%20walk%20you%20through%20all%20steps%20how%20it%20was%20built.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Perceptmobile-side.png%22%20style%3D%22width%3A%20500px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F280656iFCB0C7B9322EBDA2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Perceptmobile-side.png%22%20alt%3D%22Perceptmobile-side.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20standard%20LEGO%20Boost%20package%20you%20can%20find%20instructions%20on%20how%20to%20build%204%20different%20models%20and%20one%20of%20them%20is%20M.T.R.%204%20model%2C%20which%20I%20modified%20a%20bit%20to%20fit%20the%20needs%20of%20this%20project.%20Model%20was%20used%20as%20a%20base%20on%20top%20of%20which%20I%20placed%20Azure%20Percept%20with%20Azure%20Percept%20Vision%20camera.%20LEGO%20Boost%20package%20also%20comes%20with%203%20cones%20that%20I%20took%20pictures%20of%20and%20trained%20the%20Custom%20Vision%20model.%20Custom%20vision%20models%20can%20easily%20be%20deployed%20to%20the%20Azure%20Percept%20via%20Azure%20Percept%20Studio%2C%20and%20you%20can%20easily%20test%20it%20with%20camera%20stream.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20NodeJS%20I%20made%20a%20small%20backend%20that%20is%20based%20on%20quickstart%20%22Send%20telemetry%20from%20a%20device%20to%20an%20IoT%20hub%20and%20read%20it%20with%20a%20back-end%20application%22%20and%20with%20use%20of%20Express%20I%20served%20results%20on%20the%20localhost.%20For%20the%20frontend%20application%20I%20used%20%22Lego%20Boost%20Browser%20Application%22%20which%20is%20a%20great%20React%20application%20for%20controlling%20LEGO%20Boost%20from%20the%20browser%20via%20Web%20Bluetooth%20API.%20With%20it%20you%20can%20easily%20connect%20to%20your%20LEGO%20Boost%2C%20and%20the%20application%20gives%20you%20a%20nice%20interface%20where%20you%20are%20not%20only%20able%20to%20control%20motors%20and%20other%20sensors%2C%20but%20you%20are%20also%20able%20to%20write%20different%20commands%20and%20programming%20logic.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20following%20video%20you%20can%20see%20full%20walkthrough%20how%20to%20build%20this%20project%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20style%3D%22position%3A%20relative%3B%20padding-bottom%3A%2056.25%25%3B%20padding-top%3A%200px%3B%20height%3A%200%3B%20overflow%3A%20hidden%3B%20min-width%3A%20320px%3B%22%3E%3CIFRAME%20src%3D%22https%3A%2F%2Fwww.youtube-nocookie.com%2Fembed%2FC6kX6zr9yoI%3Fcontrols%3D0%26amp%3Bautoplay%3Dfalse%26amp%3BWT.mc_id%3Diot-c9-niner%3Fautoplay%3Dfalse%E2%80%8B%E2%80%8B%E2%80%8B%22%20frameborder%3D%220%22%20allowfullscreen%3D%22allowfullscreen%22%20style%3D%22position%3A%20absolute%3B%20top%3A%200%3B%20left%3A%200%3B%20width%3A%20100%25%3B%20height%3A%20100%25%3B%22%20class%3D%22video-iframe%22%20title%3D%22%E2%80%9DVideo%22%20walkthrough%3D%22%22%20of%3D%22%22%20the%3D%22%22%20perceptmobile%3D%22%22%20project%3D%22%22%3E%3C%2FIFRAME%3E%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EQuickstart%3A%20Send%20telemetry%20from%20a%20device%20to%20an%20IoT%20hub%20and%20read%20it%20with%20a%20back-end%20application%20(Node.js)%20can%20be%20found%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fquickstart-send-telemetry-node%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20CLI%20commands%20used%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Eaz%20iot%20hub%20show%20--query%20properties.eventHubEndpoints.events.endpoint%20--name%20%7BYourIoTHubName%7D%0A%0Aaz%20iot%20hub%20show%20--query%20properties.eventHubEndpoints.events.path%20--name%20%7BYourIoTHubName%7D%0A%0Aaz%20iot%20hub%20policy%20show%20--name%20service%20--query%20primaryKey%20--hub-name%20%7BYourIoTHubName%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPictures%20used%20for%20model%20training%20and%20relevant%20code%20is%20available%20in%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgvuksic%2FPerceptMobile%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGitHub%20repository%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2352666%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Perceptmobile.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F280629i46921E92336371F8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Perceptmobile.png%22%20alt%3D%22Perceptmobile.png%22%20%2F%3E%3C%2FSPAN%3EPerceptmobile%20is%20an%20Azure%20Percept-powered%20obstacle%20avoidance%20LEGO%20Boost%20car%2C%20and%20this%20article%20walks%20you%20through%20steps%20how%20it%20was%20built.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2352666%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Percept%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Percept%20DK%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECustom%20Vision%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIoT%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2399145%22%20slang%3D%22en-US%22%3ERe%3A%20Perceptmobile%3A%20Azure%20Percept%20Obstacle%20Avoidance%20LEGO%20Car%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2399145%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20i%20create%20a%20brand%20new%20iothub%20with%20different%20name.%20how%20to%20i%20get%20azure%20percept%20to%20work%20again%3C%2FP%3E%3CP%3Ei%20tried%20editing%20the%20device_connection_string%20in%20%2Fetc%2Fiotedge%2Fconfig.yaml%3CBR%20%2F%3Eit%20connects%20to%20the%20device%20in%20the%20new%20iothub%20but%20only%20has%20two%20modules.%3CBR%20%2F%3EedgeAgent%20and%20edgeHub%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2404671%22%20slang%3D%22en-US%22%3ERe%3A%20Perceptmobile%3A%20Azure%20Percept%20Obstacle%20Avoidance%20LEGO%20Car%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404671%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20not%20tested%20that%20but%20knowing%20how%20IoT%20Hub%20and%20IoT%20Edge%20work%2C%20I%20would%20assume%20you%20have%20to%20go%20through%20the%20Azure%20Percept%20device%20OOB%20setup%20to%20change%20the%20IoT%20Hub%2C%20so%20that%20Azure%20Percept%20sets%20up%20the%20new%20IoT%20Hub%20to%20have%20the%20right%20deployment%20configured%20for%20the%20device.%20Changing%20the%20device%20connection%20string%20in%20the%20config.yaml%20only%20points%20the%20IoT%20Edge%20runtime%20to%20connect%20to%20a%20different%20IoT%20Hub%2C%20but%20when%20connecting%2C%20the%20new%20IoT%20Hub%20will%20not%20have%20an%20IoT%20Edge%20deployment%20setup%20ready%20indicating%20which%20modules%20it%20needs%20to%20get%20and%20run.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2405937%22%20slang%3D%22en-US%22%3ERe%3A%20Perceptmobile%3A%20Azure%20Percept%20Obstacle%20Avoidance%20LEGO%20Car%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2405937%22%20slang%3D%22en-US%22%3E%3CP%3Emakes%20sense.%3C%2FP%3E%3CP%3Esince%20im%20fairly%20new%20at%20a%20number%20of%20things%20in%20the%20robotics%20stack%2C%20iotedge%20being%20one%20of%20them%2C%20it%20seems%20i%20need%20the%20deployment%20manifest%20that%20was%20used%20to%20define%20the%20modules%20and%20their%20publish%20subscribe%20relationships.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20this%20from%20doing%20hello%20world%20from%20visual%20studio%20code.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20guess%20is%20that%20somehow%20i%20need%20to%20find%20from%20where%20the%20OOB%20experience%20runs.%26nbsp%3B%20%26nbsp%3Bwhether%20thats%20a%20container%20or%20some%20systemctl%2Fsystemd%20service%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ECBL-%3C%2FSPAN%3E%3CSTRONG%3EMariner%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Boperating%20system.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Emy%20guess%20is%20that%20the%20website%20that%20runs%20the%20OOB%20experience%20has%20the%20Azure%20IotEdge%20project%20and%20manifest%20file%20at%20its%20disposal%3F%26nbsp%3B%20%26nbsp%3BOr%20you%20call%20out%20to%20github%2C%20or%20maybe%20an%20azure%20devops%20pipeline%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EWhich%20gives%20you%20that%20default%20vision%20processing%20pipeline%20that%20then%20you%20instruct%20us%20to%20manipulate%20with%20the%20device%20twin%20properties%20to%20run%20a%20differently%20trained%20computer%20vision%20algorithm.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIts%20good%20value%20to%20have%20a%20ready%20to%20go%20thing%20like%20this.%26nbsp%3B%20But%20its%20also%20very%20important%20that%20newbie%20developers%20and%20vets%20alike%20can%20follow%20some%20multi%20part%20training%20where%20we%20can%20dig%20into%20the%20guts%20of%20this%20thing%20so%20that%20we%20can%20make%20it%20our%20own%20and%20learn%20the%20azure%20iotedge%20way.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20device%20is%20good%20for%20the%20decision%20makers%2F%20POC%20demonstrations.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBut%20if%20you%20also%20want%20grass%20roots%20adoption%20from%20the%20army%20of%20developers%20out%20there%20then%20we%20need%20that%20middle%20ground.%3CBR%20%2F%3E%3CBR%20%2F%3ENVidia%20Jetson%20is%20the%20other%20end%20of%20the%20spectrum.%3CBR%20%2F%3EBut%20somewhere%20in%20the%20middle%20is%20the%20sweet%20spot.%26nbsp%3B%20%26nbsp%3BMaybe%20you%20can%20put%20me%20in%20touch%20with%20the%20team%20and%20i%20can%20work%20with%20them%20on%20developing%20these%20types%20of%20documentations%2C%20samples%2C%20tutorials%2C%20POCs%20internally%20as%20well%20as%20for%20clients%3F%26nbsp%3B%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22mailto%3Ajuan.suero%40gmail.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ejuan.suero%40gmail.com%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIm%20working%20on%20combining%20computer%20vision%20on%20intelligent%20machines%20with%20hololens%202%20for%20collaboration%20and%20training%20of%20robots.%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Capture.PNG%22%20style%3D%22width%3A%20966px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F285440iACAC3420120F4C04%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture.PNG%22%20alt%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2405966%22%20slang%3D%22en-US%22%3ERe%3A%20Perceptmobile%3A%20Azure%20Percept%20Obstacle%20Avoidance%20LEGO%20Car%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2405966%22%20slang%3D%22en-US%22%3E%3CP%3ELet's%20keep%20the%20conversation%20in%20one%20place%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fiot-devices%2Fazure-percept-point-to-new-iothub%2Fm-p%2F2405912%2Femcs_t%2FS2h8ZW1haWx8dG9waWNfc3Vic2NyaXB0aW9ufEtQRUlBUk1JSkxLRjBGfDI0MDU5MTJ8U1VCU0NSSVBUSU9OU3xoSw%23M317%22%20target%3D%22_blank%22%3ERe%3A%20azure%20percept%20point%20to%20new%20iothub%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎May 13 2021 05:53 PM