mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-29 22:39:33 +00:00
@@ -55,7 +55,6 @@
|
||||
* [Supplementary materials](supplementary.md)
|
||||
* [COEX Pix](coex_pix.md)
|
||||
* [COEX PDB](coex_pdb.md)
|
||||
* [COEX GPS](coex_gps.md)
|
||||
* [Guide on autonomous flight](auto_setup.md)
|
||||
* [Hostname](hostname.md)
|
||||
* [PX4 Simulation](sitl.md)
|
||||
|
||||
147
docs/en/agriculture.md
Normal file
147
docs/en/agriculture.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Recognition of crop types in mass agricultural production
|
||||
|
||||
## Introduction
|
||||
|
||||
Modern agriculture in many countries is becoming one of the shining examples of the rapid and successful introduction of new technologies. Unmanned aerial vehicles are capable of performing a wide range of tasks, among which monitoring of agricultural land has now become a common tool for increasing the efficiency of agriculture. The goal of my project is to write a code for recognizing crop types in mass agricultural production. In the future, from the recognition results, you can design a map of sown areas.
|
||||
|
||||
## Monitoring
|
||||
|
||||
In agriculture, monitoring is necessary to obtain information on the state of land and crops. Based on the monitoring results, farmers or specialists can understand whether crops are sprouting normally, whether there is a threat from weeds and/or insects - pests, what is the degree of moisture in individual areas or entire areas, etc.
|
||||
|
||||
## Explanation of the code
|
||||
|
||||
Import libraries:
|
||||
|
||||
```python
|
||||
import rospy
|
||||
import cv2
|
||||
from sensor_msgs.msg import Image
|
||||
from cv_bridge import CvBridge
|
||||
import numpy as np
|
||||
```
|
||||
|
||||
Create some variables:
|
||||
|
||||
```python
|
||||
rospy.init_node('computer_vision_sample')
|
||||
|
||||
bridge = CvBridge()
|
||||
|
||||
color = 'undefined'
|
||||
shape = 'undefined'
|
||||
culture = ""
|
||||
```
|
||||
|
||||
To implement computer vision algorithms, it is recommended to use the OpenCV library preinstalled on the Clover image.
|
||||
Create a subscriber for the topic with the image from the main camera for processing using OpenCV:
|
||||
|
||||
```python
|
||||
def image_colback_color(data):
|
||||
global color, shape
|
||||
|
||||
cv_image = bridge.imgmsg_to_cv2(data, 'bgr8') # OpenCV image
|
||||
img_hsv = cv2.cvtColor(cv_image, cv2.COLOR_BGR2HSV) #[118:119,158:159]
|
||||
|
||||
#detected color
|
||||
#print(img_hsv[0][0])
|
||||
```
|
||||
|
||||
Each culture has its unique shade (wheat is golden, buckwheat is light brown).
|
||||
|
||||
<img src="../assets/field.jpg" width="75%">
|
||||
<img src="../assets/field2.jpg" width="75%">
|
||||
|
||||
We describe color ranges for certain crops:
|
||||
|
||||
```python
|
||||
#wheat
|
||||
yellow_orange_low = (38, 110, 150)
|
||||
yellow_orange_high= (52, 110, 150)
|
||||
|
||||
#buckwheat
|
||||
brown_low = (23, 50, 50)
|
||||
brown_high= (37, 50, 50)
|
||||
|
||||
yellow_orange_mask = cv2.inRange(img_hsv, yellow_orange_low, yellow_orange_high)
|
||||
brown_mask = cv2.inRange(img_hsv, brown_low, brown_high)
|
||||
|
||||
if yellow_orange_mask[119][159] == 255:
|
||||
shape = shape_recog(yellow_orange_mask)
|
||||
|
||||
elif brown_mask[119][159] == 255:
|
||||
shape = shape_recog(brown_mask)
|
||||
|
||||
else:
|
||||
shape = 'undefined'
|
||||
color = 'undefined'
|
||||
|
||||
if shape = 'brown':
|
||||
culture = "greshiha"
|
||||
if shape = 'yellow_orange':
|
||||
culture = "pshenitsa"
|
||||
|
||||
image_sub = rospy.Subscriber('main_camera/image_raw', Image, image_colback_color)
|
||||
```
|
||||
|
||||
The script will take up to 100% CPU capacity. To slow down the script artificially, you can use throttling of frames from the camera, for example, at 5 Hz (`main_camera.launch`):
|
||||
|
||||
```xml
|
||||
<node pkg="topic_tools" name="cam_throttle" type="throttle" args="messages main_camera/image_raw 5.0 main_camera/image_raw_throttled"/>
|
||||
```
|
||||
|
||||
The topic for the subscriber, in this case, should be changed for `main_camera/image_raw_throttled`.
|
||||
|
||||
```python
|
||||
print (culture)
|
||||
while not rospy.is_shutdown():
|
||||
print("color: {}".format(color))
|
||||
print("shape: {}".format(shape))
|
||||
rospy.sleep(0.2)
|
||||
```
|
||||
|
||||
This program will recognize the culture by its shade. We can use more color ranges to improve the accuracy of the recognition so the drone can recognize more crops.
|
||||
|
||||
Examples of color ranges for other colors:
|
||||
|
||||
```python
|
||||
red_low1 = (0, 110, 150)
|
||||
red_high1 = (7, 255, 255)
|
||||
|
||||
red_low2 = (172, 110, 150)
|
||||
red_high2 = (180, 255, 255)
|
||||
|
||||
red_orange_low = (8, 110, 150)
|
||||
red_orange_high = (22, 110, 150)
|
||||
|
||||
orange_low = (23, 110, 150)
|
||||
orange_high = (37, 110, 150)
|
||||
|
||||
yellow_orange_low = (38, 110, 150)
|
||||
yellow_orange_high = (52, 110, 150)
|
||||
|
||||
yellow_low = (53, 150, 150)
|
||||
yellow_high = (67, 255, 255)
|
||||
|
||||
yellow_green_low = (68, 150, 150)
|
||||
yellow_green_high = (82, 255, 255)
|
||||
|
||||
green_low = (83, 150, 150)
|
||||
green_high = (97, 255, 255)
|
||||
|
||||
blue_green_low = (98, 150, 150)
|
||||
blue_green_high = (113, 255, 255)
|
||||
|
||||
blue_low = (114, 150, 150)
|
||||
blue_high = (127, 255, 255)
|
||||
|
||||
blue_violet_low = (128, 150, 150)
|
||||
blue_violet_high = (142, 255, 255)
|
||||
|
||||
violet_low = (143, 150, 150)
|
||||
violet_high = (157, 255, 255)
|
||||
|
||||
red_violet_low = (158, 150, 150)
|
||||
red_violet_hugh = (171, 255, 255)
|
||||
```
|
||||
|
||||
Note that there are two ranges for red because red is at the edges of the HSV color space.
|
||||
@@ -1,11 +0,0 @@
|
||||
# COEX GPS
|
||||
|
||||
## Port pinouts
|
||||
|
||||
### Top view
|
||||
|
||||
<img src="../assets/coex_gps/coex-gps-top.png" width=400 class=zoom>
|
||||
|
||||
### Bottom view
|
||||
|
||||
<img src="../assets/coex_gps/coex-gps-bottom.png" width=400 class=zoom>
|
||||
15
docs/en/coex_pdb.md
Normal file
15
docs/en/coex_pdb.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# COEX PDB
|
||||
|
||||
**COEX PDB** is the power distribution board used in [Clover 4 Drone kit](assemble_4_2.md).
|
||||
|
||||
Board size: 35x35 mm.
|
||||
|
||||
## Port pinouts
|
||||
|
||||
### Top view
|
||||
|
||||
<img src="../assets/coex_pdb/coex-pdb-top.png" width=400 class=zoom>
|
||||
|
||||
### Bottom view
|
||||
|
||||
<img src="../assets/coex_pdb/coex-pdb-bottom.png" width=400 class=zoom>
|
||||
183
docs/en/zerotire_vpn.md
Normal file
183
docs/en/zerotire_vpn.md
Normal file
@@ -0,0 +1,183 @@
|
||||
# Creating a virtual network ZeroTire One and connecting to it
|
||||
|
||||
## Creating and configuring a ZeroTire network
|
||||
|
||||
1. Go to [ZeroTire](https://www.zerotier.com/) website.
|
||||
|
||||
<img src="../assets/zerotire/login_1.png" width=300 class="zoom border center">
|
||||
|
||||
2. Sign up on ZeroTire.
|
||||
|
||||
<img src="../assets/zerotire/login_2.png" width=300 class="zoom border center">
|
||||
|
||||
3. Go to your account.
|
||||
|
||||
4. Click on the *Create A Network*.
|
||||
|
||||
<img src="../assets/zerotire/network_1.png" width=300 class="zoom border center">
|
||||
|
||||
5. After that, you will see the network you created, its ID and name. Click on the network to configure it.
|
||||
|
||||
<img src="../assets/zerotire/network_2.png" width=300 class="zoom border center">
|
||||
|
||||
6. In the window that appears you can change the network name and connection privacy.
|
||||
|
||||
<img src="../assets/zerotire/network_3.png" width=300 class="zoom border center">
|
||||
|
||||
7. Scroll down to the *Members* column. It will say that there are no users on the network.
|
||||
|
||||
<img src="../assets/zerotire/network_4.png" width=300 class="zoom border center">
|
||||
|
||||
8. Devices connected to the network will be displayed in this column. To allow them to connect to the network, activate the *Auth?* checkbox. The connected device will automatically be given an internal IP address, which will then be used to communicate with this device.
|
||||
|
||||
<div class="image-group">
|
||||
<img src="../assets/zerotire/network_5.png" width=300 class="zoom border">
|
||||
<img src="../assets/zerotire/network_6.png" width=300 class="zoom border">
|
||||
</div>
|
||||
|
||||
> **Hint** specify names for new devices, it will help you distinguish them from each other in the future.
|
||||
|
||||
9. Repeat the last step for all the devices that you want to connect.
|
||||
|
||||
> **Info** ZeroTire network supports up to 50 users simultaneously for free use.
|
||||
|
||||
## Setup on Windows
|
||||
|
||||
### Installing the app
|
||||
|
||||
1. Go to the ZeroTire website.
|
||||
|
||||
<img src="../assets/zerotire/download_1.png" width=300 class="zoom border center">
|
||||
|
||||
2. Click on the Windows icon.
|
||||
|
||||
<img src="../assets/zerotire/download_2.png" width=300 class="zoom border center">
|
||||
|
||||
3. Download and run the `Zero Tare One.msi` file.
|
||||
|
||||
<div class="image-group">
|
||||
<img src="../assets/zerotire/windows_1.png" width=300 class="zoom border">
|
||||
<img src="../assets/zerotire/windows_2.png" width=300 class="zoom border">
|
||||
</div>
|
||||
|
||||
### Network connection
|
||||
|
||||
1. Run ZeroTire One.
|
||||
|
||||
2. Click on the ZeroTire One icon in the taskbar.
|
||||
|
||||
3. Click on the *Join Network...* to connect to the network.
|
||||
|
||||
<img src="../assets/zerotire/windows_3.png" width=300 class="zoom border center">
|
||||
|
||||
4. In the window that appears, enter your network ID and click *Join*.
|
||||
|
||||
<img src="../assets/zerotire/windows_4.png" width=300 class="zoom border center">
|
||||
|
||||
5. Allow using the new network.
|
||||
|
||||
## Setup on iOS
|
||||
|
||||
### Installing the app
|
||||
|
||||
1. Go to the ZeroTire website.
|
||||
|
||||
<img src="../assets/zerotire/download_1.png" width=300 class="zoom border center">
|
||||
|
||||
2. Click on the iOS icon.
|
||||
|
||||
<img src="../assets/zerotire/download_2.png" width=300 class="zoom border center">
|
||||
|
||||
3. Install the *ZeroTire One* app.
|
||||
|
||||
### Network connection
|
||||
|
||||
1. Run ZeroTire One app.
|
||||
|
||||
2. Click on *+* to add a new connection.
|
||||
|
||||
<img src="../assets/zerotire/ios_1.png" width=300 class="zoom border center">
|
||||
|
||||
3. Confirm the privacy policy.
|
||||
|
||||
<img src="../assets/zerotire/ios_2.png" width=300 class="zoom border center">
|
||||
|
||||
4. Enter your network ID and click *Add Network*.
|
||||
|
||||
<img src="../assets/zerotire/ios_3.png" width=300 class="zoom border center">
|
||||
|
||||
5. Confirm adding the new VPN configuration.
|
||||
|
||||
6. Connect to the VPN network by sliding the network activation slider.
|
||||
|
||||
<div class="image-group">
|
||||
<img src="../assets/zerotire/ios_4.png" width=300 class="zoom border">
|
||||
<img src="../assets/zerotire/ios_5.png" width=300 class="zoom border">
|
||||
</div>
|
||||
|
||||
## Setup on Linux (PC, Raspberry Pi)
|
||||
|
||||
### Installing the app
|
||||
|
||||
1. Open the console by pressing the keyboard shortcut *ctrl + alt + t* or type *terminal* in the program search bar.
|
||||
|
||||
2. Enter the Zero Tare installation command.
|
||||
|
||||
```bash
|
||||
curl -s https://install.zerotier.com | sudo bash
|
||||
```
|
||||
|
||||
### Network connection
|
||||
|
||||
1. Open the console.
|
||||
|
||||
2. Enter the command `sudo zerotire-cli join network-id`, where `network-id` is your network ID.
|
||||
|
||||
<img src="../assets/zerotire/linux_1.png" width=300 class="zoom border center">
|
||||
|
||||
3. If the connection is successful, the corresponding message will be displayed in the console.
|
||||
|
||||
## Installing and configuring on macOS
|
||||
|
||||
### Installing the app
|
||||
|
||||
1. Go to the ZeroTire website.
|
||||
|
||||
<img src="../assets/zerotire/download_1.png" width=300 class="zoom border center">
|
||||
|
||||
2. Click on the macOS icon.
|
||||
|
||||
<img src="../assets/zerotire/download_2.png" width=300 class="zoom border center">
|
||||
|
||||
3. Download and run `ZeroTire One.pkg` file.
|
||||
|
||||
4. Install the ZeroTire One app.
|
||||
|
||||
### Network connection
|
||||
|
||||
1. Run ZeroTire One app.
|
||||
|
||||
2. Click on the ZeroTire One icon in the taskbar .
|
||||
|
||||
3. In the window that appears, click on *Join Network...*.
|
||||
|
||||
<img src="../assets/zerotire/macos_1.png" width=300 class="zoom border center">
|
||||
|
||||
4. In the *Enter Network ID* field, enter your network ID.
|
||||
|
||||
<img src="../assets/zerotire/macos_2.png" width=300 class="zoom border center">
|
||||
|
||||
## Connecting to the copter
|
||||
|
||||
1. Make sure that ZeroTire is working and connected to the network on the drone and control device. To do this, make sure that these have an *Online* status.
|
||||
|
||||
<img src="../assets/zerotire/qgc_1.png" width=300 class="zoom border center">
|
||||
|
||||
2. Make sure that all devices have local IP addresses - *Managed IPs*.
|
||||
|
||||
3. Open GQC and in the *Comm Links* tab add a TCP connection specifying the IP of the drone. Read more about remote connection [here](gcs_bridge.md).
|
||||
|
||||
<div class="image-group">
|
||||
<img src="../assets/zerotire/qgc_2.png" width=300 class="zoom border">
|
||||
<img src="../assets/zerotire/qgc_3.png" width=300 class="zoom border">
|
||||
</div>
|
||||
Reference in New Issue
Block a user