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

Kia and Hyundai Port #309

Closed
wants to merge 92 commits into from
Closed

Kia and Hyundai Port #309

wants to merge 92 commits into from

Conversation

emmertex
Copy link

This adds support for Kia and Hyundai.

Lateral Support Only.
No Panda Security.

Currently In Use by
Kia Sorento 2018 @ku7
Kia Stinger 2018 @TK211X
Hyundai Elantra 2017 @killian

espes and others added 30 commits July 29, 2017 07:41
Taiwanese Prius Prime fingerprint was identical to the regular prime (107 msgs.), but should really have 110.  I have the correct one in there now.
* Honda Pilot 2017 Port (commaai#161)

* Update README.md

* Update fingerprints.py

* Update carstate.py

* Update hondacan.py

* Update interface.py

* Update interface.py

* Update interface.py

* Update README.md

* Update README.md

* Update README.md

* Update fingerprints.py

* Update carstate.py

* Update hondacan.py

* Update interface.py

* Update carstate.py

* Update hondacan.py

* Update README.md

* Update fingerprints.py

* Update carstate.py

* Update carstate.py

* Update carstate.py

* Update hondacan.py

* Update interface.py

* Update carstate.py

* Update carstate.py

* Update Pilot Fingerprint

* Update fingerprints.py

* Give pilot its own definition and not use ILX

* add pilot argument

* Add Pilot interface

* Add pilot argument

* Update interface.py

* Parse Different gear on pilot

* Add steer max

* Fixed duplication of steer max value

* Adjust PID's for steering

* Update carcontroller.py

* Change Steer Ratio and wheelbase

* Update Steer fault values

Steer fault value of 3, does not seem to effect anything

* Update Kp,Ki Ratio

* Update interface.py

* Update readme for Pilot

* add pilot

* Update fingerprints.py

* Update carstate.py

* add signals

* add signal

* fix restricting video upload to wifi

* Dibs on SAFETY_GM numerical value

To match Panda repo.

* Safety Reference for Honda Bosch

* Update fingerprints.py (commaai#210)

Consolidated my fingerprint and removed duplicates and ordered the fingerprint for the RAV4H. Double Checked.

* Interpolate ki/kp for steering PID loop (commaai#200)

* Interpolate ki/kp for steering PID loop

Very much needed for the Volt port: car ping-pongs with low kp
on high speeeds, and the loop is unstable with high kp on
low speeds.

Also, removes "number or array?" logic from PIController,
now that all the callers use interpolation ofr ki/kp.

* Pass speed to steering PID loop for ki/kp interpolation

* Remove unused numbers import

* Slight changes to UI and Fingerprint for Odyssey Elite (commaai#196)

* Adding back drive time to UI

* Add fingerprint for Odyssey Elite

* Removed extended fingerprint for Elite

* Revert "Adding back drive time to UI"

This reverts commit b9b02f7.

* Squashed 'panda/' changes from 98f29a4..67d5208

67d5208 fix signedness issue in toyota safety
fe15d3f bump pandacan
11c2b08 add fault invalid
2c26e45 add sleep
27c7637 forgot the counter
3a6d7db don't hang
bfa7d2e canloader works
b259e2a can flasher is close to working
83f2edf isotp can support in softloader
7ae7c79 typo
e85cc47 forgot the selfs
190b4f6 start work on canflasher
5c655c9 add recover support
ae3457f usbflash is reliable
f7a0ab0 pedal usbflash works
585d0f9 add way to call isotp
be82899 despite it being bad code, move isotp
000715b start work on pedal canloader
626e312 pedal has a bootstub now
3662d1e redundant check
81e6b0d fix bug
083cd12 should have bounty to refactor that ish
b65d30c bad asserts
b2e6c3f isotp untested support for subaddr
30fd66a Merge pull request commaai#93 from vntarasov/volt
06f5109 Merge pull request commaai#94 from gregjhogan/can-printer-hex
c7d098c Merge pull request commaai#95 from gregjhogan/setup-script
22fe250 Merge pull request commaai#99 from gregjhogan/bit-transition-example
ba16ba3 Merge pull request commaai#100 from gregjhogan/j2534-troubleshooting-instructions
ad08ea4 Merge pull request commaai#90 from gregjhogan/can-forwarding
f3b6f5d added j2534 troubleshooting instructions
858d150 added script to find bits that transition from 0 to 1
c6acac8 added checking pedal interceptor message length
f7226ff added brake safety checks
d0c2634 added gas safety checks
d378e4a removed bosch safety forwarding restriction on 29 bit addresses
5c7ef9e added bosch safety hooks and forwarding
90c64b6 add note
23de8d4 Merge pull request commaai#97 from commaai/pedal_improvements
0261641 added missing python packages
b92b235 fix bytearray encode issue
2434f1c Tweak Volt's brake pedal stickiness
e2f73d2 enable has a whole byte to itself
d5a9e1e correct checksum
f8ed9fa better names
986a14c don't alias pointers
9b8472e add watchdog support
8f0add9 handle faults
1d917f8 split gas set into 2 values, and have a fault state
1b77026 j2534 isn't alpha anymore
fbcc872 Merge pull request commaai#92 from commaai/pedal
8a6f44b pedal is sending messages
08f464c python 3 bro is bad bro
9390961 kline checksum algo was broken...
3b7c33b add kline debug support
aa622bc init values
631ea9f better refactor
eb1fd75 add PEDAL adc sets
ccaa310 don't build with usb
8d4d763 debug console works
bd09883 comma pedal is building
75a29d5 Merge pull request commaai#84 from gregjhogan/j2534-hds
eece37d only the panda has gmlan
9f43abe Merge pull request commaai#89 from vntarasov/volt
5364d43 Merge pull request commaai#88 from vntarasov/smaller-firmware
377a1ec bump version for descriptor fix
4fabdf0 Merge pull request commaai#87 from gregjhogan/usb-multi-packet-control
8580773 fix sending WinUSB Extended Properties Feature Descriptor
6908feb Chevy Volt safety
786a004 Enable optimization to reduce firmware size
d70f43b hack to fix thinkpad
95ab1ae fixed flow control message padding
bbd04d1 updated installer
62216d0 single standalone DLL for J2534 driver
5c9138d fixed 11 bit address issue
f3b0ad2 fix LOOPBACK getting set when DATA_RATE is set
b750d36 updated README
a9a097f lowered CPU utilization
7c26a70 TIS needs unsupported protocols to return an error
42692b4 TIS doesn't like ChannelID being zero
cf126bb SET_CONFIG return error for reserved parameters
2e99dbf fix HDS issues
8203cc8 add is_grey
e946a54 add insecure_okay flag
4363b3e check webpage
4f59ded add secure mode note
6b11fb5 add autosecuring to tests
b27d185 Merge pull request commaai#86 from commaai/better_pairing
4b53b42 elm wifi isn't an automated test
99f85cb Merge pull request commaai#85 from gregjhogan/usb-wcid
0d38060 auto-install WinUSB device driver
c6653ca from python import
38cc0ee add wifi_secure_mode, boots in insecure mode

git-subtree-dir: panda
git-subtree-split: 67d5208

* Squashed 'opendbc/' changes from 81d9871..aa067f7

aa067f7 Chevy Volt tweaks (commaai#83)
a60c6c4 Toyota: change signal name in EPS_STATUS msg
ce70b1a extra setme field toyota LKAS_HUD
df2a552 toyota missing ACC_CONTROL checksum
48bb293 Revert "Toyota Prius: added a comma specific message to control the speed sent to the EPS"
5f42439 Toyota Prius: added a comma specific message to control the speed sent to the EPS
6f5e8b6 Pedal Interceptor: fault state VAL moved to _comma
efd5f5c add setme to honda ACC_HUD
97fc335 add interceptor to civic
6f40f16 update generator script to allow for multiple imports
9ca956b add setme to toyota STEERING_IPAS
e5afa57 run generator for ipas scaling
8bd1182 Toyota IPAS: proper steer angle unit
f57511e acceleration pedal for gasPressed
c8d1dbc high beams also. likely dashboard message.
9f1c78b high beams for genericToggle
f037d42 turn signal lights (and thus hazard lights)
b35bb08 turn signals
78986cf Revert "turn signals"
ba946c9 turn signals
2af3ecc Speed, braking, and distance signals
f40ab87 Set packet lengths, adding steering rate, adjusted speed
cd59bfa units for speed_right
c2fcce2 speed of right vs left side of car
4ef5fae value table for gear status
97c48e2 tighten up speed bits. brake pressue max comment.
a0cbfd1 add gear status PRNDL
0c82865 initial signals for chrysler pacifica 2017 hybrid
5ed0540 add set me to toyota LKAS_HUD
aecac5d add set me fields to toyota ACC_HUD
5417013 update toyota ACC_CONTROL fields
e91e967 Comma Pedal: made GAS_COMMAND 6 bytes
d04434a Comma Pedal: added state byte and enable bit
c30b2cd Comma Pedal: sending 2 tracks on 0x200
8f72467 Volt doors and belts status (commaai#70)
60f8b6c add set me to lkas hud honda
3c9e335 fix honda pcm gas message size
7ca471d Add 2018 Toyota CHR dbc (commaai#78)
637fe00 set scaling to 1 for brake and gas which have no real unit
62a88d4 Volt: switch to parsing ACC buttons from powertrain CAN (commaai#74)
3fdd47b Volt's gas pedal only and combined gas/acc (commaai#76)
45ec9c9 Add 2017 Honda Ridgeline (commaai#77)
cbd186a Add 2018 Camry Hybrid DBC's (commaai#73)
974eeaf Toyota: re-generated the files after cfbc9ae
19ea195 Toyota: more vals for LKA_STATE
cfbc9ae fixed inconsistent factor for speed in Honda dbc files
e7db803 convert all line endings to unix style

git-subtree-dir: opendbc
git-subtree-split: aa067f7

* openpilot v0.4.3 release

* Squashed 'panda/' changes from 67d5208..3125232

3125232 bump version
703c0b4 Gas Interceptor: another fix to gas pressed logic
196d383 Interceptor: fixed gas pressed logic

git-subtree-dir: panda
git-subtree-split: 3125232

* Squashed 'opendbc/' changes from aa067f7..91e882d

91e882d Updating bosch dbcs to use new format and bringing in new honda changes (commaai#82)
9b32e2e Fix Checksum errors for CH-R (commaai#86)

git-subtree-dir: opendbc
git-subtree-split: 91e882d

* openpilot v0.4.3 release

* openpilot v0.4.3.1 release

* fix bug in canpacker for Toyotas with DSU connected (commaai#221)

* update year on civic
starting this over due to the refactor
@@ -53,7 +53,7 @@ def data_sample(CI, CC, thermal, calibration, health, driver_monitor, gps_locati
CS = CI.update(CC)
events = list(CS.events)
enabled = isEnabled(state)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no real changes to this file



# Steer torque limits
STEER_MAX = 200 # Actual limit is about 1023, but not tested, and not needed
Copy link
Contributor

@rbiasini rbiasini Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, I assume 1023 is absurdly high? would be nice to add the 200 limit so the safety_hyundai.h in panda as well

Copy link
Author

@emmertex emmertex Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be safe to push it to 250, but it is VERY strong, any more would be unsafe.
1023 is the maximum due to the size of the integer, but it does not accept messages over 767

The large amount of power it has is why I later reduce the output torque when the driver starts steering.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I definitely recommend to add the 200 limit panda safety.

@@ -70,7 +71,7 @@ def fingerprint(logcan, timeout):
# broadcast immediately
if len(candidate_cars) == 1 and st is not None:
# TODO: better way to decide to wait more if Toyota
time_fingerprint = 1.0 if ("TOYOTA" in candidate_cars[0] or "LEXUS" in candidate_cars[0]) else 0.1
time_fingerprint = 1.0 if ("TOYOTA" in candidate_cars[0] or "LEXUS" in candidate_cars[0] or "HYUNDAI" in candidate_cars[0]) else 0.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only because Toyota Camera takes a while to start sending msgs. Is this really needed for hyundai?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely not, an artefact because this was based off Toyota.
I will kill it and update it if all okay.

@rbiasini
Copy link
Contributor

rbiasini commented Jul 27, 2018

this is great! @emmertex , few things for now:

  • can you make a separate PR for the dbc changes in opendbc repo? We can probably merge them quickly.
  • Same thing for the panda repo.

# We do not want to remove torque because we want to know if OP is still steering
# And how we do it, meh, who cares, this might do.
if abs(CS.steer_torque_driver) > 1:
self.limited_steer = actuators.steer / (abs(CS.steer_torque_driver) * 2)
Copy link
Contributor

@rbiasini rbiasini Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm... this causes a torque jump as soon as abs(CS.steer_torque_driver) > 1 is true.

Maybe you can have a look how this is done for GM. You can see how the driver torque is taken into account to limit the commanded torque. Would be nice to re-use the same logic, just different parameters, which will make writing safety code in panda a lot easier.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GM looks nice, I will implement that.

This never used to have * 2, so there was no jump, but later... hack..

@rbiasini
Copy link
Contributor

temporarily closed until panda safety is done.

@rbiasini rbiasini closed this Jul 27, 2018
pd0wm pushed a commit that referenced this pull request Nov 5, 2019
256d274 Fix Mac installation instruction per: https://github.com/commaai/panda/pull/308/files
bfd8ff1 Update cppcheck commit with more coverage
b143a1c Fixed Misra complaint
606f1d9 Fixed RTC on non-uno boards, second try. Cannot work when there is no xtal.
933c757 Fix RTC on non-uno boards (#311)
48d0d0c VW button spam: fix safety and add tests (#306)
6cccf96 Fan and IR at 0 when in power savings mode (#309)
0537328 board get_sdk scripts were left on python2
de18a7e bump version after uno merge
1965817 Changed default values for testing
a12a148 Uno (#274)
7d29dc5 bump panda version. We really need a better way
4007532 VW: stricter limits to comply with comma safety policy
e2e2be9 add safety mode to health packet
101238c turned on VW ignition based CAN logic
a0d8d5d fix misra 5.3: check_ignition is intended as check_started and can't be used twice
ea636de made check_ignition function to both look at ignition_line and ignition_can
1102e69 make ignition logic common for all cars (#303)
3a110c6 bump version after CMSIS core upgrade
55dfa52 Update core to CMSIS 5.6 release  (#251)
ee86490 fix linter 2
f410b11 fix linter
55957d6 proper python3 exception inheritance
6ba0f47 fix linter errors
5c49fe0 Merge pull request #145 from gregjhogan/uds
0f36199 timeout is float
396d6aa safety_replay only installs few extra requirements
25af7d3 Misra also need python 3 env
7434c5c centralize requirements for tests
a0c37c7 coverage not needed in linter reqs
fce38a9 Linter python (#299)
62e2f5c update cppcheck commit
711810d more uds debug
4454e3a better CAN comm abstraction
6b1f28f fix more encoding and some bytes cleanup (#300)
43adad3 fix WARNING_INDICATOR_REQUESTED name
9c857da 0x
b64d6fa typing
768fdf7 bytes() > chr().encode()
1be15ea custom errors from thread
68da831 more python3
eb358e8 uds lib example
4f28858 updates for python3
932745f support tx flow control for chunked messages
b1c3712 add timeout param
cdf2f62 bug fixes
b1a3195 fix rx message filtering bug
80fb6a6 convert uds lib to class
59cd2b4 handle separation time in microseconds
4429600 fix separation time parsing
c641e66 fix typo
48b8dcc fix flow control delay scale
78f413d flow control delay
33a5167 bug fixes
8ee89a0 multi-frame tx
5e89a9c clear rx buffer and numeric error ids
9662300 fix remaining size calculation
01ef1fa zero pad messages before sending
1ddc973 uds can communication
dca176e syntax errors
95be481 SERVICE_TYPE enum
98e73b5 more UDS message type implementation
c1c5b03 uds lib
162f485 fix chr to bytes conversions (#298)
4972376 Update VW regression test to follow Comma safety index refactoring (#296)
f9053f5 more Python 3 fixes, attempting to fix jenkins wifi regresison test (#295)
2f9e076 Panda safety code for Volkswagen, Audi, SEAT, and Škoda (#293)

git-subtree-dir: panda
git-subtree-split: 256d274
Vaggysag pushed a commit to Vaggysag/openpilot that referenced this pull request Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants