-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from Open-STEM/v1.0.0
Version 1.0.0!
- Loading branch information
Showing
14 changed files
with
96 additions
and
159 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,47 @@ | ||
from XRPLib.encoded_motor import EncodedMotor | ||
from XRPLib.imu import IMU | ||
from XRPLib.board import Board | ||
from XRPLib.servo import Servo | ||
from XRPLib.webserver import Webserver | ||
import sys | ||
""" | ||
A simple file for shutting off all of the motors after a program gets interrupted from the REPL. | ||
Run this file after interrupting a program to stop the robot by running "import XRPLib.resetbot" in the REPL. | ||
""" | ||
|
||
# using the EncodedMotor since the default drivetrain uses the IMU and takes 3 seconds to init | ||
for i in range(4): | ||
motor = EncodedMotor.get_default_encoded_motor(i+1) | ||
motor.set_speed(0) | ||
motor.reset_encoder_position() | ||
def reset_motors(): | ||
from XRPLib.encoded_motor import EncodedMotor | ||
# using the EncodedMotor since the default drivetrain uses the IMU and takes 3 seconds to init | ||
for i in range(4): | ||
motor = EncodedMotor.get_default_encoded_motor(i+1) | ||
motor.set_speed(0) | ||
motor.reset_encoder_position() | ||
|
||
# Turn off the on-board LED | ||
Board.get_default_board().led_off() | ||
def reset_led(): | ||
from XRPLib.board import Board | ||
# Turn off the on-board LED | ||
Board.get_default_board().led_off() | ||
|
||
# Turn off both Servos | ||
Servo.get_default_servo().free() | ||
Servo(17).free() | ||
def reset_servos(): | ||
from XRPLib.servo import Servo | ||
# Turn off both Servos | ||
Servo.get_default_servo(1).free() | ||
Servo.get_default_servo(2).free() | ||
|
||
# Shut off the webserver and close network connections | ||
Webserver.get_default_webserver().stop_server() | ||
def reset_webserver(): | ||
from XRPLib.webserver import Webserver | ||
# Shut off the webserver and close network connections | ||
Webserver.get_default_webserver().stop_server() | ||
|
||
def reset_hard(): | ||
reset_motors() | ||
reset_led() | ||
reset_servos() | ||
reset_webserver() | ||
|
||
if "XRPLib.encoded_motor" in sys.modules: | ||
reset_motors() | ||
|
||
if "XRPLib.board" in sys.modules: | ||
reset_led() | ||
|
||
if "XRPLib.servo" in sys.modules: | ||
reset_servos() | ||
|
||
if "XRPLib.webserver" in sys.modules: | ||
reset_webserver() |
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
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
Oops, something went wrong.