Skip to content

Commit 244e418

Browse files
committed
Add notes on kubernetes on a tractor
1 parent 1028fa1 commit 244e418

1 file changed

Lines changed: 156 additions & 0 deletions

File tree

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Kubernetes on a Tractor
2+
3+
> Precision farming powered by k3s, python and TensorRT at the far edge
4+
5+
## How to grow apples
6+
7+
- Apples need to be the same, perfect size
8+
- The tree needs the right amount of blossom. To much blossom gives small apples, too little blossom gives less apples
9+
10+
Feeding each tree individually brings in value, this is called precision agriculture. This includes _blossom thinning_ to
11+
force the ideal amount of blossom on a tree.
12+
13+
## Phase 1 - the TreeScout
14+
15+
Have a camera that captures a view of the trees, throw some image processing model at it to figure out the amount of blossoms
16+
on the tree.
17+
18+
Send the processed data to the cloud and visualize them on a map. This data can be loaded into a sprayer, so the sprayer only
19+
fires at trees with too much blossom.
20+
21+
### Challenge - where are the trees
22+
23+
The beta season in 2023 gathered some data, but it was not perfect. The GPS tracker did not track straight. The trees were
24+
being detected, but not in the right place. Farmers had to wait a month from drive to insights, this is a bit of a problem
25+
as the trees only blossom for two weeks.
26+
27+
### Challenge - hardware and software
28+
29+
Hardware and software have to be built for moving vehicles, where the shutoff mode is a powercut. Working with third-party
30+
hardware and cameras is also fun as you have to deal with third-party hardware drivers.
31+
32+
## Early architecture
33+
34+
A single python process leveraging _multiprocessing_, built into a Docker container, ran on a single machine. Unix pipes
35+
and watchdog kept the thing alive and enbaled inter-process communication.
36+
37+
### Where to go
38+
39+
Got with [ROS](https://www.ros.org/) or [k3s](https://k3s.io/). With ROS, you have to learn C++ and embedded software, with
40+
k3s you can keep using your Python stack, so they went with k3s.
41+
42+
## Current architecture
43+
44+
Run k3s on a single node, run python containers on top and use RabbitMQ for inter-process communication. The next year, the
45+
results were already more successful. The drives with results went from 6 to 85 and the time to insights went down from
46+
30 days to 1 hour.# Kubernetes on a Tractor
47+
48+
> Precision farming powered by k3s, python and TensorRT at the far edge
49+
50+
## How to grow apples
51+
52+
- Apples need to be the same, perfect size
53+
- The tree needs the right amount of blossom. To much blossom gives small apples, too little blossom gives less apples
54+
55+
Feeding each tree individually brings in value, this is called precision agriculture. This includes _blossom thinning_ to
56+
force the ideal amount of blossom on a tree.
57+
58+
## Phase 1 - the TreeScout
59+
60+
Have a camera that captures a view of the trees, throw some image processing model at it to figure out the amount of blossoms
61+
on the tree.
62+
63+
Send the processed data to the cloud and visualize them on a map. This data can be loaded into a sprayer, so the sprayer only
64+
fires at trees with too much blossom.
65+
66+
### Challenge - where are the trees
67+
68+
The beta season in 2023 gathered some data, but it was not perfect. The GPS tracker did not track straight. The trees were
69+
being detected, but not in the right place. Farmers had to wait a month from drive to insights, this is a bit of a problem
70+
as the trees only blossom for two weeks.
71+
72+
### Challenge - hardware and software
73+
74+
Hardware and software have to be built for moving vehicles, where the shutoff mode is a powercut. Working with third-party
75+
hardware and cameras is also fun as you have to deal with third-party hardware drivers.
76+
77+
## Early architecture
78+
79+
A single python process leveraging _multiprocessing_, built into a Docker container, ran on a single machine. Unix pipes
80+
and watchdog kept the thing alive and enbaled inter-process communication.
81+
82+
### Where to go
83+
84+
Got with [ROS](https://www.ros.org/) or [k3s](https://k3s.io/). With ROS, you have to learn C++ and embedded software, with
85+
k3s you can keep using your Python stack, so they went with k3s.
86+
87+
## Current architecture
88+
89+
Run k3s on a single node, run python containers on top and use RabbitMQ for inter-process communication. The next year, the
90+
results were already more successful. The drives with results went from 6 to 85 and the time to insights went down from
91+
30 days to 1 hour.# Kubernetes on a Tractor
92+
93+
> Precision farming powered by k3s, python and TensorRT at the far edge
94+
95+
## How to grow apples
96+
97+
- Apples need to be the same, perfect size
98+
- The tree needs the right amount of blossom. To much blossom gives small apples, too little blossom gives less apples
99+
100+
Feeding each tree individually brings in value, this is called precision agriculture. This includes _blossom thinning_ to
101+
force the ideal amount of blossom on a tree.
102+
103+
## Phase 1 - the TreeScout
104+
105+
Have a camera that captures a view of the trees, throw some image processing model at it to figure out the amount of blossoms
106+
on the tree.
107+
108+
Send the processed data to the cloud and visualize them on a map. This data can be loaded into a sprayer, so the sprayer only
109+
fires at trees with too much blossom.
110+
111+
### Challenge - where are the trees
112+
113+
The beta season in 2023 gathered some data, but it was not perfect. The GPS tracker did not track straight. The trees were
114+
being detected, but not in the right place. Farmers had to wait a month from drive to insights, this is a bit of a problem
115+
as the trees only blossom for two weeks.
116+
117+
### Challenge - hardware and software
118+
119+
Hardware and software have to be built for moving vehicles, where the shutoff mode is a powercut. Working with third-party
120+
hardware and cameras is also fun as you have to deal with third-party hardware drivers.
121+
122+
## Early architecture
123+
124+
A single python process leveraging _multiprocessing_, built into a Docker container, ran on a single machine. Unix pipes
125+
and watchdog kept the thing alive and enbaled inter-process communication.
126+
127+
### Where to go
128+
129+
Got with [ROS](https://www.ros.org/) or [k3s](https://k3s.io/). With ROS, you have to learn C++ and embedded software, with
130+
k3s you can keep using your Python stack, so they went with k3s.
131+
132+
## Current architecture
133+
134+
Run k3s on a single node, run python containers on top and use RabbitMQ for inter-process communication. The next year, the
135+
results were already more successful. The drives with results went from 6 to 85 and the time to insights went down from
136+
30 days to 1 hour.
137+
138+
### Not everything goes to plan
139+
140+
Sometimes the customer mounts the cameras upside down and your model freaks out. Tree roots are supposed to be on the bottom.
141+
142+
## Lessons learned
143+
144+
- Play to the teams strenght: if your team knows Python, dont change everything to C++
145+
- Python concurrency has its limits. You cannot horizontally scale without also ramping up cpu and memory usage.
146+
- Nvidia: CUDA on the cloud is bad, CUDA on the edge is worse.
147+
- Using a Dutch sim card in Germany has weird results with handing out IP addresses.
148+
- Keep it simple: Kubernetes and Helm is a good combo to start.
149+
150+
## Links
151+
152+
- <https://aureaimaging.com/>
153+
- <https://developer.nvidia.com/tensorrt>
154+
- <https://geopandas.org/en/stable/getting_started/introduction.html>
155+
- <https://kairos.io/>
156+
- <https://open-cluster-management.io/>

0 commit comments

Comments
 (0)