As auto manufacturers have brought self-driving features to their products, we’re told about how impressive their technologies are and just how much computing power is on board to make it happen. Thus it surprised us (and it might also surprise you too) that some level of self-driving can be performed by an Android phone. [Mankaran Singh] has the full details.
It starts with the realization that a modern smartphone contains the necessary sensors to perform basic self-driving, and then moves on to making a version of openpilot that can run on more than the few supported phones. It’s not the driver-less car of science fiction but one which performs what we think is SAE level 2 self driving, which is cruise control, lane centering, and collision warning. They take it out on the road in a little Suzuki on a busy Indian dual carriageway in the rain, and while we perhaps place more trust in meat-based driving, it does seem to perform fairly well
[Willem Melching] owns a 2010 Volkswagen Golf – a very common vehicle in Europe – and noticed that whilst the electronic steering rack supports the usual Lane Keep Assist (LKAS) system, and would be theoretically capable of operating in a far more advanced configuration using openpilot, there were some shortcomings in VW’s implementation which means that it would not function for long enough to make it viable. Being very interested in and clearly extremely capable at reverse engineering car ECUs and hacking them into submission, [Willem] set about documenting his journey to unlocking openpilot support for his own vehicle.
And what a journey it was! The four-part blog series is beautifully written, showing every gory detail and all tools used along the way. The first part shows the Electronic Power Steering (EPS) ECU from a 2010 Volkswagen Golf Mk6 module (which rides on the back of the three-phase steering rack motor) being cracked open to reveal an interesting multi-chip module approach, with bare die directly bonded to a pair of substrate PCBs, that are in turn, bonded to the back of the motor casing, presumably for heat dissipation reasons. Clever design, but frustrating at the same time as this makes part identification somewhat tricker!
[Willem] uses a variety of tools and tricks to power up and sniff the ECU traffic on the CAN bus, when hooked up to a SAE J2534-compliant debug tool, eventually determining it speaks the VW-specific TP2.0 CAN bus protocol, and managed to grab enough traffic to check that it was possible to use the standard KWP2000 diagnostic protocol to access some interesting data. Next was a very deep dive into reverse engineering update images found online, by first making some trivial XOR operations, then looking at an entropy plot of the file using Binwalk to determine if he really did have code, and if it was encrypted or not, After running cpu_rec, it was determined the CPU was a Renesas V850. Then the real work started – loading the image into Ghidra to start making some guesses of the architecture of the code, to work out what needed patching to make the desired changes. In the final part of the series, [Willem] extracts and uses the bootloader procedure to partially patch the code configuration area of his vehicle and unlocks the goal he was aiming at – remote control of his steering. (OK, the real goal was running openpilot.)
In our opinion, this is a very interesting, if long, read showing a fascinating subject expertly executed. But we do want to stress, that the vehicular EPS module is an ASIL-D safety tested device, so any hacks you do to a road-going vehicle will most definitely void your insurance (not to mention your warranty) if discovered in the event of a claim.
The flight controller is the nerve center of a drone. Drone flight control systems are many and varied. From GPS enabled autopilot systems flown via two way telemetry links to basic stabilization systems using hobby grade radio control hardware, there is an open source project for you.
Modern drone flight controllers can trace their roots back to R/C helicopters. Historically, R/C planes were controlled directly by the pilot’s radio. Helicopters added a new wrinkle to the mix: tail rotors. Helicopters use their tail (or anti-torque) rotor to counteract the torque of the main rotor attempting to spin the entire helicopter’s body. It all works great when the helicopter is hovering, but what about when the pilot throttles up to fly out? As the pilot throttles up, the torque increases, which causes the entire helicopter to do a pirouette or two, until the torque levels out again. The effect has caused more than one beginner pilot to come nose to nose with their R/C heli.
The solution to this problem was gyroscopes, heavy brass spinning weights that tilted in response to the helicopter’s motion. A hall effect sensor would detect that tilt and command the tail rotor to counteract the helicopter’s rotation. As the years wore on, mechanical gyros were replaced by solid state MEMS gyros. Microcontrollers entered the picture and brought with them advanced processing techniques. Heading hold gyros were then introduced. Whereas older “rate only” gyros would drift, weathervane, and wiggle, heading hold gyros would lock down the helicopter’s nose until the pilot commanded a turn. These single axis flight controllers were quickly adopted by the R/C helicopter community.
Today’s flight control systems have many sensors available to them – GPS, barometric pressure sensors, airspeed sensors, the list goes on. The major contributors to the flight calculations are still the gyros, coupled with accelerometers. As the name implies, accelerometers measure acceleration – be it due to gravity, a high G turn, or stopping force. Accelerometers aren’t enough though – An accelerometer in free fall will measure 0 G’s. Turning forces will confuse a system trying to operate solely on accelerometer data. That’s where gyros come in. Gyros measure rate of rotation about an axis. Just as our helicopter example above covered yaw, gyros can be used to measure pitch and roll of an aircraft. A great comparison of gyros and accelerometers is presented in this video from InvenSense.
After going to an SMD soldering workshop at the Stuttgart hackerspace ShackSpace, [Corvus] decided to be an over achiever and build a flight controller for his very own unmanned aerial vehicle.
The airplane itself is a regular store-bought foam contraption, and not terribly interesting in and of itself. Autonomous flight piques some interest, though. A custom flight controller PCB was designed and built by [Corvus] to work alongside a tiny STM32 Linux board. These two boards, combined with the OpenPilot project allow the plane to keep altitude, bearing, speed, and position in check autonomously. Telemetry between the ground station and vehicle is handled by UAVTalk and a ThinkPad.
In the video after the break, [Corvus] piloted the plane up to altitude, then directed it to fly 500 meters North and turn around. The result was an autonomous flight of over one kilometer. The next stage of the project is implementing some SLAM applications with optical path finding and obstacle avoidance.