-
Notifications
You must be signed in to change notification settings - Fork 1
Fixing imports and adding Encoder printouts to the ivp #7
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| import board as _board | ||
| from _drivetrain import Drivetrain | ||
| from _encoded_motor import EncodedMotor | ||
| from _ultrasonic_wrapper import Ultrasonic | ||
| from _reflectance_wrapper import Reflectance | ||
| from _servo import Servo | ||
| from _buttons import Buttons | ||
| from _led import RGBLED | ||
| from . import _drivetrain | ||
|
||
| from . import _ultrasonic_wrapper | ||
| from . import _reflectance_wrapper | ||
| from . import _servo | ||
| from . import _buttons | ||
| from . import _encoded_motor | ||
| from . import _led | ||
|
|
||
| import time | ||
|
|
||
|
|
@@ -14,15 +14,15 @@ | |
| If you need to change the encoder counts, alter the ticksPerRev values in the following two constructors. | ||
| Most robots have either 144 or 288 ticks per revolution, depending on which motors are used. | ||
| """ | ||
| _leftMotor = EncodedMotor( | ||
| _leftMotor = _encoded_motor.EncodedMotor( | ||
| encoderPinA=_board.GP4, | ||
| encoderPinB=_board.GP5, | ||
| motorPin1=_board.GP8, | ||
| motorPin2=_board.GP9, | ||
| doFlip=True, | ||
| ticksPerRev=288) | ||
|
|
||
| _rightMotor = EncodedMotor( | ||
| _rightMotor = _encoded_motor.EncodedMotor( | ||
| encoderPinA=_board.GP2, | ||
| encoderPinB=_board.GP3, | ||
| motorPin1=_board.GP10, | ||
|
|
@@ -31,12 +31,12 @@ | |
| ticksPerRev=288) | ||
|
|
||
| # Publicly-accessible objects | ||
| drivetrain = Drivetrain(_leftMotor, _rightMotor) # units in cm | ||
| reflectance = Reflectance() | ||
| sonar = Ultrasonic() | ||
| led = RGBLED(_board.GP18) | ||
| servo = Servo(_board.GP12, actuationRange = 135) | ||
| buttons = Buttons() | ||
| drivetrain = _drivetrain.Drivetrain(_leftMotor, _rightMotor) # units in cm | ||
| reflectance = _reflectance_wrapper.Reflectance() | ||
| sonar = _ultrasonic_wrapper.Ultrasonic() | ||
| led = _led.RGBLED(_board.GP18) | ||
| servo = _servo.Servo(_board.GP12, actuationRange = 135) | ||
| buttons = _buttons.Buttons() | ||
|
|
||
| def set_legacy_mode(is_legacy: bool = True): | ||
| drivetrain.set_legacy_mode(is_legacy) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,10 @@ | |
| from SampleCode.sample_miscellaneous import * | ||
| from SampleCode.sample_sensor_access import * | ||
|
|
||
| ivp() | ||
| def main(): | ||
| # | ||
| # Your Code Here! | ||
| # | ||
| pass | ||
|
||
|
|
||
| main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This waits for press + released now, is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was intentional originally, but upon thinking about it a little more, I realized the initial implementation was correct. I've reverted that change and added comments for clarity