Skip to content

Fix pylint complaints #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Crickit_WobblyBot/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@
left_legs = [front_left, rear_left]

# The sign (+1/-1) for forward motion for each servo
direction_values = {front_right: +1, front_left: -1, rear_right: +1, rear_left: -1}
direction_values = {front_right: +1,
front_left: -1,
rear_right: +1,
rear_left: -1}

# Tweak the pwn ranges for each servo so that throttle of 0 stops the motor
pwm_ranges = {front_right: (500, 2400), front_left: (500, 2400), rear_right: (500, 2400), rear_left: (500, 2400)}
pwm_ranges = {front_right: (500, 2400),
front_left: (500, 2400),
rear_right: (500, 2400),
rear_left: (500, 2400)}


def init():
Expand All @@ -60,23 +66,23 @@ def wag_for(seconds):


def forward(servo_or_servos, speed):
if type(servo_or_servos) == list:
if isinstance(servo_or_servos, list):
for servo in servo_or_servos:
servo.throttle = speed * direction_values[servo]
else:
servo_or_servos.throttle = speed * direction_values[servo_or_servos]


def reverse(servo_or_servos, speed):
if type(servo_or_servos) == list:
if isinstance(servo_or_servos, list):
for servo in servo_or_servos:
servo.throttle = speed * -1 * direction_values[servo]
else:
servo_or_servos.throttle = speed * -1 * direction_values[servo_or_servos]


def stop(servo_or_servos):
if type(servo_or_servos) == list:
if isinstance(servo_or_servos, list):
for servo in servo_or_servos:
servo.throttle = 0
else:
Expand Down