Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ a.out
*.d
*.pyc
*.pyo
__pycache__/
.*.swp
.*.swo
.*.un~
Expand Down Expand Up @@ -91,3 +92,7 @@ build/

poetry.toml
Pipfile

# Porting documentation and reference (internal only)
taskguide/
openpilot-0.10.3/
178 changes: 178 additions & 0 deletions INSTALL_COMMA3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# Tesla Unity OpenPilot 0.10.3 - Comma 3 Installation Guide

## Prerequisites

- Comma 3 device with SSH access
- Pre-Autopilot Tesla Model S with Tinkla OBD-C interface
- WiFi network with device connected

## Pre-Installation Validation

Run on your development machine:
```bash
./scripts/validate_syntax.sh
```

This validates all Python syntax and Cap'n Proto schemas compile correctly.

## Installation Steps

### 1. Connect to Comma 3

```bash
# Find your device IP (check router or Comma Connect app)
ssh comma@<device-ip>
# Default password: comma
```

### 2. Stop OpenPilot

```bash
tmux kill-server
sudo systemctl stop comma
```

### 3. Backup Existing Installation

```bash
mv /data/openpilot /data/openpilot.bak
```

### 4. Transfer Files

From your development machine:
```bash
cd /Users/williamliu/Desktop/tesla_unity_C3

# Option A: Full sync (recommended)
rsync -avz --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' \
--exclude='openpilot-0.10.3' --exclude='.scons*' \
. comma@<device-ip>:/data/openpilot/

# Option B: SCP (slower, but works everywhere)
scp -r . comma@<device-ip>:/data/openpilot/
```

### 5. Set Permissions (on device)

```bash
ssh comma@<device-ip>
cd /data/openpilot
chmod +x scripts/*.sh launch_*.sh
```

### 6. Rebuild Cereal (on device)

```bash
cd /data/openpilot
scons -j4 cereal/
```

### 7. Reboot Device

```bash
sudo reboot
```

## Post-Installation Verification

### On-Device Validation

After reboot, SSH back in and run:
```bash
cd /data/openpilot
python3 scripts/validate_port.py
```

### Check Logs

```bash
# View openpilot startup logs
journalctl -u comma -f

# Check for errors
tail -f /data/log/error.txt
```

## Troubleshooting

### OpenPilot Won't Start

```bash
# Check system status
sudo systemctl status comma

# View full logs
journalctl -u comma --no-pager | tail -100
```

### Cereal Errors

If you see cereal-related errors, rebuild:
```bash
cd /data/openpilot
scons -c cereal/ # Clean
scons -j4 cereal/ # Rebuild
sudo reboot
```

### Import Errors

Check the specific import:
```bash
cd /data/openpilot
python3 -c "from selfdrive.controls import plannerd; print('OK')"
python3 -c "from selfdrive.car.tesla import carstate; print('OK')"
```

### Rollback

If issues occur, restore backup:
```bash
sudo systemctl stop comma
rm -rf /data/openpilot
mv /data/openpilot.bak /data/openpilot
sudo reboot
```

## What Was Changed

### Core Updates (0.10.3 Compatibility)

1. **cereal/log.capnp**: Added new structs
- `SelfdriveState` (state machine info)
- `DriverAssistance` (LDW warnings)
- `LiveDelayData` (latency tracking)
- New `LongitudinalPlan` fields: `aTarget`, `shouldStop`, `allowThrottle`, `allowBrake`

2. **cereal/car.capnp**: Added `CarOutput` struct

3. **cereal/services.py**: Added `QueueSize` for memory optimization

4. **selfdrive/controls/controlsd.py**: Now publishes `selfdriveState`

5. **selfdrive/controls/plannerd.py**: Added Lane Departure Warning integration

6. **selfdrive/controls/lib/ldw.py**: New file for LDW logic

7. **selfdrive/controls/lib/longitudinal_planner.py**: New output fields

8. **common/constants.py**: New file with CV constants

### Tesla-Specific Files (Preserved)

- `selfdrive/car/tesla/` - All files preserved and compatible
- Tinkla OBD-C interface support maintained

## Testing Recommendations

1. **Static Test**: Start car, don't drive, verify UI works
2. **Parking Lot Test**: Low-speed driving in safe area
3. **Road Test**: Normal driving with fallback driver ready

## Support

For issues specific to:
- Tesla integration: Check Tinkla community resources
- OpenPilot 0.10.3: Check comma.ai Discord
- This port: Review taskguide/ documentation
5 changes: 5 additions & 0 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ struct CarControl {
pitchDEPRECATED @9 :Float32;
}

# 0.10.3: New car output struct
struct CarOutput {
actuatorsOutput @0 :CarControl.Actuators;
}

# ****** car param ******

struct CarParams {
Expand Down
Loading