tags: ROS

turtlebot 網路連線

乙太連線(不一定要有對外網路)

方法一:遠端操控

  • 將turtlebot用乙太網路與電腦連線,此時可以在電腦用$cat /var/lib/misc/dnsmasq.leases查詢turtlebot的ip,就可以用ssh遠端到turtlebot
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 使用$sudo service ssh status可查詢狀態
  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 使用$sudo service ssh start開始ssh,開啟之後可用$sudo service ssh status查詢狀態
  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

若出現錯誤ssh: connect to host 10.42.0.1 port 22: Connection refused可能是因為沒有安裝openssh,使用sudo apt-get install openssh-server即可安裝(參考)

  • 使用$ssh {遠端電腦名稱}@{IP-adress} ex:ssh ubuntu@10.42.0.149
  • 輸入電腦密碼後即可成功登入電腦
  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

若是在確保ssh服務已開啟、管理員密碼正確、IP地址正確、網路通暢後,卻出現Permission denied(publickey,password)可能是因為在電腦中沒有建立turtlebot電腦的使用者,可使用以下方法建立參考

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

新增使用者

1.$sudo useradd 使用者名稱 -m ,其中-m:自動建立使用者的登入目錄。
2.檢視所有使用者:$ls /home/
4.為建立使用者設定密碼: $sudo passwd 使用者名稱
5.一定要記住密碼,不然只能刪除該使用者了

刪除使用者

$sudo userdel  使用者名稱

方法二:用micro hdmi轉hdmi轉接頭外接螢幕

  • 若登進去想知道turtlebot的ip可以使用$ifconfig

Wi-fi連線(參考)

  • 識別無限網路界面
    $ls /sys/class/net

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  • /etc/netplan資料夾去看Netplan參數設定檔案名稱,名稱可能是01-network-manager-all.yaml50-cloud-init.yaml
    $ls /etc/netplan/

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  • 編輯Netplan參數設定檔案
    $sudoedit /etc/netplan/50-cloud-init.yaml

  • 將SSID-NAME與PASSWORD改成Wi-fi的帳密

    ​​​​ wifis: ​​​​ wlan0: ​​​​ optional: true ​​​​ access-points: ​​​​ "SSID-NAME-HERE": ​​​​ password: "PASSWORD-HERE" ​​​​ dhcp4: true
    • 若是要在乙太網路使用static ip可參考此篇
  • 連線
    $sudo netplan apply或是$sudo netplan --debug apply(這個指令顯示較多資訊,如下)

  • 查詢無線網路ip
    $ip a,圖上192.168.43.193即為無線網路的ip

  • 此時若ssh想要斷開乙太網路連線而改連接Wifi的話,可輸入exit結束遠端,並使用無線網路的ip再次登入$ssh {遠端電腦名稱}@{IP-adress},要特別注意的是電腦及turtlebot要在同一個Wifi網域下才有辦法連線

其他

  • 關機指令$sudo shutdown now
Select a repo