mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-08 12:55:44 +08:00
Compare commits
150 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a20ad8d114 | |||
| 235327cdac | |||
| 1cbd666f32 | |||
| b7299785ac | |||
| 4eaf27ee92 | |||
| e017d09fc9 | |||
| cd85a66790 | |||
| 305ea87daf | |||
| 4bbfc793e0 | |||
| d5d983676e | |||
| de8a96a398 | |||
| 0cbf45f699 | |||
| 0d68a3a2ab | |||
| 9e85a85059 | |||
| 0373c327c0 | |||
| efe9e5c200 | |||
| 8a249a45dc | |||
| bdbefe67f6 | |||
| 675bb166ad | |||
| 1b717a7e88 | |||
| 86f55a8ba9 | |||
| 629392d2f7 | |||
| bc414bdc8b | |||
| 7ca5649f2c | |||
| 641ee8fa87 | |||
| 56c276158c | |||
| c65308a8bd | |||
| 994e526460 | |||
| 1defae36b7 | |||
| 8f029fd0ef | |||
| ddb46284dc | |||
| 9effc754d9 | |||
| e49ffc2a2d | |||
| 2cacd0b3e5 | |||
| c4b8859dff | |||
| 8fb0953205 | |||
| 63d1c8835f | |||
| 17a185606d | |||
| da10131392 | |||
| 7107c2ba14 | |||
| 95b6e877ac | |||
| eb02c6570e | |||
| 1be8ae31c4 | |||
| 04dcd38856 | |||
| 22ccf0d72f | |||
| 3c969bb627 | |||
| 20f8011feb | |||
| 9cf17e74a1 | |||
| 2c4efdf557 | |||
| 4cd3d3c16c | |||
| 637f3ae9c8 | |||
| 464ee80f71 | |||
| 2743a04613 | |||
| 7f9978d001 | |||
| 4b83961c67 | |||
| c00eaf428a | |||
| 0a9993e8d4 | |||
| 0af214a985 | |||
| af43385e3a | |||
| 0ab2b8c590 | |||
| 67ab18a0de | |||
| e87dc15b30 | |||
| 192d08516c | |||
| 3cf001c59c | |||
| f2ccd021da | |||
| c9fc900f64 | |||
| 3c37c5ce5d | |||
| 7c45889e4e | |||
| 2aabb7aee8 | |||
| 3859e9962f | |||
| 810efbab72 | |||
| ec27bec326 | |||
| 250d553157 | |||
| cea54a0ca8 | |||
| 8e72d783bd | |||
| 1b0dc103dc | |||
| 6c364d292b | |||
| bcdec2ce84 | |||
| 3deaeb3759 | |||
| c669f0984a | |||
| 46dd946740 | |||
| 9da4b3653e | |||
| 4e21ae7c50 | |||
| bb91e92237 | |||
| 14b4c4f85b | |||
| 0660b542c3 | |||
| 2b893b90c9 | |||
| f5139178ed | |||
| fb43b755f2 | |||
| 07f5b967d8 | |||
| ea19c7d3bb | |||
| e461842cbb | |||
| a73c9659d5 | |||
| cb796fbc76 | |||
| 6bf75fc557 | |||
| 9a1fc28819 | |||
| 0741d05e92 | |||
| 1ad008107d | |||
| feebd9df93 | |||
| c2e5ced3e5 | |||
| 15e5d2efb9 | |||
| a3929d0b54 | |||
| 794f8f9991 | |||
| 68fa5e3f21 | |||
| 86c6cc1f48 | |||
| eb7ffbf093 | |||
| 3919095752 | |||
| 74d63be1c3 | |||
| 8894486a1a | |||
| 810599315d | |||
| 6f3ab810c8 | |||
| 230f78b8d3 | |||
| f1affec088 | |||
| 97d8ef242c | |||
| a63fff9b45 | |||
| cb3893daaa | |||
| 29f60df74b | |||
| c6c072e1f4 | |||
| d101cbb83e | |||
| 1536d59633 | |||
| dc99b865ae | |||
| e59bc027ff | |||
| cf7e5efaca | |||
| 4b44f2eb31 | |||
| 107d2ab400 | |||
| 5432d9062c | |||
| f533f6c843 | |||
| 58e9ac763c | |||
| cb50d54169 | |||
| bd5de4ed0a | |||
| 0d4073fadb | |||
| ebc70dcb52 | |||
| 4d0426999e | |||
| 286da42573 | |||
| 8a836710a9 | |||
| 5d515bcf33 | |||
| 1c7f6d5133 | |||
| 05d57c7aeb | |||
| e4b0eaf352 | |||
| a710276472 | |||
| af086db671 | |||
| 0d9eb0e25e | |||
| 0616caed6d | |||
| 095337b3c1 | |||
| 1edec2d22c | |||
| affabb9ee0 | |||
| dc27e8711c | |||
| cf7329a264 | |||
| 5ee5ecd820 | |||
| b064f730dd |
+1
-1
Submodule opendbc_repo updated: b178bc5d4e...824beb0ffb
@@ -185,7 +185,9 @@ def modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
|
|||||||
def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
|
def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
|
||||||
gb = sm['carControl'].actuators.accel / 4.
|
gb = sm['carControl'].actuators.accel / 4.
|
||||||
steer = sm['carControl'].actuators.torque
|
steer = sm['carControl'].actuators.torque
|
||||||
vals = f"Gas: {round(gb * 100.)}%, Steer: {round(steer * 100.)}%"
|
damp = sm['carControl'].actuators.dampFactor
|
||||||
|
damp_pct = round((damp - 3) / (200 - 3) * 100.) if damp > 0 else 50
|
||||||
|
vals = f"Gas: {round(gb * 100.)}%, Steer: {round(steer * 100.)}%\nDamp: {damp_pct}%"
|
||||||
return NormalPermanentAlert("Joystick Mode", vals)
|
return NormalPermanentAlert("Joystick Mode", vals)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,11 @@ class Joystick:
|
|||||||
steer_axis = 'ABS_Z'
|
steer_axis = 'ABS_Z'
|
||||||
self.flip_map = {'ABS_RY': accel_axis}
|
self.flip_map = {'ABS_RY': accel_axis}
|
||||||
|
|
||||||
self.min_axis_value = {accel_axis: 0., steer_axis: 0.}
|
damp_axis = 'ABS_X'
|
||||||
self.max_axis_value = {accel_axis: 255., steer_axis: 255.}
|
self.min_axis_value = {accel_axis: 0., steer_axis: 0., damp_axis: 0.}
|
||||||
self.axes_values = {accel_axis: 0., steer_axis: 0.}
|
self.max_axis_value = {accel_axis: 255., steer_axis: 255., damp_axis: 255.}
|
||||||
self.axes_order = [accel_axis, steer_axis]
|
self.axes_values = {accel_axis: 0., steer_axis: 0., damp_axis: 0.}
|
||||||
|
self.axes_order = [accel_axis, steer_axis, damp_axis]
|
||||||
self.cancel = False
|
self.cancel = False
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@@ -69,6 +70,7 @@ class Joystick:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
event = (joystick_event.code, joystick_event.state)
|
event = (joystick_event.code, joystick_event.state)
|
||||||
|
print(f"event: code={joystick_event.code}, state={joystick_event.state}, ev_type={joystick_event.ev_type}")
|
||||||
|
|
||||||
# flip left trigger to negative accel
|
# flip left trigger to negative accel
|
||||||
if event[0] in self.flip_map:
|
if event[0] in self.flip_map:
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ def joystickd_thread():
|
|||||||
actuators.torque = float(np.clip(joystick_axes[1], -1, 1))
|
actuators.torque = float(np.clip(joystick_axes[1], -1, 1))
|
||||||
actuators.steeringAngleDeg, actuators.curvature = actuators.torque * max_angle, actuators.torque * -max_curvature
|
actuators.steeringAngleDeg, actuators.curvature = actuators.torque * max_angle, actuators.torque * -max_curvature
|
||||||
|
|
||||||
|
if len(joystick_axes) > 2:
|
||||||
|
# axes[2] controls DAMP_FACTOR: [-1, 1] mapped to [3, 200]
|
||||||
|
actuators.dampFactor = float(np.interp(joystick_axes[2], [-1, 1], [3, 200]))
|
||||||
|
|
||||||
pm.send('carControl', cc_msg)
|
pm.send('carControl', cc_msg)
|
||||||
|
|
||||||
cs_msg = messaging.new_message('controlsState')
|
cs_msg = messaging.new_message('controlsState')
|
||||||
|
|||||||
Reference in New Issue
Block a user