Skip to content

Commit

Permalink
angle is directly set only if NOT in cruise control
Browse files Browse the repository at this point in the history
  • Loading branch information
platisd committed Dec 23, 2015
1 parent 3900f74 commit bff09f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void Car::setDirection(const unsigned short direction){ //platform specific meth

void Car::setAngle(int angle){ //platform specific method
_angle = constrain(angle, MAX_LEFT_DEGREES - STRAIGHT_WHEELS, MAX_RIGHT_DEGREES - STRAIGHT_WHEELS); //constrain the value to the permitted valued the user is allowed to supply
setMotors(getSpeed(), getAngle()); //pass the human-readable value that was just supplied
if (!cruiseControlEnabled()) setMotors(getSpeed(), getAngle()); // if not in cruise control, apply the new angle directly
}

void Car::stop(){ //platform specific method
Expand Down

1 comment on commit bff09f5

@platisd
Copy link
Owner Author

Choose a reason for hiding this comment

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

The angle is directly set only if we are not currently in cruise control. If in cruise control, then we should just update the angle value (_angle) and wait for the control loop to set it accordingly, when it is time.

Please sign in to comment.