Difference between revisions of "Tesla"

From comma wiki
Jump to: navigation, search
(First Troubleshooting steps:)
(Here's what you'll need to get OpenPilot working on your pre-AP Tesla)
Line 73: Line 73:
*Custom Giraffe and Wiring harness for the Model S.
*Custom Giraffe and Wiring harness for the Model S.
**There are 2 variations based on your car manufacture date (before or after May 31, 2013). If you are unsure, check if the OBD connector in your driver foot well is the [https://files.slack.com/files-pri/T02Q83UUV-FBA7L8727/obd.jpg newer style with metal contacts for pins 1 and 9]
**There are 2 variations based on your car manufacture date (before or after May 31, 2013). If you are unsure, check if the OBD connector in your driver footwell is the [https://files.slack.com/files-pri/T02Q83UUV-FBA7L8727/obd.jpg newer style with metal contacts for pins 1 and 9]
**Contact @appleguru in the #tesla channel on the comma slack to arrange purchase.
**Contact @appleguru in the #tesla channel on the comma slack to arrange purchase.
**Approximately $50 in parts for the giraffe, $10 for a case, and $25 in parts for the harness. Will cost more after assembly and shipping
**Approximately $50 in parts for the giraffe, $10 for a case, and $25 in parts for the harness. Will cost more after assembly and shipping

Revision as of 22:09, 19 June 2018

Welcome to the Tesla Openpilot Wiki!

We're just getting started filling this out, so feel free to jump in and help document things that need to be here.

This port is currently focused on the Pre-AP Teslas from 2014 and earlier. The EPAS (Electric Power Assisted Steering) unit on these pre-AP Teslas is capable of steering itself based on electronic commands like the AP1 and 2 Teslas, but since they don't have autopilot there's a kill signal that is sent to disable this feature. Because of this, we have to proxy the CAN-bus messages through the panda which will alter that kill signal and change it to an enable signal. To accomplish this, you have to remove the frunk liner to get at the EPAS unit, and unplug the factory cable and plug in a bypass cable that allows for this proxying. This cabling also allows OpenPilot to send the steering commands to the car.

Community ToDo List

  • Need a writeup of creating the wiring harness for EPAS bypass
  • Need a writeup of installing the wiring harness
  • Need to compare comma code with ours, regarding continue.sh / launch_openpilo.sh / launch_chffr.sh so that on reboot it fetches our repo (auto update). Not all users want to ssh in to update
  • Open source giraffe hardware
  • Code change to OP port to auto flash panda
  • Add longitudinal control (this is a much larger issue than 1 bullet point)
  • Further testing of EPAS enable spamming
  • Have more Teslas using OP than any other car!!! :)

Confirmed Users with Working OP
1 Kalud 0.4.7
2 zax123 0.3.5 (until next week)
3 Bobby 0.4.7
4 SteveRadich 0.4.7
5 BogGyver
6 RobP
7 Edgar
10 TBD
Bounty claimed!

Here's what you'll need to get OpenPilot working on your pre-AP Tesla

  • Panda (white $99, grey $199)
    • Grey Panda includes high accuracy GPS which OpenPilot may use for more accurate steering in the future. So Grey is recommended but not strictly necessary today.
  • Custom Giraffe and Wiring harness for the Model S.
    • There are 2 variations based on your car manufacture date (before or after May 31, 2013). If you are unsure, check if the OBD connector in your driver footwell is the newer style with metal contacts for pins 1 and 9
    • Contact @appleguru in the #tesla channel on the comma slack to arrange purchase.
    • Approximately $50 in parts for the giraffe, $10 for a case, and $25 in parts for the harness. Will cost more after assembly and shipping

Total price of parts is approximately $1,000.

Instructions to set it all up

(this is very much in progress and not yet complete)

  • Make sure your Eon is up to date This will bring you to the latest version of OpenPilot and update your EON to the latest version of NEOS. If you have problems they aren't Tesla related, check the other wiki / slack places.
  • Install the wiring harness to the EPAS unit and the OBDII port in the driver footwell
  • Install Panda on Giraffe OBDII port (driver footwell)
  • Run the 10 foot USB cable from the EON along your headliner, down the driver side A-Pillar, and down to the Panda
  • Connect EON to Panda via USB cable
  • Install custom tesla branch of OpenPilot on your EON by doing the following:
cd /data
mv openpilot openpilot.stock
git clone https://github.com/jeankalud/openpilot.git
cd openpilot
git checkout tesla
  • Update your Panda while SSH'ed in and Panda connected to ODB port and EON connected to Panda via USB (perhaps) - automated soon - Do we need to do this without data on bus?
cd /data/openpilot/panda/board
killall boardd
make clean
make recover


First Troubleshooting steps:

  • Try a different USB cable (a shorter one, or one with EMI filter)
  • Make sure you're using the correct tesla repo
  • run make in /data/openpilot/panda/board
  • make sure CAN-H and CAN-L are not reversed.
  • make sure there is a 120 ohms resistor across CAN-H and CAN-L going to the EPAS (power steering)
  • if using a custom harness ensure these:
    • car CAN on panda port 1 (first port)
    • EPAS CAN on last on port 3 (last one)
  • If it should really work, right code, right wiring, right everything, always try: Shutdown car ("Power Off" in car settings), wait a few sec and try again.
  • If you've broken your source control (wrong git command, etc) you can always backup/check out from scratch:
cd /data
mv openpilot openpilot.bak
git clone https://github.com/jeankalud/openpilot
cd openpilot
git checkout tesla
cd panda/board
make clean
make recover

How to change to the development branch of the Tesla OP port

Here's the commands to run on your EON to switch to the tesla_devel branch of the code

cd /data/openpilot
git fetch
git checkout tesla_devel
cd /data/openpilot/panda/board

How to transfer files to your EON

Sometimes while testing or debugging issues you may want to manually transfer files to your EON. One easy way to do this is to use the popular FTP client Filezilla.

  1. Enable SSH. Click on "Settings" in OpenPilot and make sure the "Enable SSH" option is turned on.
  2. Next find the ip address of your EON. Under Settings > Wifi settings > Advanced (click on the 3 dots in the upper right hand corner) scroll all the way to the bottom to find IP. (Make sure your EON is on the same wifi as your computer)
  3. Create a file called openpilot.ppk and save the text at the bottom of this section in it.
  4. In Filezilla, go to your Site Manager and create a new entry for your EON and enter the IP address you found in the Host field. The port is 8022. The protocol should be SFTP. Logon Type will be "Key File". User is "root". Key file is the file you just created. Then hit connect.

If you're having issues connecting, check to make sure you can ping your device on the IP you found. If ping doesn't work, then SSH won't either. You can try turning wifi off and then on again if you can't connect.

All the settings listed above can be used to connect via PuTTY as well for command line access. You specify the keyfile in the settings under Connection -> SSH -> Auth -> Private key for authentication

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: imported-openssh-key
Public-Lines: 6
Private-Lines: 14
Private-MAC: 2af7f5a599fa35e22392b7770a2eb7a0be8718b7

Most of the action is happening in the #tesla channel on the comma slack: https://comma.slack.com

Current Tesla branch URL: https://github.com/jeankalud/openpilot/

Some background info on the tesla port: http://openpilot.robertcotran.com/


AntiLock Braking System, iBooster - a component that allows brakes to applied via electronic control, Electronic Stability Program. These are parts of the automatic braking system that are found on AP1 and later cars. Using EON to control brakes is not feasibly possible on pre-AP Teslas. There has been some talk of upgrading AP0 Teslas to have this hardware, but this is a major undertaking and requires root access.
AP, AP0, AP1, AP2, AP2.5
Tesla AutoPilot. AP0 or pre-AP means no AutoPilot. AP1 is the version 1 using Mobileye technology. AP2 ditched the Mobileye components and is all Tesla parts and software. AP2.5 is upgraded AP2 hardware.
Comma's system for playing back and showing the recorded data from uploaded drives.
Controller Area Network This is a network system inside cars that allow messages to be sent to different auto components.
Chassis Can
Steering and braking controls are found on this CAN-bus, so this is the main one that OP uses.
Driver assistance system - the AP1 camera/computer module located behind the windshield on AP1 hardware cars
DataBase Container These are files that contain the definitions of the messages cars send on the CAN-bus.
Diag, Diag port
Diagnostic port that can be found under the MCU (screen) in a Tesla. Chassis-CAN is able to be accessed from this port.
Double Pole Double Throw. It's a type of switch that some use in their wiring harness.
Main hardware component that Comma sells. It's the brains that runs OpenPilot.
Electronic Power (Assisted) Steering. This component allows OP to move the steering wheel.
Process of installing software on embedded hardware.
Piece of hardware that allows the Panda to interface with the OBD port in the car.
Instrument Cluster. The screen behind the steering wheel that has the speedometer on a Tesla.
Lane Keeping Assist System. System built into cars to automatically steer to keep the car in the current lane.
Media Control Unit - The big screen in a Tesla.
Mid Range Radar. Modern cars use radar units to see objects around the car. Pre-AP Teslas don't have any radar units.
MS, MX, M3
Model S, Model X, Model 3. The current Tesla lineup.
The predecessor to the EON. A customized OnePlus3 phone with a custom hardware board attached that also can run OpenPilot.
The operating system softare that runs on the EON.
OnBoard Diagnostics This is a port in the driver footwell that would normally provide emissions diagnostics on most cars, but is useless for that on Teslas. For Teslas built after May 31, 2013, Chassis CAN-bus is able to be accessed from this port.
Piece of Comma hardware that plugs into the OBD port to access the Chassis CAN-bus to send steering and braking messages from OpenPilot running on the EON.
Printed Circuit Board
Powertrain Control Module. This component basically tells the car how much power to put out to make the car go.
PR, pull request, merge
Pull requests or merge refers to a request to integrate code written by others to be "pulled" into the OpenPilot software maintained by Comma.
Repo, git repo
Repository where software is stored. The code for the Tesla version of OpenPilot currently sits in a different repo than the main OpenPilot code.
root, root access
Process of gaining access into the Tesla sofware system at a root level that allows access internal diagnostic not normally available and also allows for changes to be made to the Tesla software.
Steering Column Control Module - This component is part of the steering column and controls all the messages sent from the buttons on the steering wheel as well as the cruise control stalk.
State Of Charge. The percent of power left in your car's battery pack.
Secure SHell - a method of connecting to your EON in order to be able to make changes to it and issue commands for it to run.