Skip to content

Commit

Permalink
Merge pull request #1 from jamezz-comma/volt-stopfix-1
Browse files Browse the repository at this point in the history
Volt stopfix 1
  • Loading branch information
Jamezz committed Jul 28, 2018
2 parents c1f9e46 + a9732ec commit 2739b86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions selfdrive/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ def update(self, sendcan, enabled, CS, frame, actuators, \
if (frame % 4) == 0:
idx = (frame / 4) % 4

at_full_stop = enabled and CS.standstill
want_full_stop = enabled and CS.standstill and apply_gas < P.ZERO_GAS
near_stop = enabled and (CS.v_ego < P.NEAR_STOP_BRAKE_PHASE)
can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, canbus.chassis, apply_brake, idx, near_stop, at_full_stop))
can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, canbus.chassis, apply_brake, idx, near_stop, want_full_stop))

at_full_stop = enabled and CS.standstill
can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, canbus.powertrain, apply_gas, idx, enabled, at_full_stop))
can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, canbus.powertrain, apply_gas, idx, enabled, want_full_stop))

# Send dashboard UI commands (ACC status), 25hz
if (frame % 4) == 0:
Expand Down
8 changes: 4 additions & 4 deletions selfdrive/car/gm/gmcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def create_adas_keepalive(bus):
dat = "\x00\x00\x00\x00\x00\x00\x00"
return [[0x409, 0, dat, bus], [0x40a, 0, dat, bus]]

def create_gas_regen_command(packer, bus, throttle, idx, acc_engaged, at_full_stop):
def create_gas_regen_command(packer, bus, throttle, idx, acc_engaged, want_full_stop):
values = {
"GasRegenCmdActive": acc_engaged,
"RollingCounter": idx,
"GasRegenCmdActiveInv": 1 - acc_engaged,
"GasRegenCmd": throttle,
"GasRegenFullStopActive": at_full_stop,
"GasRegenFullStopActive": want_full_stop,
"GasRegenAlwaysOne": 1,
"GasRegenAlwaysOne2": 1,
"GasRegenAlwaysOne3": 1,
Expand All @@ -58,14 +58,14 @@ def create_gas_regen_command(packer, bus, throttle, idx, acc_engaged, at_full_st

return packer.make_can_msg("ASCMGasRegenCmd", bus, values)

def create_friction_brake_command(packer, bus, apply_brake, idx, near_stop, at_full_stop):
def create_friction_brake_command(packer, bus, apply_brake, idx, near_stop, want_full_stop):

if apply_brake == 0:
mode = 0x1
else:
mode = 0xa

if at_full_stop:
if want_full_stop:
mode = 0xd
# TODO: this is to have GM bringing the car to complete stop,
# but currently it conflicts with OP controls, so turned off.
Expand Down

0 comments on commit 2739b86

Please sign in to comment.