General Motors (GM) has opened up development of their in vehicle infotainment services giving access to developers all over the world to build apps that could be accessible to GM vehicle owners. The intention behind this is to accelerate development of vehicle infotainment, thus making the car ride enjoyable, safe and interactive. Given how much connected cars are penetrating in the society, this step by GM will prove a very crucial step in recognizing GM as the next generation vehicle manufacturer.
The infotainment SDK from GM is called NGI (Next Generation Infotainment). To access the SDK you would have to create an account on the GM developer website. The sdk gives you access to various apis – vehicle signals, communication, audio/video, navigation, user interface, file handling etc.
- Download NGI SDK Here: https://developer.gm.com/ngi/downloads
- Create a directory on your computer where you want to start a new project and follow the instructions on the page above to install ngi.
- ngi serve command will start the sdk and open up the GM vehicle infotainment emulator.
- index.html file will have all the UI elements for the emulator. The accompanying css files will have the style sheets and the js files will have your code. Edit the app.js file to develop your app.
node.connect : Smart Driving – Smart Parking – Ride Sharing Vehicle Infotainment app.
This is the app I developed using the sdk. The features of the app are summarized below.
- Smart Driving: An alert bar will give the driver real time smart driving tips. It is estimated that the fuel economy of a vehicle can be improved by nearly 10-12% just by improving how we drive. This translates to lot of $$$ saved. This app senses various signals from the vehicle CAN network and gives tips to improve the driving.
- Smart Parking: Finding parking in big cities can be a nightmare. This app gives the driver realtime parking information around him and also highlights the cheapest and the most expensive parking garage nearby. We interfaced with the ParkWhiz API to get the parking information. The app allows the driver to select a particular parking location and navigates him to the destination. It also incorporates a rewards program which rewards you some percent of the parking amount you spend towards your next purchase. The “P Meter” in the image above are the cumulative rewards the vehicle has earned using this app.
- Smart Ride Sharing: Ride sharing/ car pooling also saves lot of fuel and emissions and GM is trying to promote this with its partnership with Lyft. This app tries to motivate the driver to be a part of the lyft network by suggesting him a $$ value (“Lyft Meter”) that he could have earned had a picked up a lyft passenger on his way to the destination. This has no overhead for the driver and its a passive income thus promoting GM-Lyft partnership.
We came in second in one of the GM sponsored competitions where we presented this app.
(feel free to get in touch to have access to the code files)
Key Elements of the code:
Smart Driving: Following signals are monitored : Vehicle speed, accelerator position, brake position, brake pressure, steering angle gradient, yaw rate, lateral acceleration, longitudinal acceleration, AC state, Window state (open/closed), cruise state. API used to get data:
where SIGNAL_FILTER is the array of all the signals needed to make real time desicions and processVehicleData() is the callback function which has all the logic.
Smart Parking: integrated with ParkWhiz Api for realtime parking locations. Integrated with google maps for displaying parking locations on the map. Used the gm.nav API to get the realtime latitude and longitude of the vehicle.
Lyft Ride sharing: Used a basic function found of internet to simulate the lyft dollars saved. $$ earned = function(fixed cost, service charge, permile cost*distance). Given access to a detailed proprietory algorithm developed by GM and Lyft, this function can be optimized greatly to reflect the right amount of dollars earned.
The cumulative saved dollars were saved in a file on shutdown. gm.io.writeFile api was used to create a file and write a json file with the relevant key/values pairs. During bootup gm.io.readFile api was used to read the contents of the file and update the P Meter and Lyft Meter values.
gm.io.writeFile(writeFileSuccess, Fail, ‘savings.json’, JSON.stringify(contents));
file to write in = savings.json, contents= array of key value pairs, writeFileSuccess and Fail are the success and fail callbacks after the call is executed.
contents = gm.io.readFile(‘savings.json’);
reading from file savings.json while boot up. There was a bug in the sdk that did not allow us to use success and fail callbacks with the read function.