-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ee2216
commit b2f2719
Showing
16 changed files
with
251 additions
and
64 deletions.
There are no files selected for viewing
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,8 +1,11 @@ | ||
# We Robot Eurobot 2020 Autonomus Robot | ||
|
||
## Architecture | ||
|
||
The architecture is divided in 3 distincs parts: | ||
|
||
- the `driver` code, created in Python, this is the code that drive the robot, main logic of the navigation | ||
- the `dash` code, created in React, this is the front-end, user interface of this whole system. This interface can be handy to configure the robot, simulate the robot and assist the creation of the robot driver code by providing a pretty graphic simulation of the table. | ||
- the `server` code, written in Node.js, which supervise the driver process, recover it in case of a crash and connect the dashboard to the driver throught a websocket connexion. | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import time | ||
import sys | ||
from sys import exit | ||
from os import _exit | ||
from adafruit_crickit import crickit | ||
|
||
motor1, motor2 = crickit.dc_motor_1, crickit.dc_motor_2 | ||
|
||
def main(): | ||
print("main") | ||
motor1.throttle = -1 | ||
motor2.throttle = 1 | ||
while True: | ||
time.sleep(1) | ||
|
||
try: | ||
main() | ||
|
||
except KeyboardInterrupt: | ||
print('Interrupted') | ||
motor1.throttle = 0 | ||
motor2.throttle = 0 | ||
|
||
try: | ||
exit(0) | ||
except SystemExit: | ||
_exit(0) | ||
|
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from gpiozero import DigitalOutputDevice | ||
from gpiozero import PWMOutputDevice | ||
|
||
class Motors: | ||
|
||
def __init__(self): | ||
#///////////////// Define Motor Driver GPIO Pins ///////////////// | ||
# Motor A, Left Side GPIO CONSTANTS | ||
PWM_DRIVE_LEFT = 12 # ENA - H-Bridge enable pin | ||
FORWARD_LEFT_PIN = 8 # INA1 - Forward Drive | ||
REVERSE_LEFT_PIN = 7 # INA2 - Reverse Drive | ||
# Motor B, Right Side GPIO CONSTANTS | ||
PWM_DRIVE_RIGHT = 18 # ENB - H-Bridge enable pin | ||
FORWARD_RIGHT_PIN = 24 # INB1 - Forward Drive | ||
REVERSE_RIGHT_PIN = 23 # INB2 - Reverse Drive | ||
|
||
STANDBY_PIN = 25 | ||
|
||
self.driveLeft = PWMOutputDevice(PWM_DRIVE_LEFT, True, 0, 1000) | ||
self.driveRight = PWMOutputDevice(PWM_DRIVE_RIGHT, True, 0, 1000) | ||
|
||
self.forwardLeft = DigitalOutputDevice(FORWARD_LEFT_PIN) | ||
self.reverseLeft = DigitalOutputDevice(REVERSE_LEFT_PIN) | ||
|
||
self.forwardRight = DigitalOutputDevice(REVERSE_RIGHT_PIN) | ||
self.reverseRight = DigitalOutputDevice(FORWARD_RIGHT_PIN) | ||
|
||
# self.driveLeft = PWMOutputDevice(PWM_DRIVE_RIGHT, True, 0, 1000) | ||
# self.driveRight = PWMOutputDevice(PWM_DRIVE_LEFT, True, 0, 1000) | ||
|
||
# self.forwardLeft = DigitalOutputDevice(FORWARD_RIGHT_PIN) | ||
# self.reverseLeft = DigitalOutputDevice(REVERSE_RIGHT_PIN) | ||
|
||
# self.forwardRight = DigitalOutputDevice(FORWARD_LEFT_PIN) | ||
# self.reverseRight = DigitalOutputDevice(REVERSE_LEFT_PIN) | ||
|
||
self.standBy = DigitalOutputDevice(STANDBY_PIN) | ||
self.standBy.value = True | ||
|
||
|
||
def setLeft(self, value): | ||
if value < 0: | ||
value = -value | ||
self.reverseLeft.value = True | ||
self.forwardLeft.value = False | ||
else: | ||
self.reverseLeft.value = False | ||
self.forwardLeft.value = True | ||
print('Left', value) | ||
self.driveLeft.value = value | ||
|
||
def setRight(self, value): | ||
if value < 0: | ||
value = -value | ||
self.reverseRight.value = True | ||
self.forwardRight.value = False | ||
else: | ||
self.reverseRight.value = False | ||
self.forwardRight.value = True | ||
print('Right', value) | ||
self.driveRight.value = value | ||
|
||
def setBoth(self, value): | ||
self.setLeft(value) | ||
self.setRight(value) | ||
|
||
def stop(self): | ||
print('MOTORS: Stop Called') | ||
self.reverseLeft.value = False | ||
self.forwardLeft.value = False | ||
self.forwardRight.value = False | ||
self.reverseRight.value = False | ||
self.driveRight.value = 0 | ||
self.driveLeft.value = 0 | ||
|
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.