added more templates and defined basic include/layout

This commit is contained in:
d3rped 2018-03-18 14:23:17 +01:00
parent e6b628f41a
commit 5b787bc400
6 changed files with 48 additions and 6 deletions

View file

@ -1,8 +1,6 @@
#!/usr/bin/env python3
# Suggestion: Do not import the ev3dev.ev3 module in this file
class Communication:
"""
Class to hold the MQTT client
@ -10,7 +8,7 @@ class Communication:
Feel free to add functions, change the constructor and the example send_message() to satisfy your requirements and thereby solve the task according to the specifications
"""
def __init__(self, mqtt_client):
def __init__(self, mqtt_client, planet):
""" Initializes communication module, connect to server, subscribe, etc. """
# THESE TWO VARIABLES MUST NOT BE CHANGED
self.client = mqtt_client

View file

@ -5,14 +5,17 @@ import uuid
import paho.mqtt.client as mqtt
from planet import Direction, Planet
from communication import Communication
from move import Move
client = None # DO NOT EDIT
# DO NOT EDIT
client = None
def run():
# DO NOT EDIT
global client
client = mqtt.Client(client_id=str(uuid.uuid4()), # client_id has to be unique among ALL users
# client_id has to be unique among ALL users
client = mqtt.Client(client_id=str(uuid.uuid4()),
clean_session=False,
protocol=mqtt.MQTTv31)

15
src/move.py Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env python3
from wheel import Wheel
from sensor import Sensor
class Move:
def __init__(self, planet):
pass
def _calibrate(self):
pass
def _aligntoedge(self):
pass

View file

@ -1,2 +1,11 @@
#!/usr/bin/env python3
# Suggestion: implement odometry as class that is not using the ev3dev.ev3 package
# establish value exchange with main driving class via getters and setters
# establish value exchange with main driving class via getters and setters
import time
from planet import Direction
class Odometry:
def __init__(self, planet):
pass

0
src/sensor.py Normal file
View file

17
src/wheel.py Normal file
View file

@ -0,0 +1,17 @@
import ev3dev.ev3 as ev3
class Wheel:
def __init__(self, port):
self._motor = ev3.LargeMotor(port)
self._motor.stop_action = 'brake'
self._speed = 50
def run(self):
pass
def stop(self):
pass
def speed_set(self):
pass