Continuous Delivery for (Smart) Trucks
Peter Thorngren, Technical Integration/Verification Leader for Volvo Truck Technology Group, spoke at QCon London 2016 on applying continuous delivery techniques to the development of next-generation smart trucks. In particular, virtualization of the hardware components present in a truck, combined with modeling and test automation techniques have been the key enablers for testing new software features in heavy-duty trucks in a matter of minutes as opposed to several months.
Virtual environments allow developers to test their code in a virtual truck and obtain responses similar to a physical truck without having to wait months for integration with hardware. According to Thorngren, a similar hardware based simulator alone would cost in the order of one million euros and allow only serial executions of the test suite.
Modeling the physical world in terms of road and weather conditions as well as the road system itself are crucial for virtualization to provide meaningful results. As Thorngren explained, modeling is never exact but can be kept within a degree of certainty by calibrating it with results from real world tests with actual trucks. The most complex components to model include breaking, engine management and assisted driving systems.
Test automation relies on the virtualization but also on mocking sensors for testing units in isolation. During the presentation Thorngren demonstrated how to manipulate the sensors via a simple GUI on top of the actual virtual sensors used in the tests. A virtual truck is in fact a C++ library using real hardware logic represented by hardware definition files.
The integration process for Volvo's truck software starts with developers running the tests against their local virtual truck instances, then commmiting the code to a build server that runs the same tests with all the changes put together. A green build triggers hardware integration tests in test rigs that replicate parts of a truck's hardware and take around 10 minutes altogether.
In fact, the strategy Thorngren described strongly resembles the inverted test pyramid idea, where costly UI tests are the physical tests using either a real truck or a full-purpose hardware simulator, with all sensors and computing systems interconnected. Because today's heavy-duty trucks possess hundreds of sensors (for comparison a smartphone has between ten and twenty sensors) and dozens of networks - and they keep growing, such tests are very expensive and not scalable. Therefore only a small set is run in real trucks but much more infrequently than the integration and unit tests (which provide sufficient feedback to test new features and quickly find problems).
During his talk Thorngren shared his prediction for a future with autonomous smart trucks, starting with limited self-driving in the next decade, all the way to full fledge self-driving automation in a couple of decades. He also told QCon:
If you look at the truck of the future, you will find more or less a big computer. The truck will likely leverage virtualization (things like VMware or something similar). It will run Java or C/C++. The computational power will be 100’s and 100’s times bigger than today’s cars and trucks. The truck is completely linked with the Internet (as it is today), but it will be more an autonomous vehicle. Exactly when that will happen is obviously a big question, but it is just a matter of time. These trucks will probably be one of the most complex technical things that we see in everyday life. It will be a quite fascinating thing to see.
Throngren stressed how software development techniques like test automation, continuous integration and delivery will be fundamental for quickly adapting vehicles development to new and unpredictable technological evolution. Although Volvo today already upgrades trucks' software via wifi connection (minor changes like modifying a parameter value), Thorngren expects in the future to see automated cloud-like deployment of new virtual machine images to the trucks.