or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
參考:NCRL_MQTT
MQTT Server (Broker)
請參考: https://www.vultr.com/docs/install-mosquitto-mqtt-broker-on-ubuntu-20-04-server/
外網
首先查詢自己外網ip,交大都是(140.113.X.X):
寫完 default.conf 後重啟 mosquitto 服務
內網
首先查詢內網ip (192.168.X.X):

登入路由器做port fowarding:
設定完路由器設定 mosquitto
寫完 default.conf 後重啟 mosquitto 服務
Client
Client OS ubuntu 20.04
Client OS not ubuntu 20.04
1. Prerequisites
Authorization
1. broker 端新增 password file
2. 重啟 broker 端 server
3. 所有 client 都要新增 password 設定
帳號密碼要用在broker設定好的

以下為實驗室例子:
讀取topic
啟動mqtt_client以讀取數據,每個client都要打
可以用以下方式檢查是否能成功讀取
client1:
client2:
接下來內容為無人機讀取
Upstart
我們的樹梅派連接dongle,因為要再不同網域下ssh連到樹梅派有點麻煩,所以使用較簡單的方法,在開啟時同時啟動mqtt和mavros
以下指令皆在無人機上的樹梅派輸入當 client1
設定MQTT參數:
可以選其他topic與mqtt連接
重啟mqtt_client服務:
以下指令皆在其他電腦輸入當 client2
設定MQTT參數:
啟動mqtt_client以讀取數據
在終端機開啟其他分頁,並輸入想要看得topic,例如:
將mqtt與ros的橋架好後即可做數值讀取, 飛控
備註:
部分文章直接引用實驗室內容 https://hackmd.io/_ktvIEz5S4-YAGB62iy8Yw?view