-
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.
Merge pull request #12 from IDATT1004-Team13-H2025/robot-funksjonalitet
Laget klasser
- Loading branch information
Showing
7 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
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,2 +1,24 @@ | ||
| #Fil for programmering av kjøring | ||
| from pybricks.hubs import EV3Brick | ||
| from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, | ||
| InfraredSensor, UltrasonicSensor, GyroSensor) | ||
| from pybricks.parameters import Port, Stop, Direction, Button, Color | ||
| from pybricks.robotics import DriveBase | ||
|
|
||
|
|
||
| class Drive(): | ||
| def __init__(self, motors: tuple, dimensions: tuple): | ||
| leftMotor, rightMotor = motors | ||
| wheelDiameter, axleTrack = dimensions | ||
|
|
||
|
|
||
| self.driveBase = DriveBase(leftMotor, rightMotor, | ||
| wheel_diameter=wheelDiameter, axle_track=axleTrack) | ||
|
|
||
|
|
||
| def forward(self, speed): | ||
| pass | ||
|
|
||
| def backward(self, speed): | ||
| pass | ||
|
|
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,21 @@ | ||
| #Overklasse for all robot funksjonalitet | ||
| #!/usr/bin/env pybricks-micropython | ||
| from pybricks.hubs import EV3Brick | ||
| from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, | ||
| InfraredSensor, UltrasonicSensor, GyroSensor) | ||
| from pybricks.parameters import Port, Stop, Direction, Button, Color | ||
| from pybricks.tools import wait, StopWatch, DataLog | ||
| from pybricks.robotics import DriveBase | ||
| from pybricks.media.ev3dev import SoundFile, ImageFile | ||
|
|
||
| from drive import Drive | ||
| from sensors import Sensors | ||
|
|
||
| class Robot(): | ||
| def __init__(self, drive: Drive, sensors: Sensors): | ||
| self.hub = EV3Brick() | ||
| self.drive = drive | ||
| self.sensors = sensors | ||
|
|
||
|
|
||
|
|
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,17 @@ | ||
|
|
||
| #!/usr/bin/env pybricks-micropython | ||
| from pybricks.hubs import EV3Brick | ||
| from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, | ||
| InfraredSensor, UltrasonicSensor, GyroSensor) | ||
| from pybricks.parameters import Port, Stop, Direction, Button, Color | ||
| from pybricks.tools import wait, StopWatch, DataLog | ||
| from pybricks.robotics import DriveBase | ||
| from pybricks.media.ev3dev import SoundFile, ImageFile | ||
|
|
||
| class Sensors(): | ||
| def __init__(self, colorSensor: ColorSensor, ultrasonicSensor: UltrasonicSensor): | ||
|
|
||
| self.color = colorSensor | ||
| self.ultrasonic = ultrasonicSensor | ||
|
|
||
|
|
Empty file.
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,10 @@ | ||
|
|
||
| #!/usr/bin/env pybricks-micropython | ||
| from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, | ||
| InfraredSensor, UltrasonicSensor, GyroSensor) | ||
| from pybricks.parameters import Port, Stop, Direction, Button, Color | ||
|
|
||
|
|
||
| class WaterBucket: | ||
| def __init__(self): | ||
| pass |