Hackathon Documentation:...

14
Hackathon Documentation: Sensity

Transcript of Hackathon Documentation:...

Page 1: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

HackathonDocumentation:Sensity

Page 2: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

Contents1. DescriptionofDemoand

ProgrammableEventsa. AnkiOverdriveDemo

i. LightingControlandEventsii. TrafficEventsiii. ParkingEvents

b. ThingspaceSensorStream2. APIDocumentation

a. LightingControlb. Trafficc. Parkingd. SensorStream

3. Websocket4. RESTAPI

Page 3: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

ANKIOverdriveCarDemoSelfDrivingtoyvehiclestraversethefigureeighttrack,passingthroughseveraldetectionszoneswheredataiscollectedbytheSensityVideoNodes.Thevehiclesaredetected,classifiedandtrackedalongtheirpathwhiledataaboutlocation,direction,speedandlapcountarecollected.StreetlightsandLightingControlAsingleStreetlightispositionedovertheracetrackandiscontrolledbythebluecorenodedeviceontopofit.ThreeadditionallightbayattachmentswithbluecorenodeswillbepositionedonthetabletopforuseaswellLEDControlDescription:(LabelswithNodeIDswillbegivenoutduringhackathon)Luminaire(lightfixture)poweroutput(lightingintensity)canbecontrolledbyAPIcalls.

1. Fullpower-setlightoutputpowertomaximumintensity/poweroutput=100%2. Off-setlightoutputpowertozero,nopoweroutput=0%3. Dimming-Setpowerlevel/lightingintensitytofollowinglevels

a. 0-100%todefineoverridinglightlevel

ANKICarTrafficDescription: Toycarswilltraversethefigure-8atafixedrateofspeedandbesubjectto6differentdetections.Additionally,thereisanimagecaptureoption.

1. RightWayCounta. Vehicleswillproceedaroundthetrackinacounter-clockwisedirection.Each

timetheypassthroughthedetectionzoneattheLuminaire(light)sideofthecourse,theywillbecounted.

2. WrongWayCounta. Vehiclesthatproceedaroundthetrackinaclockwisedirectionwillincrement

the“wrong-way-counter”astheypassthroughthedetectionzone3. Collisiondetection

a. Thereare2detectionzonesthatprecedetheintersectionoftheracetrackfromeitherdirection.

b. Vehiclesaredetectedastheypassthroughthezonesandtimestampsaremonitoredateachdetection

c. If/Whenthevehiclesarriveattherespectivedetectionzoneswithtimestampswithin0.4secondsofoneanother,analertwillbesenttothebackendsystem

d. Eventnameforcollision/near-collision=4. EnterfromLeft,EnterfromRight(checkmveconfigforeventname)–calloutthe

eventsbynameandthenhaveanadditionalextrapolationeventforcollision5. ImageCapture.Output=jpeg

Page 4: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

ANKICarParkingDescriptionToycarsplacedinorremovedfromthe6demarcatedparkingspotsateachendoftheracetrack’sinfieldwillbedetectedforoccupancyorvacancy

1. Carsplacedintheparkingspotsa. Vehiclewillbedetectedb. ParkingspotidentifiedbyGPSlocationofboundingboxthatmakesupthe

perimeterofindividualparkingspotc. SpotIDmarkedasOccupied=Truewhenavehiclecomestorestthered. Timerstartsandcontinuesforthedurationofthevehiclesresidenceinthat

location2. Carsremovedfromparkingspots

a. Vacantspotnotificationsentuponremovingvehiclefromtheparkingspotb. ParkingspotidentifiedbyGPSlocationofboundingboxthatmakesupthe

perimeterofindividualparkingspotc. SpotIDmarkedasOccupied=Falsewhenavehicleceasestoresideinthe

locationanylonger

Page 5: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

SENSITYAPIDOCUMENTATIONSetLightLevelAPIDocumentationSetLightLevel—NodeNote:Toturnlightlevelcompletelydown,Sensityrecommendsthatyoudonotsetlightlevelsat0(zero)percent,asdoingsotriggerstherelay.ThelightlevelrelaystypicallyhavearatedlifetimeregardingthenumberoftimestheycanbeswitchedbetweentheONandOFFpositions.TobetterpreserverelaylifetimeswhenlightlevelmustbeOFF,uselightlevel1inyourAPIRequest(ratherthanlightlevel0).DESCRIPTIONSetlightinglevelvalueandtimeoutvalueforaspecifiednode.AsuccessfulcallreturnsaresponsecodetoindicatethatthespecifiedlightinglevelissetforthenodeTraffic/Parking API-Key: PNh1Yixb-Ov5r-LC4O-0ays-2ejk6slR89jA AnkiTrackID:*N02c00049 ChicagoSceneID:*XXXXXX(getfromsandbox) Lighting Set Light Level: POST -H ‘Content-Type: application/json’ -d ‘{“level”: 0, “timeout”: 30}’ -H ‘api_key: d5068b82c187143e517f36e762dba0b0eef4faf0’ https://nsn.sensity.com/v3.0/customers/96d69120-37fc-11e7-a75d-df8f79bc94f8/sites/a2f52d80-37fd-11e7-a75d-df8f79bc94f8/lightcontrol/node/N01232ba9 POST -H ‘Content-Type: application/json’ -d ‘{“level”: 100, “timeout”: 30}’ -H ‘api_key: d5068b82c187143e517f36e762dba0b0eef4faf0’ https://nsn.sensity.com/v3.0/customers/96d69120-37fc-11e7-a75d-df8f79bc94f8/sites/a2f52d80-37fd-11e7-a75d-df8f79bc94f8/lightcontrol/node/N01232ba9 Headers: { 'content-type': 'application/json', 'api_key': ' d5068b82c187143e517f36e762dba0b0eef4faf0'} Body: {"level": 100, "timeout": 3} Level: 0-100 percent Timeout: seconds to keep setting Sensor stream: GET https://thingspace.io/get/latest/dweet/for/disruptNYClight { "this":"succeeded",

Page 6: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

"by":"getting", "the":"dweets", "with":[ { "thing":"disruptNYClight", "created":"2017-03-09T19:01:38.754Z", "content":{ "nodeid":"N01xxxxxx", "time":"hh:mm:ss GMT+0000 (UTC)", "[sensor_name]": [sensor_value], "units": [sensor_units] } } ] } Sensor Name: light – Lumens ir_light - Lumens energy – KWh temperature – Celcius light_setting – percent jolt – jolt value presence – true/false

Page 7: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

Parking GET https://procyon.sensity.com/2.0/*N02c00049//parking_spaces.json?api_key= PNh1Yixb-Ov5r-LC4O-0ays-2ejk6slR89jA

Subscribe API: Open websocket: wss://procyon.sensity.com/2.0/stream?api_key= PNh1Yixb-Ov5r-LC4O-0ays-2ejk6slR89jA Subscribe to parking: >>scope(“$SiteA_ScopeID”).detailed_parking_spot.subscribe() <<scope(“$SiteA_ScopeID”).detailed_parking_spot.subscribed() Sample event: <<scope(“$ParkingSpotA_ScopeID”).detailed_parking_spot.parking_spot({“since”:”YYYY-MM- DDT19:46:27,987Z”,”uuid”: “$ParkingSpotA_UUID”,”occupied”:$boolean,”count”:109,”loca- tion”:[$lat,$lon]})

Page 8: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

Traffic GET https://procyon.sensity.com/2.0/N02c00049//traffic_areas.json?api_key= PNh1Yixb-Ov5r-LC4O-0ays-2ejk6slR89jA

Subscribe API: Open websocket: wss://procyon.sensity.com/2.0/stream?api_key= PNh1Yixb-Ov5r-LC4O-0ays-2ejk6slR89jA Subscribe to parking: >>scope(“$SiteA_ScopeID”).detailed_traffic_area() <<scope(“$SiteA_ScopeID”).detailed_traffic_area.subscribed() Sample event: <<scope(“$TrafficArea_SropeID”).detailed_traffic_area.counter_event( {“time”:”YYYY-MM-DDT21:31:18:7372”,”event_name”:”$EventType.EventLane”, “object_class”:”Unknown”,”object_id”#####,”camera_channel”0,”world_postion”:[$lat,$lon], “world_velocity”:[###,###],”count”:18104})

Page 9: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

Image Capture GET https://procyon.sensity.com/2.0/N02c00049/device/image_capture?resolution=L&api_key= PNh1Yixb-Ov5r-LC4O-0ays-2ejk6slR89jA Response: JPG image

Page 10: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

WEBSOCKETACCESSOPTIONS -TERMINAL -BROWSERACCESSUSINGDARKWEBSOCKETTERMINAL

https://chrome.google.com/webstore/detail/dark-websocket-terminal/dmogdjmcpfaibncngoolgljgocdabhke?hl=enAddDarkWebSocketTerminalinthegooglechromebrowserusingabovelinkwss://procyon.sensity.com/2.0/stream?api_key=<APIKEY>

Page 11: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

scope("N02c0003b").parking_zone.subscribe()Writethemessageyouwanttosubscribeandclicksend.Datawillstarttoreflectintheterminal

Page 12: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

ACCESSWEBSOCKETDATAINTHEBROWSER

AlternativeoptionofgettingWebsocketdatausingbrowser:WSStestsite:https://www.websocket.org/echo.htmlIntheLocationoptionputWSSConnectionurlandclickConnectWSSConnectionurl:wss://procyon.sensity.com/2.0/stream?api_key=<APIKEY>IntheMessageboxpastethemessageyouwanttosubscribeandclickSend.Logboxontherightsidewillreflectresponse.Example:scope("N02c0003b").parking_zone.subscribe()WEBSOCKETMESSAGE:PARKINGANDTRAFFICTrafficDataSubscribeandUnsubscribefromNetsenseServer:scope("N02c0003b").traffic_area.subscribe()scope("N02c0003b").detailed_traffic_area.subscribe()DemarcatedParkingDataSubscribeandUnsubscribefromNetsenseServer:scope("N02cff187").parking_spot.subscribe()scope("N02fe0051").detailed_parking_spot.subscribe()UndemarcatedParkingDataSubscribeandUnsubscribefromNetsenseServer:scope("N02c0003b").parking_zone.subscribe()scope("N02fe0051").parking_zone_SCO.unsubscribe()AllMessageDataSubscribeandUnsubscribe:Scenedataisthemetadatasendbydevicescope("N02c00030").scene.subscribe()scope("N02c0003b").scene.unsubscribe()

Page 13: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

WEBSOCKETINFORMATIONAVAILABLEFORTRAFFIC

traffic_area detailed_traffic_area

traffic_area.count= time:event_name:object_class:object_id:camera_channel:world_position:world_velocity:count:

WEBSOCKETMESSAGEFORTRAFFICTrafficDataSubscribeandUnsubscribefromNetsenseServer:Trafficcountisneverreset.Itisthe#ofvehiclesseenatthatareasincestartoftime.detailed_traffic_areawillshowbelowdetails.scope("N02c0003b").traffic_area.subscribe()scope("N02c0003b").traffic_area.unsubscribe()11:38:03sent:scope("N02c0003b").traffic_area.subscribe()11:38:03received:scope("N02c0003b").traffic_area.subscribed()11:38:25received:scope("*2XMY5Y8G").traffic_area.count=50270811:38:26received:scope("*2XMY5Y8G").traffic_area.count=50271011:38:26received:scope("*2XMY5Y8G").traffic_area.count=50271111:38:35received:scope("*2XMY5Y8G").traffic_area.count=502712scope("N02c0003b").detailed_traffic_area.subscribe()scope("N02c0003b").detailed_traffic_area.unsubscribe()scope("*2XMY5Y8G").detailed_traffic_area.counter_event({ "time":"2016-05-24T19:16:16.922Z", "event_name":"CarCount.Lane2", "object_class":"Vehicle", "object_id":26754, "camera_channel":0, "world_position":[], "world_velocity":[-0.017129617, 3.5687623], "count":4946

Page 14: Hackathon Documentation: Sensitygo.vzwtechnologies.com/2017-Tech-Crunch/ANKICarEventDescriptionsfor... · ANKI Car Parking Description Toy cars placed in or removed from the 6 demarcated

})WEBSOCKETINFORMATIONAVAILABLEFORDEMARCATEDPARKING

parking_spot detailed_parking_spot

parking_spot.occupied=parking_spot.count=

since:uuid:occupied:count:location:

WEBSOCKETMESSAGEFORDEMARCATEDPARKINGDemarcatedParkingDataSubscribeandUnsubscribefromNetsenseServer:scope("N02cff187").parking_spot.subscribe()scope("N02fe0051").parking_spot.unsubscribe()14:17:44 command: /sendscope("N02c00030").parking_spot.subscribe()14:17:44 sent: scope("N02c00030").parking_spot.subscribe()14:17:44 received: scope("N02c00030").parking_spot.subscribed()14:17:53 received: scope("*52FBMNQ4").parking_spot.occupied=true14:17:54 received: scope("*3NSB4D99").parking_spot.occupied=true14:17:54 received: scope("*XY75Q3WE").parking_spot.occupied=false14:17:54 received: scope("*MZCNGWW6").parking_spot.occupied=false14:17:54 received: scope("*3NSB4D99").parking_spot.count=269014:17:55 received: scope("*52FBMNQ4").parking_spot.count=1734scope("*M14X2X4Z").detailed_parking_spot.subscribe()scope("*M14X2X4Z").detailed_parking_spot.unsubscribe()14:21:50 sent: scope("N02c00030").detailed_parking_spot.subscribe()14:21:50 received: scope("N02c00030").detailed_parking_spot.subscribed()14:22:29received:scope("*3TFGDHWC").detailed_parking_spot.parking_spot({ "since":"2016-05-24T21:22:29.364Z", "uuid":"d7981064-284a-5c07-801e-b7210355ffeb", "occupied":true, "count":622, "location":[37.3816202759231, -121.99202607625392]