Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openpilot v0.3.8.2 #146

Merged
merged 3 commits into from
Nov 4, 2017
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile.openpilot
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ COPY ./selfdrive /tmp/openpilot/selfdrive
COPY ./phonelibs /tmp/openpilot/phonelibs
COPY ./pyextra /tmp/openpilot/pyextra

RUN mkdir /tmp/openpilot/selfdrive/test/out
RUN mkdir -p /tmp/openpilot/selfdrive/test/out
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.PHONY: all

# TODO: Add a global build system to openpilot
code_dir := $(shell pwd)

# TODO: Add a global build system

.PHONY: all
all:
cd /data/openpilot/selfdrive && PYTHONPATH=/data/openpilot PREPAREONLY=1 /data/openpilot/selfdrive/manager.py
cd selfdrive && PYTHONPATH=$(code_dir) PREPAREONLY=1 ./manager.py

16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Here are [some](https://www.youtube.com/watch?v=9OwTJFuDI7g) [videos](https://ww
Hardware
------

Right now openpilot supports the [neo research platform](http://github.com/commaai/neo) for vehicle control. We'd like to support other platforms as well.
Right now openpilot supports the [NEO research platform](http://github.com/commaai/neo) and the [EON Dashcam DevKit](https://shop.comma.ai/products/eon-dashcam-devkit). We'd like to support other platforms as well.

Install openpilot on a neo device by entering ``https://openpilot.comma.ai`` during NEOS setup.

Expand All @@ -26,15 +26,25 @@ Supported Cars
- Due to limitations in steering firmware, steering is disabled below 12 mph
- Note that the hatchback model is not supported

- Honda CR-V Touring 2015-2016 (very alpha!)
- Honda CR-V Touring 2015-2016
- Can only be enabled above 25 mph

- Toyota RAV-4 2016+ with TSS-P (alpha!)
- Can only be enabled above 20 mph

In Progress Cars
------

- Toyota Prius 2017

- Probably all TSS-P Toyota

Community Ported Cars
------

- Chevy Volt 2016-2018 Premier with Driver Confidence II

- All 2017 Toyota Prius, Corolla, and RAV4
- Classic Tesla Model S (pre-AP)

Directory structure
------
Expand Down
7 changes: 7 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 0.3.8.2 (2017-10-30)
==========================
* Add alpha support for 2017 Toyota RAV4
* Smoother lateral control
* Stay silent if stock system is connected through giraffe
* Minor bug fixes

Version 0.3.7 (2017-09-30)
==========================
* Improved lateral control using model predictive control
Expand Down
79 changes: 58 additions & 21 deletions SAFETY.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,73 @@
openpilot Safety
======

openpilot is an Adaptive Cruise Control and Lane Keeping Assist System. Like
other ACC and LKAS systems, openpilot requires the driver to be alert and to pay
attention at all times. We repeat, **driver alertness is necessary, but not
openpilot is an Adaptive Cruise Control (ACC) and Lane Keeping Assist (LKA) system.
Like other ACC and LKA systems, openpilot requires the driver to be alert and to
pay attention at all times. We repeat, **driver alertness is necessary, but not
sufficient, for openpilot to be used safely**.

Even with an attentive driver, we must make further efforts for the system to be
safe. We have designed openpilot with two other safety considerations.

1. The vehicle must always be controllable by the driver.
1. The driver must always be capable to immediately retake manual control of the vehicle,
by stepping on either pedal or by pressing the cancel button.
2. The vehicle must not alter its trajectory too quickly for the driver to safely
react.
react. This means that while the system is engaged, the actuators are constrained
to operate within reasonable limits.

To address these, we came up with two safety principles.
Following are details of the car specific safety implementations:

1. Enforced disengagements. Step on either pedal or press the cancel button to
retake manual control of the car immediately.
- These are hard enforced by the board, and soft enforced by the software. The
green led on the board signifies if the board is allowing control messages.
- Honda CAN uses both a counter and a checksum to ensure integrity and prevent
replay of the same message.
Honda/Acura
------

- While the system is engaged, gas, brake and steer limits are subject to the same limits used by
the stock system.

- Without an interceptor, the gas is controlled by the Powertrain Control Module (PCM).
The PCM limits acceleration to what is reasonable for a cruise control system. With an
interceptor, the gas is clipped to 60%.

2. Actuation limits. While the system is engaged, the actuators are constrained
to operate within reasonable limits; the same limits used by the stock system on
the Honda.
- Without an interceptor, the gas is controlled by the PCM. The PCM limits
acceleration to what is reasonable for a cruise control system. With an
interceptor, the gas is clipped to 60% in longcontrol.py
- The brake is controlled by the 0x1FA CAN message. This message allows full
braking, although the board and the software clip it to 1/4th of the max.
This is around .3g of braking.
- Steering is controlled by the 0xE4 CAN message. The EPS controller in the
car limits the torque to a very small amount, so regardless of the message,
the controller cannot jerk the wheel.

- Steering is controlled by the 0xE4 CAN message. The Electronic Power Steering (EPS)
controller in the car limits the torque to a very small amount, so regardless of the
message, the controller cannot jerk the wheel.

- Brake and gas pedal pressed signals are contained in the 0x17C CAN message. A rising edge of
either signal triggers a disengagement, which is enforced by the board and in software. The
green led on the board signifies if the board is allowing control messages.

- Honda CAN uses both a counter and a checksum to ensure integrity and prevent
replay of the same message.

Toyota
------

- While the system is engaged, gas, brake and steer limits are subject to the same limits used by
the stock system.

- With the stock Driving Support Unit (DSU) enabled, the acceleration is controlled
by the stock system and is subject to the stock adaptive cruise control limits. Without the
stock DSU connected, the acceleration command is controlled by the 0x343 CAN message and its
value is limited by the board and the software to between .3g of deceleration and .15g of
acceleration. The acceleration command is ignored by the Engine Control Module (ECM) while the
cruise control system is disengaged.

- Steering torque is controlled through the 0x2E4 CAN message and it's limited by the board and in
software to a value of -1500 and 1500. In addition, the vehicle EPS unit will not respond to
commands outside these limits. A steering torque rate limit is enforced by the board and in
software so that the commanded steering torque must rise from 0 to max value no faster than
1.5s. Commanded steering torque is limited by the board and in software to be no more than 500
units above the actual EPS generated motor torque to ensure limited differences between
commanded and actual torques.

- Brake and gas pedal pressed signals are contained in the 0x224 and 0x1D2 CAN messages,
respectively. A rising edge of either signal triggers a disengagement, which is enforced by the
board and in software. Additionally, the cruise control system disengages on the rising edge of
the brake pedal pressed signal.

- The cruise control system state is contained in the 0x1D2 message. No control messages are
allowed if the cruise control system is not active. This is enforced by the software and the
board. The green led on the board signifies if the board is allowing control messages.
15 changes: 11 additions & 4 deletions cereal/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
PWD := $(shell pwd)

SRCS := log.capnp car.capnp

GENS := gen/cpp/car.capnp.c++ gen/cpp/log.capnp.c++


UNAME_M ?= $(shell uname -m)

# only generate C++ for docker tests
Expand All @@ -16,6 +17,12 @@ endif

endif

ifeq ($(UNAME_M),aarch64)
CAPNPC=PATH=$(PWD)/../phonelibs/capnp-cpp/aarch64/bin/:$$PATH capnpc
else
CAPNPC=capnpc
endif

.PHONY: all
all: $(GENS)

Expand All @@ -26,17 +33,17 @@ clean:
gen/c/%.capnp.c: %.capnp
@echo "[ CAPNPC C ] $@"
mkdir -p gen/c/
capnpc '$<' -o c:gen/c/
$(CAPNPC) '$<' -o c:gen/c/

gen/cpp/%.capnp.c++: %.capnp
@echo "[ CAPNPC C++ ] $@"
mkdir -p gen/cpp/
capnpc '$<' -o c++:gen/cpp/
$(CAPNPC) '$<' -o c++:gen/cpp/

gen/java/Car.java gen/java/Log.java: $(SRCS)
@echo "[ CAPNPC java ] $@"
mkdir -p gen/java/
capnpc $^ -o java:gen/java
$(CAPNPC) $^ -o java:gen/java

# c-capnproto needs some empty headers
gen/c/c++.capnp.h gen/c/java.capnp.h:
Expand Down
24 changes: 21 additions & 3 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
modelCommIssue @27;
brakeHold @28;
parkBrake @29;
manualRestart @30;
lowSpeedLockout @31;
}
}

Expand All @@ -63,6 +65,9 @@ struct CarState {

# car speed
vEgo @1 :Float32; # best estimate of speed
aEgo @16 :Float32; # best estimate of acceleration
vEgoRaw @17 :Float32; # unfiltered speed
standstill @18 :Bool;
wheelSpeeds @2 :WheelSpeeds;

# gas pedal, 0.0-1.0
Expand All @@ -75,6 +80,7 @@ struct CarState {

# steering wheel
steeringAngle @7 :Float32; # deg
steeringRate @15 :Float32; # deg/s
steeringTorque @8 :Float32; # TODO: standardize units
steeringPressed @9 :Bool; # if the user is using the steering wheel

Expand Down Expand Up @@ -242,6 +248,9 @@ struct CarParams {
enableGas @4 :Bool;
enableBrake @5 :Bool;
enableCruise @6 :Bool;
enableCamera @27 :Bool;
enableDsu @28 :Bool; # driving support unit
enableApgs @29 :Bool; # advanced parking guidance system

minEnableSpeed @18 :Float32;
safetyModel @19 :Int16;
Expand All @@ -253,11 +262,15 @@ struct CarParams {
brakeMaxBP @24 :List(Float32);
brakeMaxV @25 :List(Float32);

longPidDeadzoneBP @33 :List(Float32);
longPidDeadzoneV @34 :List(Float32);

enum SafetyModels {
# from board
default @0;
# does NOT match board setting
noOutput @0;
honda @1;
toyota @2;
elm327 @3;
}

# things about the car in the manual
Expand All @@ -276,7 +289,12 @@ struct CarParams {
# Kp and Ki for the lateral control
steerKp @16 :Float32;
steerKi @17 :Float32;
steerKf @26 :Float32;

steerLimitAlert @30 :Bool;

vEgoStopping @31 :Float32; # Speed at which the car goes into stopping state
directAccelControl @32 :Bool; # Does the car have direct accel control or just gas/brake

# TODO: Kp and Ki for long control, perhaps not needed?
}

Loading