Debugging

pull/1/head
Julius Riegel 7 years ago
parent f82b44397b
commit 56ddd9022d

@ -3,6 +3,8 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="49388e57-2b9e-468a-b880-1d7fb243112d" name="Default" comment=""> <list default="true" id="49388e57-2b9e-468a-b880-1d7fb243112d" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/controllib.py" afterPath="$PROJECT_DIR$/lib/controllib.py" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/controllib.py" afterPath="$PROJECT_DIR$/lib/controllib.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/hardwarelib.py" afterPath="$PROJECT_DIR$/lib/hardwarelib.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/main.py" afterPath="$PROJECT_DIR$/main.py" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -29,8 +31,8 @@
<file leaf-file-name="main.py" pinned="false" current-in-tab="false"> <file leaf-file-name="main.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.py"> <entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="697"> <state relative-caret-position="321">
<caret line="41" column="28" lean-forward="true" selection-start-line="41" selection-start-column="28" selection-end-line="41" selection-end-column="28" /> <caret line="37" column="30" lean-forward="false" selection-start-line="37" selection-start-column="30" selection-end-line="37" selection-end-column="30" />
<folding> <folding>
<element signature="e#0#19#0" expanded="true" /> <element signature="e#0#19#0" expanded="true" />
</folding> </folding>
@ -41,7 +43,7 @@
<file leaf-file-name="graphiclib.py" pinned="false" current-in-tab="false"> <file leaf-file-name="graphiclib.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/graphiclib.py"> <entry file="file://$PROJECT_DIR$/lib/graphiclib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389"> <state relative-caret-position="1103">
<caret line="86" column="12" lean-forward="false" selection-start-line="86" selection-start-column="12" selection-end-line="86" selection-end-column="12" /> <caret line="86" column="12" lean-forward="false" selection-start-line="86" selection-start-column="12" selection-end-line="86" selection-end-column="12" />
<folding> <folding>
<element signature="e#0#28#0" expanded="true" /> <element signature="e#0#28#0" expanded="true" />
@ -53,13 +55,25 @@
<file leaf-file-name="controllib.py" pinned="false" current-in-tab="true"> <file leaf-file-name="controllib.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/controllib.py"> <entry file="file://$PROJECT_DIR$/lib/controllib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187"> <state relative-caret-position="493">
<caret line="11" column="58" lean-forward="false" selection-start-line="11" selection-start-column="58" selection-end-line="11" selection-end-column="58" /> <caret line="53" column="38" lean-forward="true" selection-start-line="53" selection-start-column="38" selection-end-line="53" selection-end-column="38" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="hardwarelib.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/hardwarelib.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="48" column="35" lean-forward="true" selection-start-line="48" selection-start-column="35" selection-end-line="48" selection-end-column="35" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="update.sh" pinned="false" current-in-tab="false"> <file leaf-file-name="update.sh" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/update.sh"> <entry file="file://$PROJECT_DIR$/update.sh">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -108,9 +122,10 @@
<option value="$PROJECT_DIR$/servo_2.py" /> <option value="$PROJECT_DIR$/servo_2.py" />
<option value="$PROJECT_DIR$/thermo.py" /> <option value="$PROJECT_DIR$/thermo.py" />
<option value="$PROJECT_DIR$/update.sh" /> <option value="$PROJECT_DIR$/update.sh" />
<option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/lib/graphiclib.py" /> <option value="$PROJECT_DIR$/lib/graphiclib.py" />
<option value="$PROJECT_DIR$/lib/controllib.py" /> <option value="$PROJECT_DIR$/lib/controllib.py" />
<option value="$PROJECT_DIR$/lib/hardwarelib.py" />
<option value="$PROJECT_DIR$/main.py" />
</list> </list>
</option> </option>
</component> </component>
@ -321,14 +336,6 @@
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/install.sh">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/motors.py" /> <entry file="file://$PROJECT_DIR$/motors.py" />
<entry file="file://$PROJECT_DIR$/main.py"> <entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -496,10 +503,20 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/hardwarelib.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="48" column="35" lean-forward="true" selection-start-line="48" selection-start-column="35" selection-end-line="48" selection-end-column="35" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.py"> <entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="697"> <state relative-caret-position="321">
<caret line="41" column="28" lean-forward="true" selection-start-line="41" selection-start-column="28" selection-end-line="41" selection-end-column="28" /> <caret line="37" column="30" lean-forward="false" selection-start-line="37" selection-start-column="30" selection-end-line="37" selection-end-column="30" />
<folding> <folding>
<element signature="e#0#19#0" expanded="true" /> <element signature="e#0#19#0" expanded="true" />
</folding> </folding>
@ -508,7 +525,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/graphiclib.py"> <entry file="file://$PROJECT_DIR$/lib/graphiclib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389"> <state relative-caret-position="1103">
<caret line="86" column="12" lean-forward="false" selection-start-line="86" selection-start-column="12" selection-end-line="86" selection-end-column="12" /> <caret line="86" column="12" lean-forward="false" selection-start-line="86" selection-start-column="12" selection-end-line="86" selection-end-column="12" />
<folding> <folding>
<element signature="e#0#28#0" expanded="true" /> <element signature="e#0#28#0" expanded="true" />
@ -518,8 +535,8 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/controllib.py"> <entry file="file://$PROJECT_DIR$/lib/controllib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187"> <state relative-caret-position="493">
<caret line="11" column="58" lean-forward="false" selection-start-line="11" selection-start-column="58" selection-end-line="11" selection-end-column="58" /> <caret line="53" column="38" lean-forward="true" selection-start-line="53" selection-start-column="38" selection-end-line="53" selection-end-column="38" />
<folding /> <folding />
</state> </state>
</provider> </provider>

@ -1,7 +1,7 @@
import pygame, os import pygame, os
class Joystick():
class Joystick():
def __init__(self, navigator, light, configuration, camera): def __init__(self, navigator, light, configuration, camera):
# joystick # joystick
pygame.joystick.init() pygame.joystick.init()
@ -88,7 +88,6 @@ class Joystick():
dict['Volume'] = self.sound.get_volume() dict['Volume'] = self.sound.get_volume()
return dict return dict
def _save_camimg(self): def _save_camimg(self):
self.camera.new_frame() self.camera.new_frame()
img = self.camera.image img = self.camera.image

@ -2,6 +2,7 @@ from subprocess import call, check_output
from lib import ultrasonic from lib import ultrasonic
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
class Navigator(): class Navigator():
"""Forward Motor with relais, Steering with servo""" """Forward Motor with relais, Steering with servo"""
@ -11,29 +12,24 @@ class Navigator():
GPIO.setup(self.mrelpin, GPIO.OUT) GPIO.setup(self.mrelpin, GPIO.OUT)
self.stop() self.stop()
def left(self): def left(self):
if self.steer != 'left': if self.steer != 'left':
call(['python', './lib/servolib.py', 'left']) call(['python', './lib/servolib.py', 'left'])
self.steer = 'left' self.steer = 'left'
def right(self): def right(self):
if self.steer != 'right': if self.steer != 'right':
call(['python', './lib/servolib.py', 'right']) call(['python', './lib/servolib.py', 'right'])
self.steer = 'right' self.steer = 'right'
def straight(self): def straight(self):
if self.steer: if self.steer:
call(['python', './lib/servolib.py']) call(['python', './lib/servolib.py'])
self.steer = None self.steer = None
def forward(self): def forward(self):
GPIO.output(self.mrelpin, False) GPIO.output(self.mrelpin, False)
def stop(self): def stop(self):
GPIO.output(self.mrelpin, True) GPIO.output(self.mrelpin, True)
@ -47,16 +43,14 @@ class Light:
GPIO.output(self.pin, True) GPIO.output(self.pin, True)
self.shine = False self.shine = False
def switch(self): def switch(self):
print('light switch {}'.format(self.shine))
GPIO.output(self.pin, not self.shine) GPIO.output(self.pin, not self.shine)
self.shine = not self.shine self.shine = not self.shine
def switch_on(self): def switch_on(self):
GPIO.output(self.pin, False) GPIO.output(self.pin, False)
def switch_of(self): def switch_of(self):
GPIO.output(self.pin, True) GPIO.output(self.pin, True)
@ -68,12 +62,10 @@ class Ultrasonic:
self.sensor = ultrasonic.Sensor() self.sensor = ultrasonic.Sensor()
self.sensor.init(trigger, echo) self.sensor.init(trigger, echo)
def get_distance(self): def get_distance(self):
distance = self.sensor.echo() distance = self.sensor.echo()
return distance return distance
def __del__(self): def __del__(self):
self.sensor.clean() self.sensor.clean()
@ -86,7 +78,6 @@ class Temperature:
temp, hum = outp.split('|') temp, hum = outp.split('|')
return temp return temp
def get_Humidity(self): def get_Humidity(self):
outp = check_output(['python', '-u', './lib/thermolib.py']).decode('ISO-8859-1') outp = check_output(['python', '-u', './lib/thermolib.py']).decode('ISO-8859-1')
temp, hum = outp.split('|') temp, hum = outp.split('|')

@ -36,15 +36,10 @@ def main():
running = False running = False
dict = jstick.handle() dict = jstick.handle()
print('joystick handled')
list.set_dict(dict) list.set_dict(dict)
print('list has dict')
all_sprites.update() all_sprites.update()
print('updating sprites')
update_rects = all_sprites.draw(screen.screen) update_rects = all_sprites.draw(screen.screen)
print('drawing sprites')
screen.refresh(rectangles= update_rects) screen.refresh(rectangles= update_rects)
print('refreshing screen')
pygame.quit() pygame.quit()

Loading…
Cancel
Save