Last active
July 10, 2018 15:39
-
-
Save felipecode/0c0bf85c6f3864f7f41c16a78b0416a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def augment_steering(self, camera_angle, steer, speed): | |
""" | |
Apply the steering physical equation to augment for the lateral cameras. | |
Args: | |
camera_angle_batch: | |
steer_batch: | |
speed_batch: | |
Returns: | |
the augmented steering | |
""" | |
time_use = 1.0 | |
car_length = 6.0 | |
old_steer = steer | |
pos = camera_angle > 0.0 | |
neg = camera_angle <= 0.0 | |
# You should use the absolute value of speed | |
speed = math.fabs(speed) | |
rad_camera_angle = math.radians(math.fabs(camera_angle)) | |
val = g_conf.AUGMENT_LATERAL_STEERINGS * ( | |
math.atan((rad_camera_angle * car_length) / (time_use * speed + 0.05))) / 3.1415 | |
steer -= pos * min(val, 0.3) | |
steer += neg * min(val, 0.3) | |
steer = min(1.0, max(-1.0, steer)) | |
#print('Angle', camera_angle, ' Steer ', old_steer, ' speed ', speed, 'new steer', steer) | |
return steer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment