---
# System prepended metadata

title: Hardware & Simulation set up

---

Hardware & Simulation set up
===
這記錄了PC、樹莓派中的環境建置，以及基本的ROS套件模擬。
# 最新版本(ubuntu 22.04+ROS2 Humble)
## rpi4環境安裝
### 燒錄作業系統(ubuntu 22.04_desktop（64-bit）)
![image](https://hackmd.io/_uploads/S1Ii4nuYC.png)
(error1:因為網路實在太慢了，還好我本地端電腦裡就有Ubuntu的iso檔，我就直接用了。注意設定當中可以先允許連接無線網路，以及ssh連接。)
(error2:windows不支援大型sd卡的格式化😑最後還是派上老朋友rufus來下手，具體步驟請參考：https://youtu.be/0l7Bx3yTUq4?si=0I7HS2NTCh4wV5BC)


# 112-2學期中版本
## 模擬環境配置 VM ware
### 建立虛擬環境ubuntu 20.04
> 所有模擬皆在VMware 17的ubuntu 20.04（20GB）運行
> 測試者：Sheena 
> 運行PC：CPU-AMD Ryzen 9 5900HX
:::spoiler 4/5 Sheena @Design House
**Basic GOAL:**
1. 安裝ROS2 Foxy
2. 執行Beginner:CLI tools
3. 從CLI工具中，學會以下基本的概念：
- [x] Node節點
- [x] Topic主題
- [x] Services服務
- [x] Parameters參數
- [x] Action行動
4. 下載Git

:::spoiler Sheena's journal🍀
2-1爲了選擇一個domain ID，挑了特別的數字✨20✨
![image](https://hackmd.io/_uploads/HkWavx6yA.png)
2-2執行各個基礎教程，具體步驟參見Roger筆記：https://hackmd.io/@Rogger/Sy0wMSGq6

![image](https://hackmd.io/_uploads/HkPbox6JC.png)
🔼I've try to draw letter "F" to represent our project theme, which related to "fire🔥". However, the distance was hard to control😂turns out to be a weird "f" look.
![image](https://hackmd.io/_uploads/S1aHebpyC.png)
🔼Created my other turtle, named "FIRE", fortunately it shown as a red turtle🔥Also, I drew an abstract picture by changing their set pen... 
:::

### 創建工作包 Building workspace through colcon
```
$ mkdir -p sim_ws/src  
$ cd sim_ws/           
$ colcon build --symlink-install
$ ros2 pkg create --build-type ament_cmake {$FILE NAME : ex.sim_package}
```
> **`mkdir -p`**：創建新路徑 Create a new "parent" directory
> **`cd`** ：前往該資料夾 Move to this directory
> **`colcon build`** ：這種build的類型可以有更好的迭代
> Allow files to be changed in source space for better iterationn
> **`ros2 pkg create`**：依模版創建包 Create a new package based on a template
> **`--build-type`**：Colcon使用packge.xml的形式，支援不同的創建種類，依Foxy教程則最推薦使用兩種：`ament_python` ,`ament_cmake`

#### 關於ROS2 package的重要觀念(python, C/C++)
以下皆截圖自ROS2 Foxy documentation
##### C/C++語言
![image](https://hackmd.io/_uploads/BkOW5CRyA.png)
---
##### Python
![image](https://hackmd.io/_uploads/By_fcACk0.png)

參考資料：
https://articulatedrobotics.xyz/ready-for-ros-5-packages/
https://docs.ros.org/en/foxy/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html

### 創建URDF 【尚未完成】
參考資料：
https://youtu.be/Y_SyQXTL2XU?si=1zTzOYzyVT3NZB8x
https://docs.ros.org/en/foxy/Tutorials/Intermediate/URDF/URDF-Main.html

## 環境配置RPI 4
### 安裝記錄

:::spoiler RPI映像檔下載
##### 4/4 Sheena @Design House
Method: rpi imager
OS: ubuntu 20.04 server (64-bit)
Hardware: ADATA microSD 32GB (NT.249)
Hostname: rpi4
Username: fire
Password: ********** 
![image](https://hackmd.io/_uploads/BJu93MhJC.png)

![image](https://hackmd.io/_uploads/rkztafnyA.png)
(8:31~8:47pm)

參考來源：
https://blog.csdn.net/qq_37266917/article/details/132133191 
https://hackmd.io/@JINGCCC/piXubuntu
:::

:::spoiler ROS2 下載
##### 4/5 Sheena @Design House
參考ROS2 installation:
https://docs.ros.org/en/foxy/Installation.html 
:::

:::spoiler ssh設定
network: wlan0
connection: using @roger's wifi
ERRORs:
1. netplan doesn't allow "TAB"→ change to space
2. format should be strictly followed: there is colon(:) after SSID's name
 
參考來源：https://linuxconfig.org/ubuntu-20-04-connect-to-wifi-from-command-line
:::

:::spoiler 其它基本軟體下載
- [x] Git `version:2.25.1 @2024/4/5`
      `$ sudo apt update`
      `$ sudo apt install git`
- [x] OpenSSH-server 
      `$ sudo apt update`
      `$ sudo apt-get install openssh-server`
      `$ sudo systemctl status ssh` //查看ssh狀態
      參考資料：https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server/
- [x] Arduino IDE
      `$ sudo apt update`
      `$ sudo apt install arduino`
- [x] VS code
      Download from official website:https://code.visualstudio.com/download
      ⚠RPI 4 is based on ARMx64 bit CPU
      `$ cd Downloads`
      `$ sudo dpkg -i {FILE NAME that has been downloaded.file type}`
      參考資料：https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server/
:::
      
參考資源：https://youtu.be/RAqFgU3Gfv0?si=uLDo_tfE0DPsieoY