Skip to content

Commit

Permalink
Merge pull request #4 from bitshop/kalud_20180621
Browse files Browse the repository at this point in the history
Merge Kalud's steering changes
  • Loading branch information
bitshop authored Jun 21, 2018
2 parents d3a20ff + 1ea45e0 commit 848b7b9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions selfdrive/car/tesla/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ def update(self, sendcan, enabled, CS, frame, actuators, \
vehicle_moving = (CS.v_ego >= MIN_STEERING_VEHICLE_VELOCITY)

enable_steer_control = (enabled
and vehicle_moving
and not changing_lanes)

# Torque
#steer_correction = actuators.steer if enable_steer_control else 0
#apply_steer = int(clip((-steer_correction * 100) + STEER_MAX - (CS.angle_steers * 10), STEER_MAX - USER_STEER_MAX, STEER_MAX + USER_STEER_MAX)) # steer torque is converted back to CAN reference (positive when steering right)

steer_correction = actuators.steer if enable_steer_control else 0
#steer_correction = actuators.steerAngle if enable_steer_control else 0 # NOT WORKING always turns right, need to investigate (value, deg/rad, polarity, scaling)

# steer torque is converted back to CAN reference (positive when steering right)
apply_steer = int(clip((-steer_correction * 100) + STEER_MAX - (CS.angle_steers * 10), STEER_MAX - USER_STEER_MAX, STEER_MAX + USER_STEER_MAX))
# Angle
steer_correction = actuators.steerAngle if enable_steer_control else CS.angle_steers
apply_steer = int(clip((-actuators.steerAngle * 10) + STEER_MAX, STEER_MAX - USER_STEER_MAX, STEER_MAX + USER_STEER_MAX)) # steer torque is converted back to CAN reference (positive when steering right)

# Send CAN commands.
can_sends = []
Expand Down

0 comments on commit 848b7b9

Please sign in to comment.