-
Notifications
You must be signed in to change notification settings - Fork 19
How to make an LG G8 Flow Pilot Device
-
Get an LG G8. It doesn't have to be pretty. Mine had a cracked screen. Ideally you find one with a cracked back for cheap, as you'll be removing the back anyway. I recommend the Verizon version (what I used successfully to root). DO NOT GET THE AT&T VERSION which is apparently harder to root.
-
Unlock and root the LG G8: https://forum.xda-developers.com/t/guide-lg-g8-g8x-v50-bootloader-unlock-and-magisk-root-using-firehose.4221793/ It is long, but if you follow the instructions carefully, you will only need to do this once. You might be able to root easier by installing the Magisk APK via Lineage's Recovery mode (which I think you can just select it as an "apply update" via sideloading).
-
Install TWRP, which will help you with the next step: https://unofficialtwrp.com/lg-g8-root-twrp/ I didn't do any of the Nandroid backups or "verify opt" stuff... you just need TWRP 3.3.1.
-
Install Lineage 20 on it and root it again: https://forum.xda-developers.com/t/rom-adnroid13-alphalm-unofficial-lineage-20-lg-g8-g820.4578915/ You can use TWRP to install it. Also install Magisk APK to root your Lineage.
-
Follow this simplified guide to get all of the software required for Flow Pilot installed: https://github.com/phr00t/flowpilot/wiki/Simplified-Flow-Pilot-Install-Process
-
You will need to do the Camera "F3" hack so the Flow Pilot app can access the wide camera, first read this (but you won't use this method): https://github.com/flowdriveai/flowpilot/wiki/F3-(Experimental)#enable-access-to-wide-angle-cam-for-flowpilot-requires-root That method usually stops working after awhile! For a more permanent fix, add a setprop command to /system/etc/init/hw/init.rc "on boot" section like "setprop vendor.camera.aux.packagelist net.sourceforge.opencamera,ai.flow.android". In order to edit that init.rc file, you will likely need to remount /system as 'read write' with the "sudo mount -o rw,remount /system" command.
-
Use the Black/Red panda instructions for hooking it up to your car: https://github.com/flowdriveai/flowpilot/wiki/Connecting-to-Car You may not need the RJ45 cable and OBD2 power cable if you have an "all-in-one" mini panda from Mr.one @ https://www.aliexpress.us/item/3256804517998226.html as it has a 12v out pin (you will need a connector for that @ https://www.aliexpress.us/item/3256805177074547.html) -- it is the upper corners that provide +12v and ground, closest to the connector tab if I recall correctly. I also recommend getting an OTG cable that has both data AND power ports, so you can find multiple ways to power your device.
-
Ideally, you will remove the battery from the LG G8 and power it directly from the car. Having a battery in the phone isn't ideal as it could pose a fire hazard being in heat and charging constantly. This part is tricky, but basically you need to tear the back off and pull the battery out: https://www.youtube.com/watch?v=jXz7NVX_O-A
-
With the battery out, carefully remove the top of the battery that has the connector attached to it. This connector has two big pads that you can solder power lines to like this: https://www.youtube.com/watch?v=7f8SliNGeDM This video also explains how to power it properly with a diode to keep it "charging" so the battery level doesn't drop.
-
You will need to convert 12v to ~5v from the Mr.one mini panda to power the phone if you remove the battery. I used this guy to do that: https://www.amazon.com/gp/product/B07JZ2GQJF/ (I attached my MUR460 diode to this). Make sure you double-check the diode is operational and directed the right way!
-
You also will ideally provide additional cooling for your LG G8, as running advanced driving models can get it toasty. I first reapplied thermal paste to the heat pipe seen in the step 7 video. I then purchased these 12v fans: https://www.amazon.com/gp/product/B07JPBMNVL/ and heatsinks: https://www.amazon.com/gp/product/B082RWXFR2/ to stick on metal parts on the back. Make sure not to put the fan too close to the cameras and block their view! The little heatsinks didn't seem to block the camera for me when sticking them on the silver-colored metal sections just below the camera. You also want heatsinks along the side silver metal areas. Ideally the fan will be blowing across these heatsinks. Make sure you leave room for the grabby mounting thing below on the opposite side of the cameras.
-
You'll need to mount it on your windshield. I used this with a 3M sticky pad: https://www.amazon.com/gp/product/B00BPRLV8M/ You will also need a phone grabber, which I got from this: https://www.amazon.com/gp/product/B09W8KG7K7/ (the claw part you don't need, I just used that for testing... you just need the spring-loaded phone grabber with the screw connector). You might be able to find the phone grabber separately. Once I had it mounted exactly straight, I used hot glue to reinforce the junctions to make sure it doesn't wiggle out of place.
-
Connect everything up, calibrate and hopefully it works!
You will likely need to do lots of tweaking and planning ahead, as this is very involved and lots of things can go wrong. There is no guarantee this will work for you and things could be dangerous, like removing the battery or relying on this device to drive your car. You are taking this risk, just as I took the risk myself. This fork is designed for the LG G8, but also for my Kona EV 2019 without "smart" cruise control, so you may need to make some modifications for it to work with your car (especially if it is a Hyundai with "smart" cruise control).
-
You will want your LG G8 to boot right into Flow Pilot when it turns on, which you can have it "reboot" when the "charger" is connect into Lineage (and flow Pilot can be set as your default "Home"). I found this to work for me: https://android.stackexchange.com/a/221384 (specifically creating an rc file with "on charger" then "setprop sys.powerctl reboot,leaving-off-mode-charging" parameters as shown). If you want to cut boot time further, a simple rubber band that holds down the power button works!
-
You can disable the boot animation for a little quicker boot: https://xdaforums.com/t/possibly-faster-boot-disable-boot-animation.2116754/
-
Using ScreenCam app (https://f-droid.org/en/packages/com.orpheusdroid.screenrecorder/) to record on-screen videos helps debug model output like lanelines. I also installed the Tile Shorcuts: Quick Settings app to make application launchers in the notification bar, so I could launch things like ScreenCam and droidVNC (https://f-droid.org/en/packages/net.christianbeier.droidvnc_ng/) to manage the device remotely.
-
I recommend configuring your device to open up adb access via TCP/IP on boot like this: https://forum.xda-developers.com/t/how-to-make-adb-listen-to-tcpip-5555-after-reboot.1825359/#post-30031611 It will let you push APKs and get logcats easily from your Flow Pilot device using ADB remotely.
-
If you need intrinsics for your camera and want to know what they are, you can try this app: https://github.com/vyi/android-camera-calibration
-
Tuning is critical! Some common things you'll need to modify is CAMERA_OFFSET in lane_planner.py (depending on how far to the left or right you mounted your device) and steering bias offset (seen in carstate.py steeringAngleDeg for your car, you may need to +/- that number).
-
Make sure you have "Suspend Execution for Cached Apps" explicitly DISABLED in Developer Settings on your LG G8. You also want all of your apps (Flow Pilot, Termux etc.) battery usage set to Unrestricted. You don't want Android deciding not to run these processes!