GoPiGo 小汽車《查核 鏡頭》

『鏡頭』就是小汽車的『眼睛』︰

詩經‧國風‧齊風‧猗嗟

猗嗟昌兮,頎而長兮。
抑若颺兮,美目颺兮。
巧趨蹌兮,射則臧兮。

猗嗟名兮,美目清兮。
儀既成兮,終日射侯,
不出正兮,展我甥兮。

猗嗟孌兮,清颺婉兮。
舞則選兮,射則貫兮,
四矢反兮,以禦亂兮。

魯莊公清颺美目來自寬容敦厚乎!所以能放管仲,因此方有

論語‧《憲問》

子貢曰:管仲非仁者與?桓公殺公子糾,不能死,又相之。

子曰:管仲相桓公,霸諸侯,一匡天下,民到于今受其賜。微管仲 ,吾其被髮左衽矣。豈若匹夫匹婦之為諒也,自經於溝瀆,而莫之知也。

論語褒貶耶?

之前我們曾經宣說 Michael Nielsen 之《神經網絡與深度學習Neural Networks and Deep Learning 大作。乃今談談『辨物識人』眼睛的光學原理,也算前後完整的吧。

尚未講『眼睛』之□○︰

(亦稱眼睛招子)是視覺器官,可以感知光線,轉換為神經中電化學的脈衝。比較複雜的眼睛是一個光學系統,可以收集周遭環境的光線,藉由虹膜調整進入眼睛的強度,利用可調整的晶狀體聚焦,投射到對光敏感的視網膜產生影像,將影像轉換為電的訊號,透過視神經傳遞到大腦視覺系統及其他部份。眼睛依其辨色能力可以分為十種不同的種類,有96%的動物其眼睛都是複雜的光學系統[1]。其中軟體動物脊索動物節肢動物的眼睛有成像的功能[2]

微生物的「眼睛」構造最簡單,只偵測環境的暗或是亮,這對於晝夜節律牽引有關[3]。若是更複雜的眼睛,視網膜上的感光神經節細胞沿著視網膜下視丘路徑傳送信號到視叉上核來影響影響生理調節,也送到頂蓋前核控制瞳孔光反射

Schematic_diagram_of_the_human_eye_zh-hans.svg

─── 摘自《光的世界︰【□○閱讀】話眼睛《一》

 

焉能不好好對待乎?所以特為小汽車加裝『顧盼伺服器』耶??

Attach the Raspberry Pi Camera With the Servo

Attach a Camera or Ultrasonic Sensor to the Raspberry Pi Robot GoPiGo (1)

Start with the Raspberry Pi Camera.

This tutorial assumes you have already built the servo package.  For instructions on building the servo package please see this.

 

#!/usr/bin/env python
########################################################################       
# This example demonstrates controlling the Servo on the GoPiGo robot.
# In this example, we control the servo with a keyboard.  When you run
# this example from the command line, you'll be prompted for input
# Press a key (a, d, or s) to move the servo.  The data is collected, 
# and sent to the GoPiGo.
#
# http://www.dexterindustries.com/GoPiGo/
# History
# ------------------------------------------------
# Author     Date               Comments
# Karan      21 Aug 14          Initial Authoring
#                                                                                
'''
## License
 GoPiGo for the Raspberry Pi: an open source robotics platform for the Raspberry Pi.
 Copyright (C) 2017  Dexter Industries

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>.
'''
#
########################################################################
from gopigo import *

servo_pos=90
print "CONTROLS"
print "a: move servo left"
print "d: move servo right"
print "s: move servo home"
print "Press ENTER to send the commands"

while True:
        #Get the input from the user and change the servo angles
        inp=raw_input()                         # Get keyboard input.
        # Now decide what to do with that keyboard input.  
        if inp=='a':
                servo_pos=servo_pos+10  # If input is 'a' move the servo forward 10 degrees.
        elif inp=='d':
                servo_pos=servo_pos-10  # If the input is 'd' move the servo backward by 10 degrees.
        elif inp=='s':
                servo_pos=90

        #Get the servo angles back to the normal 0 to 180 degree range
        if servo_pos>180:
                servo_pos=180
        if servo_pos<0:
                servo_pos=0

        servo(servo_pos)                # This function updates the servo with the latest positon.  Move the servo.
        time.sleep(.1)                  # Take a break in between operations.  

 

若是祇為著『穩固固定』也!說來有點所費不貲哩!!