Image for post
Image for post

Background

Setting up the Donkey Car software to run on your PC could be a challenging task, depending on your level of expertise in Python. It also depends on which platform you are using. Windows users tends to encounter more problems. If you are a teacher, you probably don’t want your students to spend 1 hour figuring out how to properly setup Conda or python without having any success running the Donkey Car software. How can we make the experience smoother?

One day, when I was preparing a talk to a group of teachers, I was wondering … how can I let them try Donkey Car without even installing the software? What if they could just download the mobile app and then connect to the simulator and race together? …

Donkey Car Controller is a mobile app designed to provide a “commandless” user experience to get started with the Donkey Car. This article gives a step-by-step guide on how you can use this app.

Image for post
Image for post

Requirement

Before you start, you need the followings:

  • A Donkey Car with Pi 4B (Jetson Nano is not yet supported)
  • A Mobile phone with iOS or Android

Install the mobile app

Robocar Controller is available on both Apple’s App Store and Google Play Store. Simply install this app on your phone.

p.s.: We actually want to call this app “Donkeycar Controller” but need some further work here to comply with Apple rules as Donkeycar is a trademark. …

Pi 4 is good except one thing: It consumes much more power than Pi3B+, which is definitely not good for application such as Donkey car. My experience is that my pi3b+ can run for an hour on a 1700mah LiPo battery but only 30–40 mins (max) on a pi4.

Raspberry Pi 4 has released a new boot EEPROM which claimed that, according to this article on Hackaday, it could low power mode for the USB hub and therefore supposingly allow us to run the Pi 4 on full speed without throttling and consume less power so we can run it longer on edge device, such as Donkey Car. …

9/1/2020 更新: 根據前幾天的 Governance Poll, 現時 DSR 已由4%升至6%

隨著 MakerDAO 成功將 SAI 升級至 DAI 後,由 Maker 開發的 Oasis App 也正式投入服務。Oasis App 提供存款,借貨及交易服務。或許你之前已經聽過 DAI 可以透過 Compound 來賺取利息,那麼親生兒子 Oasis 跟 Compound 有什麼分別呢?

Oasis 與 Compound 的分別

  1. Oasis 現時的 DSR (Dai Saving Rate) 剛剛透過 governance poll 由 2% 升至 4%,比 Compound 現時大約 2.8% 更為吸引。有趣的是,現時 Stability Fee 也是4%,即是說 Maker 現時全心追求 DSR 的使用率。若留意一下 daistats.com 的話,DSR 的 Utilization 暫時仍然只低於 20% 。
  2. Oasis 的利息源自 Stability Fee,是沒有對手風險的。Compound 的利息源自將你的存款借出,是有對手風險。不過,必須指出的是,Compound 的借款也是需要以 ETH 作為抵押品,我覺得也是挺安全的。
  3. 於 Oasis 的存款可以隨時提取。正常情況下,於 compound 的存款也可以隨時提取。不過,如果 Compound 那邊的 utilization rate 很高的話(代表存款被完全借出)而你的存款亦有一定數量的話,就未必可以即時提取出來。我相信若果你不是存幾十萬美金的話是不會有這個問題的。
Image for post
Image for post
Compound 現時 DAI 存款利息是 2.88%

雖然早一陣子我已經將手頭上的 SAI 升級到 DAI,不過就一直沒有動力將錢放入 DSR。原因就是 2% 的年息實在太少,令我懶得行動。昨天知道 DSR升至 4%,就立即試試如何存錢賺4厘息。

OASIS 實際操作

  1. 要將 DAI 放在 Oasis 收息其實很簡單,首先打開 Oasis.app。當然,在這之前你必須備有 Wallet 及 DAI。
Image for post
Image for post

2. 打開後,需要進行一次性的 Proxy Setup 及 Permission。這裡的話大約會用到 0.006 ETH (現價 0.88 USD)左右的 gas fee,而且也要等 10 個 block 的confirmation…

Install the video 4 linux utils

sudo apt-get install v4l-utils

Run the command v4l2-ctl to check the device. It should show this output.

jetbot@jetbot:~$ v4l2-ctl --list-devices
vi-output, imx219 6-0010 (platform:54080000.vi:0):
/dev/video0

Further check using v4l2-ctl. This command must be run on a local terminal (not a remote terminal via SSH). Something like this should output

nvidia@nvidia:~$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=300
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.03 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.02 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.01 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.01 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.01 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.01 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.01 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Finally, run this command and the live stream window should pop…

Image for post
Image for post

Today I am running my colab notebook to train the model for donkey car and notice that the default tensorflow runtime has been upgraded to tensorflow 1.15.0. I actually don’t care about it until I run the model on donkey car and the following error happen

loading model models/tub3.h5
Traceback (most recent call last):
File "/home/pi/env/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/input_layer.py", line 81, in __init__
raise ValueError('Unrecognized keyword arguments:', kwargs.keys())
ValueError: ('Unrecognized keyword arguments:', dict_keys(['ragged']))

I have omitted some of the error for simplicity but the problem looks like it is caused by incompatible version of tensorflow. The first thing I tried is to downgrade the tensorflow model to colab but it doesn’t work. …

先旨聲明: 我唔係專家,只係講出過去用大量時間研究後既睇法,所講既野可能有錯漏,以下內容並不構成任何投資建議。不過,我承諾以下係我真誠既睇法,希望大家可以互相交流。

首先,買 Crypto 必須是閒錢

我舊老闆對閒錢既定義: 「你可以輸晒既錢」

唔係你供仔女讀書既錢,亦唔係你既養老金。你無左呢筆錢唔會死,亦唔會怨天怨地,最緊要係唔會怨我。你用黎買 crypto 既錢你預左要輸晒既,所以唔洗訓身,亦都千祈唔好訓身。

你必須接受Crypto有價值

認同同接受係兩件事。你可以唔認同一層200呎樓值400萬,但你必須接受佢係以400萬交易緊。

我係2013年做 Crypto exchange 既時候,我並唔認同 Bitcoin 有價值,我覺得 D 人用黎投機,最後一定爆煲 (股神巴菲特都係咁諗)。過左六年,BTC 個價上過又落過,但係仍未爆煲。所以,你要接受喺好多人眼中,BTC 或其他 Crypto (例如 ETH)係有其價值,而且真實地交易中。

另外,我必須指出 ETH 同 BTC 本質上係唔同既。由於智能合約可以係ETH條chain上面運行,令我認為 ETH 比 BTC 更有用處。雖然如此,ETH 都有佢既問題,你想知多 d 網上大把公開資料,唔好聽完乜功課都唔做走去 All in ETH,無人會可憐你既!

買 Crypto 要有 Crypto 既思維同世界觀

有朋友心水清,計埋數去問我 Compound 收7厘息既計法:

MyETHShop 用港幣買入 DAI。買入價 8.2586,賣出 HKD 7.8785,假設 Compound 做到 7.16 厘息存一年,做100,000 港幣,((100000/8.2586)*1.0716)*7.8785=102,247.07,實際上年利率只得 2.4%。

呢個計法係啱既,成日兌換係會輸買賣差價,情況就等同你不斷唱港紙美金來來回回,都會輸到你訓低。

不過,咁既諗法有以下思考盲點:

盲點1: 你仲係想用港幣去換 Crypto

無可否認,用港幣換Crypto係最快捷既方法,大部分人包括我都係咁做。不過,快捷通常唔會平,你諗下撘的士同巴士既分別就知道了。另外,我係唔會直接買 DAI 既,我會買 ETH 先再轉。(又話唔好成日轉,會輸買賣差價? 一陣再解釋)

咁,點先可以用「靚價」買到ETH?有兩個方法:

  1. 善用 ETH 既波幅同埋限價盤(Limit Order)。例如Coinbase做緊HK$1300/ETH,MyETHShop買入價做$1350,你可以落定$1300限價盤去試下執唔執到平貨。佢落左 $1300 之後彈番上1350 你就快手轉做 DAI…

Image for post
Image for post

1. Make sure you have a steady power supply

Coral draws significant amount of energy from the Pi USB 3 interface. If you are experiencing under voltage, the pi will be throttled

Use this handy one-liner to check the status.

vcgencmd version; vcgencmd get_throttled; vcgencmd measure_volts; vcgencmd measure_temp;vcgencmd measure_clock arm;

You can also stress test your Pi to see if your power supply is stable enough.

2. Take care of system cooling

Install a big heatsink like this before you start. Pi will be throttled and therefore affect the performance of the coral.

3. Install Edgetpu library

Follow official doc. On Pi 4, you might experience this error

edgetpu_api/install.sh: line 51: warning: command substitution: ignored null byte in input
Your platform is not supported. …

Update: If you can’t find the model trained by colab, read this article to solve version issue.

One of the most time consuming task after you built the Donkey car must be training the model. It could easily take you 30 minutes or more if you don’t have a GPU on your PC. I have been using AWS for training models via the Donkey Car Console. It has been great except that I have to pay for the EC2 spot instance. Recently I have been using Google Colab a lot and therefore have the chance to create a notebook that could train the donkey car model. …

Update: If you are using newer Jetson software, note that you might need to use a newer isp profile. I haven’t verified it yet so please give it a shot and let me know.

Thanks Ville Saukkonen for mentioning this to me.

A lot of people are very interested in Nvidia recently announced Jetson Nano and JetBot. In many use cases including the JetBot and Donkey Car, we would want to use a wide angle camera. One of the recommended camera module for Jetson Nano is a Raspiberry Pi v2 camera module. This camera come with a standard camera lens which is not a wide angle lens. …

About

Jonathan Tse

Love Self-driving technology and machine learning. Community leader in DIYRobocar Hong Kong.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store