Browse Source

Movement

developed algoirth completred
add-license-1
Yiğit Çolakoğlu 7 years ago
parent
commit
9bb839aa64
6 changed files with 205 additions and 54 deletions
  1. +5
    -0
      Barcode_Reader_Python/.idea/codeStyles/codeStyleConfig.xml
  2. +158
    -41
      Barcode_Reader_Python/.idea/workspace.xml
  3. +19
    -5
      Barcode_Reader_Python/generate_moves.py
  4. BIN
      Barcode_Reader_Python/generate_moves.pyc
  5. +22
    -8
      Barcode_Reader_Python/main.py
  6. +1
    -0
      Barcode_Reader_Python/move.py

+ 5
- 0
Barcode_Reader_Python/.idea/codeStyles/codeStyleConfig.xml View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

+ 158
- 41
Barcode_Reader_Python/.idea/workspace.xml View File

@ -2,9 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7b5ef56c-2d3e-44d9-be69-b414f166f99b" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/move.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/generate_moves.py" beforeDir="false" afterPath="$PROJECT_DIR$/generate_moves.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/sort_date.py" beforeDir="false" afterPath="$PROJECT_DIR$/sort_date.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@ -14,32 +16,39 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$move.coverage" NAME="move Coverage Results" MODIFIED="1529670744750" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$RUN.coverage" NAME="RUN Coverage Results" MODIFIED="1529584815747" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$generate_moves.coverage" NAME="generate_moves Coverage Results" MODIFIED="1529614908540" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$generate_moves.coverage" NAME="generate_moves Coverage Results" MODIFIED="1529665788763" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$raspberry_live.coverage" NAME="raspberry_live Coverage Results" MODIFIED="1529585357099" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$sort_date.coverage" NAME="sort_date Coverage Results" MODIFIED="1529590504238" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$main.coverage" NAME="main Coverage Results" MODIFIED="1529615873965" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$main.coverage" NAME="main Coverage Results" MODIFIED="1529672838644" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$Unnamed.coverage" NAME="raspberry_live Coverage Results" MODIFIED="1529543452123" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/Barcode_Reader_Python$database_actions.coverage" NAME="database_actions Coverage Results" MODIFIED="1529665501332" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
<component name="FileEditorManager">
<leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="main.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="75" lean-forward="true" selection-start-line="75" selection-end-line="75" />
<state relative-caret-position="425">
<caret line="59" column="15" lean-forward="true" selection-start-line="59" selection-start-column="15" selection-end-line="59" selection-end-column="15" />
<folding>
<element signature="e#32#69#0" expanded="true" />
<element signature="e#0#37#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="move.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/move.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file leaf-file-name="generate_moves.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/generate_moves.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="117" column="100" selection-start-line="117" selection-start-column="100" selection-end-line="117" selection-end-column="100" />
<state relative-caret-position="1875">
<caret line="125" column="20" selection-start-line="125" selection-start-column="20" selection-end-line="125" selection-end-column="20" />
</state>
</provider>
</entry>
@ -47,8 +56,17 @@
<file leaf-file-name="sort_date.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/sort_date.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="118" lean-forward="true" selection-start-line="118" selection-end-line="118" />
<state relative-caret-position="1770">
<caret line="118" selection-start-line="118" selection-end-line="118" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="database_actions.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/database_actions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
@ -82,6 +100,7 @@
<option value="$PROJECT_DIR$/raspberry_zbar.py" />
<option value="$PROJECT_DIR$/sort_date.py" />
<option value="$PROJECT_DIR$/generate_moves.py" />
<option value="$PROJECT_DIR$/move.py" />
<option value="$PROJECT_DIR$/main.py" />
</list>
</option>
@ -96,10 +115,10 @@
<packageJsonPaths />
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="1920" />
<option name="y" value="-4" />
<option name="width" value="1366" />
<option name="height" value="772" />
<option name="x" value="327" />
<option name="y" value="28" />
<option name="width" value="1356" />
<option name="height" value="768" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
@ -127,7 +146,7 @@
<property name="last_opened_file_path" value="$PROJECT_DIR$/run.py" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.Python" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
@ -161,6 +180,25 @@
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
</configuration>
<configuration name="database_actions" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="Barcode_Reader_Python" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/database_actions.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
</configuration>
<configuration name="generate_moves" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="Barcode_Reader_Python" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -199,6 +237,25 @@
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
</configuration>
<configuration name="move" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="Barcode_Reader_Python" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/move.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
</configuration>
<configuration name="raspberry_live" type="PythonConfigurationType" factoryName="Python">
<module name="Barcode_Reader_Python" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -243,11 +300,15 @@
<item itemvalue="Python.main" />
<item itemvalue="Python.sort_date" />
<item itemvalue="Python.generate_moves" />
<item itemvalue="Python.database_actions" />
<item itemvalue="Python.move" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.main" />
<item itemvalue="Python.move" />
<item itemvalue="Python.generate_moves" />
<item itemvalue="Python.database_actions" />
<item itemvalue="Python.sort_date" />
</list>
</recent_temporary>
@ -266,7 +327,7 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="1920" y="-4" width="1366" height="772" extended-state="7" />
<frame x="0" y="24" width="1920" height="1030" extended-state="6" />
<editor active="true" />
<layout>
<window_info anchor="bottom" id="TODO" order="6" />
@ -274,15 +335,15 @@
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Python Console" order="7" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49924126" visible="true" weight="0.27056962" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49924126" visible="true" weight="0.19213483" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info content_ui="combo" id="Project" order="0" weight="0.26783004" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.19070514" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="right" id="Database" order="3" />
<window_info anchor="right" id="SciView" order="3" weight="0.32928678" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39873418" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39775282" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.24962063" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
@ -292,27 +353,27 @@
<window_info anchor="bottom" id="Find" order="1" weight="0.32911393" />
</layout>
<layout-to-restore>
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.24962063" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26783004" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" id="SciView" order="3" weight="0.32928678" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49924126" visible="true" weight="0.27056962" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26783004" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Database Changes" order="9" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49924126" visible="true" weight="0.27056962" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32911393" />
<window_info anchor="bottom" id="Python Console" order="10" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39873418" />
<window_info anchor="right" id="Database" order="4" />
<window_info anchor="bottom" id="Terminal" order="11" />
<window_info anchor="bottom" id="Event Log" order="12" sideWeight="0.5007587" side_tool="true" weight="0.4638365" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Database Changes" order="9" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="right" id="SciView" order="3" weight="0.32928678" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32911393" />
<window_info anchor="bottom" id="Python Console" order="10" />
</layout-to-restore>
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -321,7 +382,46 @@
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="4" />
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="17" selection-start-line="17" selection-end-line="17" />
<folding>
<element signature="e#0#37#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/move.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/generate_moves.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1875">
<caret line="125" column="20" lean-forward="true" selection-start-line="125" selection-start-column="20" selection-end-line="125" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sort_date.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1770">
<caret line="118" selection-start-line="118" selection-end-line="118" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database_actions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/raspberry_zbar.py" />
<entry file="file://$PROJECT_DIR$/run.py" />
<entry file="file://$PROJECT_DIR$/barcodes.csv" />
@ -329,26 +429,43 @@
<entry file="file://$PROJECT_DIR$/barcodes.csv" />
<entry file="file://$PROJECT_DIR$/raspberry_zbar.py" />
<entry file="file://$PROJECT_DIR$/zbar_live.py" />
<entry file="file://$PROJECT_DIR$/generate_moves.py">
<entry file="file://$PROJECT_DIR$/sort_date.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="117" column="100" selection-start-line="117" selection-start-column="100" selection-end-line="117" selection-end-column="100" />
<state relative-caret-position="1770">
<caret line="118" selection-start-line="118" selection-end-line="118" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sort_date.py">
<entry file="file://$PROJECT_DIR$/database_actions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python2.7/dist-packages/serial/serialposix.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="118" lean-forward="true" selection-start-line="118" selection-end-line="118" />
<state relative-caret-position="214">
<caret line="270" column="12" lean-forward="true" selection-start-line="270" selection-start-column="12" selection-end-line="270" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/generate_moves.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1875">
<caret line="125" column="20" selection-start-line="125" selection-start-column="20" selection-end-line="125" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/move.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="75" lean-forward="true" selection-start-line="75" selection-end-line="75" />
<state relative-caret-position="425">
<caret line="59" column="15" lean-forward="true" selection-start-line="59" selection-start-column="15" selection-end-line="59" selection-end-column="15" />
<folding>
<element signature="e#32#69#0" expanded="true" />
<element signature="e#0#37#0" expanded="true" />
</folding>
</state>
</provider>


+ 19
- 5
Barcode_Reader_Python/generate_moves.py View File

@ -7,7 +7,7 @@ moved_item_loc = None
exp_date = []
shelf_new = []
repeats = 0
moves_return = None
def backArray(myArray):
global shelf_back
shelf_back = []
@ -27,6 +27,7 @@ def place():
global shelf_new
global repeats
global shelf_back
global moves_return
repeats += 1
backArray(exp_date)
moved_item = None
@ -52,13 +53,16 @@ def place():
print " Moved item {0} to location {1}. Location {2} is now empty!".format(moved_item, empty_loc + 1,
moved_item_loc + 1)
print "============================================================================"
print "============================================================================="
moves_return.append(str(moved_item_loc + 1))
moves_return.append(str(empty_loc + 1))
else:
print " Leaving item {0} in location {1}. Location {2} is still empty!".format(moved_item,
moved_item_loc + 1,
empty_loc + 1)
print "============================================================================"
correct_locs.append(moved_item_loc)
place()
else:
return
@ -68,6 +72,9 @@ def generate(dates,date_cur):
global exp_date
global shelf_new
global repeats
global moves_return
shelf_new = []
moves_return = []
exp_date = sort_date. calcDate(dates,date_cur)
shelf_back = exp_date[:]
try:
@ -103,8 +110,8 @@ def generate(dates,date_cur):
print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
print "============================================================================"
exp_date[i] = None
moves_return.append(str(i + 1))
moves_return.append(str(len(exp_date)))
else:
break
place()
@ -113,6 +120,13 @@ def generate(dates,date_cur):
print('***********************************************************************************')
print(' The last {} items have expired, throwing them away.'.format(len(exp_date)-shelf_new.index(-1)-1))
print('***********************************************************************************')
for i in range(len(shelf_new)-1,len(shelf_new)-shelf_new.index(-1),-1):
print "aaa"
moves_return.append(str(i))
moves_return.append("0")
except ValueError:
print(" No items have expired")
print('***********************************************************************************')
print('***********************************************************************************')
return moves_return

BIN
Barcode_Reader_Python/generate_moves.pyc View File


+ 22
- 8
Barcode_Reader_Python/main.py View File

@ -1,4 +1,3 @@
# import the necessary packages
from imutils.video import VideoStream
from pyzbar import pyzbar
import imutils
@ -7,9 +6,26 @@ import cv2
import database_actions
import datetime
import generate_moves
import serial
arduino = serial.Serial('/dev/ttyACM0', 115200, timeout=.1)
def move(locations):
reps = 0
for i in range(0,len(locations),2):
arduino.write(locations[i])
while(arduino.read() == '\x00'):
continue
arduino.write(locations[i+1])
while(arduino.read() == '\x00'):
continue
# initialize the video stream and allow the camera sensor to warm up
print("[INFO] starting video stream...")
def dateStr():
date_cur = ""
if len(str(datetime.date.today().day)) == 1:
@ -22,7 +38,6 @@ def dateStr():
date_cur = date_cur + str(datetime.date.today().month) + "."
date_cur += str(datetime.date.today().year)
return date_cur
# vs = VideoStream(src=0).start()
vs = VideoStream().start()
time.sleep(2.0)
dates = []
@ -32,10 +47,8 @@ prevcode = None
exp_date = []
current_date = dateStr()
print current_date
# loop over the frames from the video stream
while reps<1:
# grab the frame from the threaded video stream and resize it to
try:
while (barcodes == None or barcodes == []):
frame = vs.read()
@ -61,6 +74,7 @@ while reps<1:
print("[INFO] Found {} barcode: {}".format(barcodeType, barcodeData))
dates.append(database_actions.getDate(barcodeData))
reps += 1
arduino.write("1")
prevcode = barcodeData
barcodes = None
@ -69,10 +83,10 @@ while reps<1:
break
except KeyboardInterrupt:
break
# close the output CSV file do a bit of cleanup
print("[INFO] cleaning up...")
print dates
generate_moves.generate(dates,current_date)
print generate_moves.generate(dates,current_date)
cv2.destroyAllWindows()
vs.stop()

+ 1
- 0
Barcode_Reader_Python/move.py View File

@ -0,0 +1 @@

Loading…
Cancel
Save