JavaScript ES6 Transpiling with Webpack and Babel

Awe­some to final­ly get to use Web­pack and Babel to tran­spile some ES6 code to vanil­la JavaScript that even Inter­net Explor­er can use:

ES6:

1
2
3
4
5
6
7
func­tion arrowTest() {
var mate­ri­als = [‘Hydro­gen’, ‘Heli­um’, ‘Lithi­um’, ‘Beryl­li­um’]; // expect­ed out­put: Array [8, 6, 7, 9]

return mate­ri­als.map(func­tion (mate­r­i­al) {
return mate­r­i­al.length;
});
}

Tran­spiled:

1
2
3
4
5
6
7
8
9
10
11
export func­tion arrowTest() {
    var mate­ri­als = [
        ‘Hydro­gen’,
        ‘Heli­um’,
        ‘Lithi­um’,
        ‘Beryl­li­um’
      ];
     
      // expect­ed out­put: Array [8, 6, 7, 9]
      return mate­ri­als.map(mate­r­i­al => mate­r­i­al.length);
}

Use­ful links: 

A HTML/JavaScript web interface and a Node/Express server, to control the robot drawing machine over the Internet.

Using Node­JS and Express, I cre­at­ed a web inter­face to remote­ly con­trol the pen draw­ing robot ‘Line-Us.’ Avail­able from Cool Com­po­nents.

Line-Us robot
Line-Us robot

You can watch a video of it func­tion­ing here:

And my project’s source code is avail­able on GitHub:
 
 
The robot is avail­able to pur­chase here:
 

How to watch the NTU Falcon Cam on PC, Mac, iOS and Android

Unfor­tu­nate­ly the uni­ver­si­ty streams as RTMP, which gen­er­al­ly requires Flash to stream in a web brows­er. Bizarrely their approach has been to advise view­ers to enable Flash, poten­tial­ly open­ing 1047 ways for view­ers to get hacked. I’ve noticed many peo­ple hav­ing prob­lems watch­ing the cam­eras, so I wrote this short guide on a way to play the cam­eras:

For PC and Mac

  1. Down­load and install VLC Play­er
  2. Down­load this file (right click and Save As): https://www.jonhassall.com/downloads/ntufalconcams.m3u
  3. Open VLC Play­er, Media -> Open File, and open the file you down­loaded
  4. Press the track skip but­tons to change cam­eras

For Android smartphone

  1. Install the VLC Play­er app from Google Play
  2. Open the VLC Play­er app
  3. Press ‘Open MRL’ from the left menu, and type:
    https://www.jonhassall.com/downloads/ntufalconcams.m3u
  4. I find it can take a good 30 sec­onds for the stream to open. Play con­trols appear if you swipe up from the bot­tom of the screen. It isn’t very intu­itive

iPhone/iPad

  1. Install the VLC for Mobile app from the App Store
  2. Open the VLC Play­er app
  3. Press ‘Net­work Stream’ from the left menu
  4. Type this URL into the box at the top:
    https://www.jonhassall.com/downloads/ntufalconcams.m3u
  5. Press ‘Open Net­work Stream’
  6. Press ‘ntucalconcams.m3u’ which should now be added to the list
  7. The cam­era streams should now show. It can take 30 sec­onds to start. Use the track skip but­tons to change between the three cam­eras.

YouTube

Hope­ful­ly in the future NTU will either stream direct­ly to a HTML5 com­pat­i­ble for­mat, or set up a live stream­ing con­ver­sion serv­er.

Hope this helps peo­ple enjoy watch­ing the fal­cons.

  

Anonymous Traffic Survey Cameras

Manual Traffic Surveys

Many peo­ple in the UK may be famil­iar with see­ing groups of peo­ple, or some­times a parked vechi­cle, clear­ly dis­play­ing a sign say­ing ‘Traf­fic Sur­vey.’ These peo­ple are employed to keep a tal­ly of the num­ber of vehi­cles using a road, and the types of vehi­cles. This infor­ma­tion is impor­tant for plan­ning infra­struc­ture, help­ing more effi­cient pro­vi­sion of trans­port capac­i­ty for cars, trucks/lorries and bus­es.

Pressure Sensors

Pressure-sensitive Traffic Data Collection System (from www.surveymarketing.co.uk)
Pres­sure-sen­si­tive Traf­fic Data Col­lec­tion Sys­tem (from www.surveymarketing.co.uk)

Many will also have seen tem­po­rary pres­sure sen­sors across roads, linked to a data col­lec­tion box attached to a street lamp. This sys­tem also pro­vides use­ful data on the num­ber of vehi­cles using a road.

By using two pres­sure sen­sors, its pos­si­ble to fair­ly accu­rate­ly record the num­bers of vehi­cles pass­ing in two direc­tions. How­ev­er, there may be some inac­cu­ra­cies when vehi­cles pass simul­ta­ne­ous­ly or almost simul­ta­ne­ous­ly. A 15-minute time peri­od may have an inac­cu­ra­cy of 10% (http://www.windmill.co.uk/vehicle-sensing.html). For roads with more than two lanes, accu­ra­cy would be even less and the sys­tem prob­a­bly wouldn’t be fea­si­ble.

Electronic Sensors

Piezoelectric Sensor Dug into Road
Piezo­elec­tric Sen­sor Dug into Road

There are also elec­tron­ic solu­tions dug into roads, which I’ve noticed on approach­es to traf­fic lights. These may be used to alter tim­ings of traf­fic lights depend­ing on traf­fic, and it seems they could also be used for traf­fic sur­vey data col­lec­tion. You may have noticed traf­fic lights chang­ing as you approach them, and a sys­tem like this may be detect­ing the mechan­i­cal ener­gy of your vehi­cle pass­ing over sen­sors. I expect there are also mag­net­ic ver­sions of these sen­sors, that sense the metal­lic body of a vehi­cle. Some­times motor­cy­cles in the US do not trig­ger these sys­tems at auto­mat­ed inter­sec­tions, caus­ing prob­lems, and some state laws allow­ing vehi­cles to pass if a sen­sor fails to detect a vehicle’s pres­ence.

Video Surveys

Scout Pole­mount Traf­fic Sur­vey Cam­era

I’ve noticed what seems like a new tech­nol­o­gy recent­ly, with a video cam­era mount­ed on a street light, and a data col­lec­tion box attached to it. After research­ing it, these are video cam­eras that record con­ven­tion­al HD video for a peri­od of 3 to 7 days. The mod­el I saw in use also has advanced fea­tures like remote man­age­ment and event alerts sent via mobile cel­lu­lar net­works (LTE), allow­ing set­tings to be changed and noti­fi­ca­tions of prob­lems with­out hav­ing to trav­el back to where the unit is deployed.

Computer Vision (CV)

I expect com­put­er vision tech­niques (e.g. OpenCV) are lat­er used to analyse the num­bers and types of vehi­cles pass­ing:

Anonymity and Privacy

I expect there are strict rules in place to pre­vent ANPR (Auto­mat­ic Num­ber Plate Recog­ni­tion) being used, as this may vio­late the pri­va­cy of dri­vers. How­ev­er, if there are not, I expect trav­el time sur­veys could be made by cal­cu­lat­ing how long a com­mute takes for indi­vid­ual dri­vers, and how they change over time. Per­haps if this was cal­cu­lat­ed anony­mous­ly, it would be a usable tech­nique.

While there have been com­pa­nies that have mon­i­tored cell­phones with Blue­tooth and Wi-Fi ser­i­al num­bers, often the gen­er­al pub­lic have expressed con­cerns over pri­va­cy. An exam­ple hard­ware provider for this is http://www.libelium.com.

In con­clu­sion, I found it inter­est­ing to research what these cam­eras and oth­er equip­ment I see are used for, and expect it is an inter­est­ing field analysing queues of videos for traf­fic data.

Jonathan Hassall