Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Timthony/self_drive
Browse files Browse the repository at this point in the history
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
  • Loading branch information
Timthony committed Jan 2, 2019
2 parents 6a4bf1a + 6f468e4 commit a2228b7
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 539 deletions.
4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/self_drive.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

673 changes: 137 additions & 536 deletions .idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# self_drive
基于树莓派的人工智能自动驾驶小车

使用方法:
1. 先将树莓派小车硬件组装好
2. 使用zth_car_control.py来控制小车的前后左右移动,配合zth_collect_data.py来人工操作,使小车在自己制作的跑道进行数据采集。(该过程在树莓派进行)
3. 数据采集完成以后使用zth_process_img.py来对采集的数据进行处理,之前当前先完成一些数据清洗的工作。(电脑上执行)
4. 使用神经网络模型对数据进行训练zth_train.py,得到训练好的模型。(电脑上执行)
5. 在树莓派小车上使用zth_drive和训练好的模型,载入模型,即可实现在原先跑道的自动驾驶。(树莓派上执行)

![](https://ws3.sinaimg.cn/large/006tNbRwly1fw2xwxarf2j30u0140tbg.jpg)

2 changes: 1 addition & 1 deletion zth_collect_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def my_car_control():
global train_labels, train_img, key

print("capture thread")
print ('-' * 50)
print('-' * 50)
capture_thread = threading.Thread(target=pi_capture,args=()) # 开启线程
capture_thread.setDaemon(True)
capture_thread.start()
Expand Down
2 changes: 2 additions & 0 deletions zth_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def control_car(action_num):


# 利用神经网络的模型预测图像
# 继承父类threading.Thread
class ImageProcessor(threading.Thread):
def __init__(self, owner):
super(ImageProcessor, self).__init__()
Expand All @@ -54,6 +55,7 @@ def __init__(self, owner):
self.terminated = False
self.owner = owner
self.start()
# 要执行的代码写在run函数里面,线程创建后会直接运行run函数
def run(self):
global latest_time, model, graph
while not self.terminated:
Expand Down

0 comments on commit a2228b7

Please sign in to comment.