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

Fix/throttle override not published #319

Open
wants to merge 23 commits into
base: maint/throttle-override
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4aad545
Add signed value to brake request
rebpdx Jun 27, 2018
fb13172
Merge pull request #296 from PolySync/fix/dbc-not-signed
shnewto Jun 27, 2018
cf05d79
Build in docker
Jul 24, 2018
9f5a978
Remove D-CAN filters
Jul 31, 2018
ca8bca0
Add Soul EV throttle CAN-ID
Jul 31, 2018
04b208b
Merge pull request #301 from PolySync/remove-dcan-filters
cotos Jul 31, 2018
c8c742d
Increase required steering torque to override
Jul 31, 2018
eb6b8d0
Add docker.build call
rebpdx Aug 1, 2018
67e96b3
Add Niro throttle CAN-ID
Aug 2, 2018
7552015
Merge pull request #303 from PolySync/add-niro-throttle-can-id
cotos Aug 3, 2018
5bd83a3
Merge pull request #305 from PolySync/maint/increase-steering-overrid…
cotos Aug 6, 2018
07d0787
Merge pull request #300 from PolySync/docker-based-build
shnewto Aug 6, 2018
3e05c6a
Clean working directory
rebpdx Aug 9, 2018
b3bbab8
Move checkout inside try block
rebpdx Aug 9, 2018
9e740a6
Merge pull request #306 from PolySync/maint/clean-workspace
Aug 9, 2018
2f1dc29
Add EV & Niro vehicle speed can ids
Aug 20, 2018
f7cef6d
Merge pull request #309 from PolySync/add-vehicle-speed-can-ids
shnewto Aug 20, 2018
8ba2872
reduce BREAK_PEDAL_OVERRIDE_THRESHOLD
evanlivingston Aug 21, 2018
0a60389
Fix jenkins workspace cleanup
rebpdx Aug 21, 2018
bfa3f4a
Merge pull request #311 from PolySync/bug/fix-jenkins-cleanup
cotos Aug 21, 2018
fcfe5f7
correct comment
Sep 19, 2018
8a163e5
Merge pull request #310 from PolySync/fix/decrease-brake-pedal-overri…
cotos Sep 19, 2018
e82ac40
Throttle operator override not being published
cotos Sep 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 50 additions & 0 deletions Dockerfile
@@ -0,0 +1,50 @@
FROM ubuntu:16.04

WORKDIR /app

# common packages
RUN apt-get update && \
apt-get install -y \
ca-certificates curl file tar clang libclang-dev \
build-essential cmake libssl-dev zlib1g-dev \
ruby-dev libboost-dev git wget && \
rm -rf /var/lib/apt/lists/*

# install cucumber package
RUN gem install cucumber -v 2.0.0 --no-rdoc --no-ri

# install rust toolchain
env RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo

RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain 1.20.0 -y

env PATH=/usr/local/cargo/bin:${PATH}

# install arduino toolchain
RUN wget -nv http://arduino.cc/download.php?f=/arduino-1.8.5-linux64.tar.xz -O arduino-1.8.5.tar.xz

RUN tar -xf arduino-1.8.5.tar.xz && \
cd arduino-1.8.5 && \
mkdir -p /usr/share/arduino && \
cp -R * /usr/share/arduino


# Fetch and build cargo deps
RUN mkdir src && echo "fn main() { }" >> build.rs && touch src/tests.rs

COPY ./firmware/brake/kia_soul_ev_niro/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/brake/kia_soul_petrol/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/common/libs/pid/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/steering/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/throttle/tests/property/Cargo.toml .
RUN cargo build
114 changes: 62 additions & 52 deletions Jenkinsfile
@@ -1,60 +1,70 @@
#!groovy

def cleanCheckout() {
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [[$class: 'CleanBeforeCheckout']],
userRemoteConfigs: scm.userRemoteConfigs
])
}
node {
checkout scm

def image = docker.build("cmake-build:${env.BUILD_ID}")

def builds = [:]
def output = image.inside {
sh returnStdout: true, script: "cmake -LA ./firmware | grep 'VEHICLE_VALUES' | cut -d'=' -f 2"
}

def platforms = output.trim().tokenize(';')

for(int j=0; j<platforms.size(); j++) {
def platform_idx = j
def platform = platforms[platform_idx]
builds[platform] = {
node {
checkout scm

image = docker.build("cmake-build:${env.BUILD_ID}")

node('worker'){
def builds = [:]
cleanCheckout()
def output = sh returnStdout: true, script: "cmake -LA ./firmware | grep 'VEHICLE_VALUES' | cut -d'=' -f 2"
def platforms = output.trim().tokenize(';')

for(int j=0; j<platforms.size(); j++) {
def platform_idx = j
def platform = platforms[platform_idx]
builds[platform] = {
node('arduino') {
try {
stage("Checkout") {
cleanCheckout()
}
stage("Build ${platform}") {
sh "cd firmware && mkdir build_${platform} && cd build_${platform} \
&& cmake -DVEHICLE=${platform} -DCMAKE_BUILD_TYPE=Release .. && make"
echo "${platform}: Build Complete!"
}
stage("Test ${platform} unit tests") {
sh "cd firmware && mkdir build_${platform}_tests && \
cd build_${platform}_tests && cmake -DVEHICLE=${platform} \
-DTESTS=ON -DPORT_SUFFIX=${EXECUTOR_NUMBER}${platform_idx} \
-DCMAKE_BUILD_TYPE=Release .. && make run-unit-tests"
echo "${platform}: Unit Tests Complete!"
}
stage("Test ${platform} property-based tests") {
withEnv(["PATH+CARGO=$HOME/.cargo/bin"]) {
sh "cd firmware/build_${platform}_tests && make run-property-tests"
echo "${platform}: Property-Based Tests Complete!"
stage("Build ${platform}") {
image.inside {
sh "cd firmware && \
rm -rf build_${platform} && \
mkdir build_${platform} && \
cd build_${platform} && \
cmake -DVEHICLE=${platform} -DCMAKE_BUILD_TYPE=Release .. && \
make"

echo "${platform}: Build Complete!"
}
}

stage("Test ${platform} unit tests") {
image.inside {
sh "cd firmware && \
rm -rf build_${platform}_tests && \
mkdir build_${platform}_tests && \
cd build_${platform}_tests && \
cmake -DVEHICLE=${platform} \
-DTESTS=ON \
-DPORT_SUFFIX=${EXECUTOR_NUMBER}${platform_idx} \
-DCMAKE_BUILD_TYPE=Release \
.. && \
make run-unit-tests"
echo "${platform}: Unit Tests Complete!"
}
}

stage("Test ${platform} property-based tests") {
image.inside("--user root:root") {
sh "cd firmware/build_${platform}_tests && \
make run-property-tests"
echo "${platform}: Property-Based Tests Complete!"
}
}
}
}
}
finally {
deleteDir()
}
}
}
}

try {
parallel builds
}
finally {
deleteDir()
}

try {
parallel builds
}
finally {
deleteDir()
}
}
2 changes: 1 addition & 1 deletion api/include/can_protocols/oscc.dbc
Expand Up @@ -44,7 +44,7 @@ BO_ 113 BRAKE_DISABLE: 8 BRAKE

BO_ 114 BRAKE_COMMAND: 8 BRAKE
SG_ brake_command_magic : 0|16@1+ (1,0) [0|0] "" BRAKE
SG_ brake_command_pedal_request : 16|32@1+ (1,0) [0|1] "" BRAKE
SG_ brake_command_pedal_request : 16|32@1- (1,0) [0|1] "" BRAKE
SG_ brake_command_reserved : 48|16@1+ (1,0) [0|0] "" BRAKE

BO_ 115 BRAKE_REPORT: 8 BRAKE
Expand Down
14 changes: 10 additions & 4 deletions api/include/vehicles/kia_niro.h
Expand Up @@ -49,11 +49,17 @@
*/
#define KIA_SOUL_OBD_BRAKE_PRESSURE_CAN_ID ( 0x220 )

/*
* @brief ID of the Kia Niro's OBD throttle pressure CAN frame.
*
*/
#define KIA_SOUL_OBD_THROTTLE_PRESSURE_CAN_ID ( 0x371 )

/*
* @brief ID of the Kia Niro's OBD speed CAN frame.
*
*/
#define KIA_SOUL_OBD_SPEED_CAN_ID ( 0x371 )
#define KIA_SOUL_OBD_SPEED_CAN_ID ( 0x52A )

/*
* @brief Factor to scale OBD steering angle to degrees
Expand Down Expand Up @@ -233,10 +239,10 @@ typedef struct
BRAKE_SPOOF_HIGH_SIGNAL_VOLTAGE_MIN )

/*
* @brief Value of the accelerator position that indicates operator override. [steps]
* @brief Value of the brake position that indicates operator override. [steps]
*
*/
#define BRAKE_PEDAL_OVERRIDE_THRESHOLD ( 200 )
#define BRAKE_PEDAL_OVERRIDE_THRESHOLD ( 130 )

/*
* @brief Minimum value of the high spoof signal that activates the brake lights. [steps]
Expand Down Expand Up @@ -366,7 +372,7 @@ typedef struct
* override.
*
*/
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 1600 )
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 2000 )



Expand Down
14 changes: 13 additions & 1 deletion api/include/vehicles/kia_soul_ev.h
Expand Up @@ -49,6 +49,18 @@
*/
#define KIA_SOUL_OBD_BRAKE_PRESSURE_CAN_ID ( 0x220 )

/*
* @brief ID of the Kia Soul's OBD throttle pressure CAN frame.
*
*/
#define KIA_SOUL_OBD_THROTTLE_PRESSURE_CAN_ID ( 0x200 )

/*
* @brief ID of the Kia Niro's OBD speed CAN frame.
*
*/
#define KIA_SOUL_OBD_SPEED_CAN_ID ( 0x524 )

/*
* @brief Factor to scale OBD steering angle to degrees
*
Expand Down Expand Up @@ -339,7 +351,7 @@ typedef struct
* override.
*
*/
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 1600 )
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 2000 )



Expand Down
2 changes: 1 addition & 1 deletion api/include/vehicles/kia_soul_petrol.h
Expand Up @@ -407,7 +407,7 @@ typedef struct
* override.
*
*/
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 1600 )
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 2000 )



Expand Down
5 changes: 1 addition & 4 deletions api/src/oscc.c
Expand Up @@ -529,10 +529,7 @@ void oscc_update_status( int sig, siginfo_t *siginfo, void *context )

while( vehicle_can_bytes > 0 )
{
if ( obd_frame_callback != NULL &&
( rx_frame.can_id == KIA_SOUL_OBD_WHEEL_SPEED_CAN_ID ||
rx_frame.can_id == KIA_SOUL_OBD_BRAKE_PRESSURE_CAN_ID ||
rx_frame.can_id == KIA_SOUL_OBD_STEERING_WHEEL_ANGLE_CAN_ID ) )
if ( obd_frame_callback != NULL )
{
obd_frame_callback( &rx_frame );
}
Expand Down
3 changes: 1 addition & 2 deletions firmware/throttle/src/throttle_control.cpp
Expand Up @@ -61,8 +61,7 @@ void check_for_faults( void )

DEBUG_PRINTLN( "Bad value read from accelerator position sensor" );
}
else if ( operator_overridden == true
&& g_throttle_control_state.operator_override == false )
else if ( operator_overridden == true )
{
disable_control( );

Expand Down