Skip to content

Commit 5849047

Browse files
authored
sync changes brought in with DexterOS (#204)
* Feature/split easy libraries (#149) * add vscode to gitignore * split easygopigo3 into 2 files: easygopigo3 and easy_sensors * Bit of linting * split easygopigo3 library * change print statement to a cleaner one * remove I2C_mutex * typo * Split easygopigo3.py and create easysensors.py * Feature/overall mutex (#152) * add vscode to gitignore * split easygopigo3 into 2 files: easygopigo3 and easy_sensors * Bit of linting * split easygopigo3 library * change print statement to a cleaner one * remove I2C_mutex * typo * Split easygopigo3.py and create easysensors.py * upping version number to 1.2 * add a check for overall mutex need * Add comments about overall_mutex support * Notebooks for Mouse Controller project. Change turn_degrees blocking default (#153) * removing i2c_mutex which will be found in script_tools instead (#148) * Revert "removing i2c_mutex which will be found in script_tools instead (#148)" This reverts commit 1e9ba8f. * Revert the removal of mock packages in the docs * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * better handling of mutex checking (#155) * Bug/line follower (#156) * better handling of mutex checking * re-add Line Follower * Fix/overallmutex (#157) * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * Check overall_mutex flag each time. * Fix/trickle down use mutex value (#162) * Trickle down use_mutex values when sensors are instantiated from easygopigo3 * new reconfig_bus() method (#167) * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * Trickle down use_mutex values when sensors are instantiated from easygopigo3 * new reconfig_bus method * remove errant print * feature - updated documentation for all the things we did (#168) * feature - first major things to modify * feature - use conda instead of pip * feature - disable deb checker * feature - being explicit is safer than being sorry * feature - clean things up * feature - more on autosummary stuff * feature - create a new index for basic API * feature - add cross-reference to disensors * feature - lots of changes * remove version support on RTD as we don't have a release system * make EasyGoPiGo3 class's documentation up-to-date * feature - small improvement to a sentence * feature - further work on easygopigo3.py docstrings * feature - add list of soon to be deprecated API * feature - improve the "deprecated api" page * feature - split the documentation into sections * feature - add note to class graphic * feature - fix description alignments * feature - split functions/classes list into multiple lists * feature - fix the tutorials section * feature - make docs more pretty * Fix/distance sensor (#169) * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * change the call to easyDistanceSensor * Sync develop to master (#175) * Hotfix/broken update mutex (#173) * remove old libraries * Use pip instead of brute force * Bring Develop into Master (#174) * Update C++ drivers for FW version 1.0.0 * Feature/split easy libraries (#149) * add vscode to gitignore * split easygopigo3 into 2 files: easygopigo3 and easy_sensors * Bit of linting * split easygopigo3 library * change print statement to a cleaner one * remove I2C_mutex * typo * Split easygopigo3.py and create easysensors.py * Feature/overall mutex (#152) * add vscode to gitignore * split easygopigo3 into 2 files: easygopigo3 and easy_sensors * Bit of linting * split easygopigo3 library * change print statement to a cleaner one * remove I2C_mutex * typo * Split easygopigo3.py and create easysensors.py * upping version number to 1.2 * add a check for overall mutex need * Add comments about overall_mutex support * Notebooks for Mouse Controller project. Change turn_degrees blocking default (#153) * removing i2c_mutex which will be found in script_tools instead (#148) * Revert "removing i2c_mutex which will be found in script_tools instead (#148)" This reverts commit 1e9ba8f. * Revert the removal of mock packages in the docs * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * better handling of mutex checking (#155) * Bug/line follower (#156) * better handling of mutex checking * re-add Line Follower * Fix/overallmutex (#157) * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * Check overall_mutex flag each time. * Add reset method Add reset_motor_encoder as a simpler way to reset one or both motors' encoders to 0. * Fix/trickle down use mutex value (#162) * Trickle down use_mutex values when sensors are instantiated from easygopigo3 * new reconfig_bus() method (#167) * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * Trickle down use_mutex values when sensors are instantiated from easygopigo3 * new reconfig_bus method * remove errant print * feature - updated documentation for all the things we did (#168) * feature - first major things to modify * feature - use conda instead of pip * feature - disable deb checker * feature - being explicit is safer than being sorry * feature - clean things up * feature - more on autosummary stuff * feature - create a new index for basic API * feature - add cross-reference to disensors * feature - lots of changes * remove version support on RTD as we don't have a release system * make EasyGoPiGo3 class's documentation up-to-date * feature - small improvement to a sentence * feature - further work on easygopigo3.py docstrings * feature - add list of soon to be deprecated API * feature - improve the "deprecated api" page * feature - split the documentation into sections * feature - add note to class graphic * feature - fix description alignments * feature - split functions/classes list into multiple lists * feature - fix the tutorials section * feature - make docs more pretty * Fix/distance sensor (#169) * add 2 notebooks in Mouse Control Project * change blocking default in turn_degrees to be consistent * adjust documentation for turn_degrees blocking parameter * change the call to easyDistanceSensor * install control panel within install script (#177) * Add Scratch into the Pi menu (#170) * Fix/broken gui (#176) * remove old libraries * Fix control panel * Fix/control panel (#178) * install control panel within install script * Add a delay after reset_all * Rewrite the messages in the hardware test * feature - change how the installation of the robot goes (#180) * Update the GPG3 update and install scripts for Stretch * Add Dexter Industries and GoPiGo3 graphics * Cleanup * Add control panel on desktop * feature - replace non-existent variable & condition desktop file -> copy * feature - fix quiet_mode not working * feature - check if script is run with pi user * feature - add some comments on top of each function * feature - use exiting instead of aborting * feature - edit the installation readme * feature - adjust the readme in the root dir of the project * feature - change RTD instructions accordingly * feature - fix global variable issue * feature - refactor the installation script yet again * feature - replace non-existent variable with the right one * feature - missing "s" letter in one word * feature - add condition to dep checker * fix deprecated distance sensor init for Scratch (#181) * Remove confusion between left/right eyes (#182) * fix deprecated distance sensor init for Scratch * Rework Control Panel to remove confusion between left and right eye * Error window in Control Panel if GPG3 not found (#184) * fix deprecated distance sensor init for Scratch * Rework Control Panel to remove confusion between left and right eye * Pop error window if GPG3 not found, or firmware not set * feature - changing the sources (#183) * Update the GPG3 update and install scripts for Stretch * Add Dexter Industries and GoPiGo3 graphics * Cleanup * Add control panel on desktop * feature - replace non-existent variable & condition desktop file -> copy * feature - fix quiet_mode not working * feature - check if script is run with pi user * feature - add some comments on top of each function * feature - use exiting instead of aborting * feature - edit the installation readme * feature - adjust the readme in the root dir of the project * feature - change RTD instructions accordingly * feature - fix global variable issue * feature - refactor the installation script yet again * feature - replace non-existent variable with the right one * feature - missing "s" letter in one word * feature - add condition to dep checker * feature - Desktop is a folder and not a file * feature - change branches * feature - go with variable-set branch instead * fix - browser bot project (#187) * feature - make browser bot project on Stretch * fix - make the browser bot project work on jessie too * hotfix - make use of dynamic sources for video stream and web POSTs * feature - change script tools ref (#185) * fix deprecated distance sensor init for Scratch * Rework Control Panel to remove confusion between left and right eye * Pop error window if GPG3 not found, or firmware not set * feature - change refs for script_tools * Use direct links instead of redirects * fix - remove unnecessary instruction from install script (#188) * fix - remove unnecessary instruction from install script * fix - change which instruction to take out * read line follower from left to right, and speed it up (#200) * new methods: spin_left, spin_right, steer and orbit (#201) * added spin_right, spin_left and steer methods * add orbit() method; change order of methods * can't do metric conversion * Fix line follower examples (#202) * Fix line follower examples * add Readme * fix - the documentation & update the copyright year (#203) * fix - the documentation & fix a couple of things here and there * fix - typo for listed method * Update easygopigo3.py * fix - remove whitespace around =s in prototype
1 parent fe3aecc commit 5849047

File tree

9 files changed

+244
-289
lines changed

9 files changed

+244
-289
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# LINE FOLLOWER SENSOR
2+
3+
These files showcase how to use the line follower with a GoPiGo3.
4+
5+
For these files to work, the DI Sensors drivers must first be installed. On Raspbian for Robots they are pre-installed already.
6+
7+
## Installation
8+
If you need to install the DI Sensors repo, this is how to do it:
9+
10+
`curl -kL dexterindustries.com/update_sensors | bash`
11+
12+
## More
13+
See more at https://github.com/DexterInd/DI_Sensors

Software/Python/Examples/Line_Sensor/__init__.py

Whitespace-only changes.

Software/Python/Examples/Line_Sensor/basic_example.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@
2828
'''
2929
from __future__ import print_function
3030
from __future__ import division
31-
from builtins import input
3231
# the above lines are meant for Python3 compatibility.
3332
# they force the use of Python3 functionality for print(),
3433
# the integer division and input()
3534
# mind your parentheses!
3635

37-
import line_sensor
36+
from line_follower import line_sensor
3837
import time
3938

4039
def get_sensorval():

Software/Python/Examples/Line_Sensor/line_follower-basic_example.py

+27-14
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,37 @@
2828
'''
2929
from __future__ import print_function
3030
from __future__ import division
31-
from builtins import input
3231
# the above lines are meant for Python3 compatibility.
3332
# they force the use of Python3 functionality for print(),
3433
# the integer division and input()
3534
# mind your parentheses!
3635

37-
import line_sensor
36+
import easygopigo3 as easy
3837
import time
3938

40-
def get_sensorval():
41-
while True:
42-
val=line_sensor.read_sensor()
43-
if val[0]!=-1:
44-
return val
45-
#else:
46-
#Read once more to clear buffer and remove junk values
47-
# val=line_sensor.read_sensor()
48-
while True:
49-
l0,l1,l2,l3,l4=get_sensorval()
50-
print (l0,l1,l2,l3,l4)
51-
#time.sleep(.05)
39+
sensor_readings = None
40+
41+
gpg = easy.EasyGoPiGo3()
42+
43+
try:
44+
my_linefollower = gpg.init_line_follower()
45+
time.sleep(0.1)
46+
except:
47+
print('Line Follower not responding')
48+
time.sleep(0.2)
49+
exit()
50+
my_linefollower.read_position()
51+
my_linefollower.read_position()
52+
53+
54+
# start
55+
gpg.forward()
56+
while not my_linefollower.read_position() == "black":
57+
if my_linefollower.read_position() == 'center':
58+
gpg.forward()
59+
if my_linefollower.read_position() == 'left':
60+
gpg.left()
61+
if my_linefollower.read_position() == 'right':
62+
gpg.right()
63+
gpg.stop()
64+

Software/Python/Examples/Line_Sensor/line_sensor.py

-225
This file was deleted.

0 commit comments

Comments
 (0)