-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogramming.html
64 lines (57 loc) · 42.7 KB
/
programming.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="VuePress 2.0.0-beta.38">
<style>
:root {
--c-bg: #fff;
}
html.dark {
--c-bg: #22272e;
}
html, body {
background-color: var(--c-bg);
}
</style>
<script>
const userMode = localStorage.getItem('vuepress-color-scheme');
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
document.documentElement.classList.toggle('dark', true);
}
</script>
<title>Programming | Clover</title><meta name="description" content="Clover Drone Kit">
<link rel="modulepreload" href="/clover-vuepress/assets/app.4f6a4bec.js"><link rel="modulepreload" href="/clover-vuepress/assets/programming.html.794ec9ae.js"><link rel="modulepreload" href="/clover-vuepress/assets/programming.html.b0a7bc53.js"><link rel="modulepreload" href="/clover-vuepress/assets/programming.5ff090c0.js">
<link rel="stylesheet" href="/clover-vuepress/assets/style.7a1025bf.css">
</head>
<body>
<div id="app"><!--[--><div class="theme-container"><!--[--><header ref_key="navbar" class="navbar"><div class="toggle-sidebar-button" title="true" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/clover-vuepress/en/" class=""><img class="logo" src="/clover-vuepress/clover-logo.png" alt="Clover"><span class="site-name can-hide">Clover</span></a></span><div class="navbar-items-wrapper" style=""><!--[--><!--]--><nav class="navbar-items can-hide"><!--[--><div class="navbar-item"><a class="external-link" href="https://coex.tech" rel="noopener noreferrer" target="_blank" aria-label="Official Site"><!--[--><!--]--> Official Site <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://t.me/COEXHelpdesk" rel="noopener noreferrer" target="_blank" aria-label="Support Chat"><!--[--><!--]--> Support Chat <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">Languages</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">Languages</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a aria-current="page" href="/clover-vuepress/en/programming.html" class="router-link-active router-link-exact-active router-link-active" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a href="/clover-vuepress/ru/programming.html" class="" aria-label="Русский"><!--[--><!--]--> Русский <!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/CopterExpress/clover" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><form class="search-box" role="search"><input type="search" autocomplete="off" spellcheck="false" value><!----></form></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-items"><!--[--><div class="navbar-item"><a class="external-link" href="https://coex.tech" rel="noopener noreferrer" target="_blank" aria-label="Official Site"><!--[--><!--]--> Official Site <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="https://t.me/COEXHelpdesk" rel="noopener noreferrer" target="_blank" aria-label="Support Chat"><!--[--><!--]--> Support Chat <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">Languages</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">Languages</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a aria-current="page" href="/clover-vuepress/en/programming.html" class="router-link-active router-link-exact-active router-link-active" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a href="/clover-vuepress/ru/programming.html" class="" aria-label="Русский"><!--[--><!--]--> Русский <!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/CopterExpress/clover" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-items"><!--[--><li><a href="/clover-vuepress/en/" class="sidebar-item sidebar-heading" aria-label="COEX Clover"><!--[--><!--]--> COEX Clover <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/glossary.html" class="sidebar-item sidebar-heading" aria-label="Glossary"><!--[--><!--]--> Glossary <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/safety.html" class="sidebar-item sidebar-heading" aria-label="Safety tips"><!--[--><!--]--> Safety tips <!--[--><!--]--></a><!----></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Assembly <span class="right arrow"></span></p><!--[--><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/clover-vuepress/en/assembly.html" class="sidebar-item" aria-label="Clover drone assembly"><!--[--><!--]--> Clover drone assembly <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/assemble_4_2.html" class="sidebar-item" aria-label="Clover 4.2 assembly"><!--[--><!--]--> Clover 4.2 assembly <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/assemble_4_2_ws.html" class="sidebar-item" aria-label="Clover 4 assembly"><!--[--><!--]--> Clover 4 assembly <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/assemble_4.html" class="sidebar-item" aria-label="Clover 4 assembly"><!--[--><!--]--> Clover 4 assembly <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/assemble_3.html" class="sidebar-item" aria-label="Assembly of Clover 3"><!--[--><!--]--> Assembly of Clover 3 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/assemble_2.html" class="sidebar-item" aria-label="Clover 2 construction kit assembly instruction"><!--[--><!--]--> Clover 2 construction kit assembly instruction <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Configuration <span class="right arrow"></span></p><!--[--><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/clover-vuepress/en/setup.html" class="sidebar-item" aria-label="Initial setup"><!--[--><!--]--> Initial setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/calibration.html" class="sidebar-item" aria-label="Sensor calibration"><!--[--><!--]--> Sensor calibration <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/radio.html" class="sidebar-item" aria-label="RC setup"><!--[--><!--]--> RC setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/rc_flysky_a8s.html" class="sidebar-item" aria-label="Using Flysky FS-A8S"><!--[--><!--]--> Using Flysky FS-A8S <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/modes.html" class="sidebar-item" aria-label="Flight modes"><!--[--><!--]--> Flight modes <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/power.html" class="sidebar-item" aria-label="Power setup"><!--[--><!--]--> Power setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/failsafe.html" class="sidebar-item" aria-label="Failsafe configuration"><!--[--><!--]--> Failsafe configuration <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Manual flight <span class="right arrow"></span></p><!--[--><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/clover-vuepress/en/flight.html" class="sidebar-item" aria-label="Flight"><!--[--><!--]--> Flight <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/flight_exercises.html" class="sidebar-item" aria-label="Drone control exercises"><!--[--><!--]--> Drone control exercises <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Working with Raspberry Pi <span class="right arrow"></span></p><!--[--><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/clover-vuepress/en/raspberry.html" class="sidebar-item" aria-label="Raspberry Pi"><!--[--><!--]--> Raspberry Pi <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/image.html" class="sidebar-item" aria-label="Raspberry Pi image"><!--[--><!--]--> Raspberry Pi image <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/wifi.html" class="sidebar-item" aria-label="Connecting to Clover via Wi-Fi"><!--[--><!--]--> Connecting to Clover via Wi-Fi <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/connection.html" class="sidebar-item" aria-label="Connecting Raspberry Pi to the flight controller"><!--[--><!--]--> Connecting Raspberry Pi to the flight controller <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/gcs_bridge.html" class="sidebar-item" aria-label="Using QGroundControl via Wi-Fi"><!--[--><!--]--> Using QGroundControl via Wi-Fi <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/ssh.html" class="sidebar-item" aria-label="SSH access to Raspberry Pi"><!--[--><!--]--> SSH access to Raspberry Pi <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/cli.html" class="sidebar-item" aria-label="Command line interface"><!--[--><!--]--> Command line interface <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/selfcheck.html" class="sidebar-item" aria-label="Automatic check"><!--[--><!--]--> Automatic check <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/web_video_server.html" class="sidebar-item" aria-label="Viewing images from cameras"><!--[--><!--]--> Viewing images from cameras <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><li><p tabindex="0" class="sidebar-item sidebar-heading active collapsible">Programming <span class="down arrow"></span></p><!--[--><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/clover-vuepress/en/programming.html" class="router-link-active router-link-exact-active router-link-active sidebar-item active" aria-label="Programming"><!--[--><!--]--> Programming <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/camera_setup.html" class="sidebar-item" aria-label="Camera setup"><!--[--><!--]--> Camera setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/aruco.html" class="sidebar-item" aria-label="ArUco markers"><!--[--><!--]--> ArUco markers <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/aruco_marker.html" class="sidebar-item" aria-label="ArUco marker detection"><!--[--><!--]--> ArUco marker detection <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/aruco_map.html" class="sidebar-item" aria-label="Map-based navigation with ArUco markers"><!--[--><!--]--> Map-based navigation with ArUco markers <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/optical_flow.html" class="sidebar-item" aria-label="Use of Optical Flow"><!--[--><!--]--> Use of Optical Flow <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/simple_offboard.html" class="sidebar-item" aria-label="Autonomous flight"><!--[--><!--]--> Autonomous flight <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/frames.html" class="sidebar-item" aria-label="Coordinate systems (frames)"><!--[--><!--]--> Coordinate systems (frames) <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/snippets.html" class="sidebar-item" aria-label="Code examples"><!--[--><!--]--> Code examples <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/laser.html" class="sidebar-item" aria-label="Working with a laser rangefinder"><!--[--><!--]--> Working with a laser rangefinder <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/leds.html" class="sidebar-item" aria-label="Working with a LED strip"><!--[--><!--]--> Working with a LED strip <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/gpio.html" class="sidebar-item" aria-label="Working with GPIO"><!--[--><!--]--> Working with GPIO <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/sonar.html" class="sidebar-item" aria-label="Working with the ultrasonic distance gage"><!--[--><!--]--> Working with the ultrasonic distance gage <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/camera.html" class="sidebar-item" aria-label="Working with the camera"><!--[--><!--]--> Working with the camera <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/rviz.html" class="sidebar-item" aria-label="Using rviz and rqt"><!--[--><!--]--> Using rviz and rqt <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/autolaunch.html" class="sidebar-item" aria-label="Software autorun"><!--[--><!--]--> Software autorun <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/javascript.html" class="sidebar-item" aria-label="Work with ROS from browser"><!--[--><!--]--> Work with ROS from browser <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/blocks.html" class="sidebar-item" aria-label="Blocks programming for Clover"><!--[--><!--]--> Blocks programming for Clover <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/simulation.html" class="sidebar-item" aria-label="Simulation overview"><!--[--><!--]--> Simulation overview <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/simulation_native.html" class="sidebar-item" aria-label="Native setup"><!--[--><!--]--> Native setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/simulation_vm.html" class="sidebar-item" aria-label="Simulation VM setup"><!--[--><!--]--> Simulation VM setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/simulation_usage.html" class="sidebar-item" aria-label="Using the simulator"><!--[--><!--]--> Using the simulator <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/simulation_m1.html" class="sidebar-item" aria-label="Running simulator on M1 powered computer"><!--[--><!--]--> Running simulator on M1 powered computer <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/ros.html" class="sidebar-item" aria-label="ROS"><!--[--><!--]--> ROS <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/mavros.html" class="sidebar-item" aria-label="MAVROS"><!--[--><!--]--> MAVROS <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Supplementary materials <span class="right arrow"></span></p><!--[--><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/clover-vuepress/en/supplementary.html" class="sidebar-item" aria-label="Supplementary materials"><!--[--><!--]--> Supplementary materials <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/coex_pix.html" class="sidebar-item" aria-label="COEX Pix"><!--[--><!--]--> COEX Pix <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/coex_pdb.html" class="sidebar-item" aria-label="COEX PDB"><!--[--><!--]--> COEX PDB <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/coex_gps.html" class="sidebar-item" aria-label="COEX GPS"><!--[--><!--]--> COEX GPS <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/auto_setup.html" class="sidebar-item" aria-label="Step-by-step guide on autonomous flight with Clover 4"><!--[--><!--]--> Step-by-step guide on autonomous flight with Clover 4 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/hostname.html" class="sidebar-item" aria-label="Hostname"><!--[--><!--]--> Hostname <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/sitl.html" class="sidebar-item" aria-label="PX4 Simulation"><!--[--><!--]--> PX4 Simulation <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/wall_aruco.html" class="sidebar-item" aria-label="Navigation using vertical ArUco-markers"><!--[--><!--]--> Navigation using vertical ArUco-markers <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/calibratePID.html" class="sidebar-item" aria-label="Configuring the PID coefficients"><!--[--><!--]--> Configuring the PID coefficients <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/models.html" class="sidebar-item" aria-label="Model files for parts"><!--[--><!--]--> Model files for parts <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/ros-install.html" class="sidebar-item" aria-label="ROS Melodic package installation and setup"><!--[--><!--]--> ROS Melodic package installation and setup <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/camera_calibration.html" class="sidebar-item" aria-label="Camera calibration"><!--[--><!--]--> Camera calibration <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/zerotire_vpn.html" class="sidebar-item" aria-label="Creating a virtual network ZeroTier One and connecting to it"><!--[--><!--]--> Creating a virtual network ZeroTier One and connecting to it <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/4g.html" class="sidebar-item" aria-label="Multi-copter control with 4G communication"><!--[--><!--]--> Multi-copter control with 4G communication <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/jetson_nano.html" class="sidebar-item" aria-label="Clover and Jetson Nano"><!--[--><!--]--> Clover and Jetson Nano <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/rc.html" class="sidebar-item" aria-label="Controlling Clover from a smartphone"><!--[--><!--]--> Controlling Clover from a smartphone <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/network.html" class="sidebar-item" aria-label="Configuring Wi-Fi"><!--[--><!--]--> Configuring Wi-Fi <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/uart.html" class="sidebar-item" aria-label="UART interface"><!--[--><!--]--> UART interface <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/parameters.html" class="sidebar-item" aria-label="PX4 Parameters"><!--[--><!--]--> PX4 Parameters <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/flight_logs.html" class="sidebar-item" aria-label="PX4 Logs and Topics"><!--[--><!--]--> PX4 Logs and Topics <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/firmware.html" class="sidebar-item" aria-label="Pixhawk / Pixracer firmware flashing"><!--[--><!--]--> Pixhawk / Pixracer firmware flashing <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/mavlink.html" class="sidebar-item" aria-label="MAVLink"><!--[--><!--]--> MAVLink <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/test_connection.html" class="sidebar-item" aria-label="How to use a multimeter?"><!--[--><!--]--> How to use a multimeter? <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/radioerrors.html" class="sidebar-item" aria-label="Possible radio failures"><!--[--><!--]--> Possible radio failures <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/esc_firmware.html" class="sidebar-item" aria-label="Flashing ESCs using BLHeliSuite"><!--[--><!--]--> Flashing ESCs using BLHeliSuite <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/arduino.html" class="sidebar-item" aria-label="Controlling the copter from Arduino"><!--[--><!--]--> Controlling the copter from Arduino <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/gps.html" class="sidebar-item" aria-label="Connecting GPS"><!--[--><!--]--> Connecting GPS <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/ir_sensors.html" class="sidebar-item" aria-label="Working with IR sensors on Raspberry Pi 3"><!--[--><!--]--> Working with IR sensors on Raspberry Pi 3 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/fpv_clover_4_2.html" class="sidebar-item" aria-label="Installing and configuring FPV equipment"><!--[--><!--]--> Installing and configuring FPV equipment <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/fpv.html" class="sidebar-item" aria-label="Installation of FPV"><!--[--><!--]--> Installation of FPV <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/magnetic_grip.html" class="sidebar-item" aria-label="Assembling and setting up the electromagnetic gripper"><!--[--><!--]--> Assembling and setting up the electromagnetic gripper <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/mechanical_grip.html" class="sidebar-item" aria-label="Assembling and setting up a mechanical gripper"><!--[--><!--]--> Assembling and setting up a mechanical gripper <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/trainer_mode.html" class="sidebar-item" aria-label="FlySky Trainer mode settings"><!--[--><!--]--> FlySky Trainer mode settings <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/tinning.html" class="sidebar-item" aria-label="Blanching"><!--[--><!--]--> Blanching <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/connectortypes.html" class="sidebar-item" aria-label="Types of power connectors"><!--[--><!--]--> Types of power connectors <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/4in1.html" class="sidebar-item" aria-label="Connecting 4 in 1 ESCs"><!--[--><!--]--> Connecting 4 in 1 ESCs <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/tb.html" class="sidebar-item" aria-label="Soldering safety"><!--[--><!--]--> Soldering safety <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/leds_old.html" class="sidebar-item" aria-label="Working with a LED strip on Raspberry 3"><!--[--><!--]--> Working with a LED strip on Raspberry 3 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/contributing.html" class="sidebar-item" aria-label="Contribution to Clover"><!--[--><!--]--> Contribution to Clover <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/packages.html" class="sidebar-item" aria-label="COEX packages repository"><!--[--><!--]--> COEX packages repository <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/migrate20.html" class="sidebar-item" aria-label="Migration to version 0.20"><!--[--><!--]--> Migration to version 0.20 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/migrate22.html" class="sidebar-item" aria-label="Migration to version 0.22"><!--[--><!--]--> Migration to version 0.22 <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Events <span class="right arrow"></span></p><!--[--><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/clover-vuepress/en/events.html" class="sidebar-item" aria-label="Events"><!--[--><!--]--> Events <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/copterhack2022.html" class="sidebar-item" aria-label="CopterHack 2022"><!--[--><!--]--> CopterHack 2022 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/copterhack2021.html" class="sidebar-item" aria-label="CopterHack 2021"><!--[--><!--]--> CopterHack 2021 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/copterhack2019.html" class="sidebar-item" aria-label="Copter Hack 2019"><!--[--><!--]--> Copter Hack 2019 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/copterhack2018.html" class="sidebar-item" aria-label="Copter Hack 2018"><!--[--><!--]--> Copter Hack 2018 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/copterhack2017.html" class="sidebar-item" aria-label="Copter Hack 2017"><!--[--><!--]--> Copter Hack 2017 <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/video_contest.html" class="sidebar-item" aria-label="Contest for the best educational video on assembly and configuration"><!--[--><!--]--> Contest for the best educational video on assembly and configuration <!--[--><!--]--></a><!----></li><li><a href="/clover-vuepress/en/educational_contests.html" class="sidebar-item" aria-label="Educational contests"><!--[--><!--]--> Educational contests <!--[--><!--]--></a><!----></li><!--]--></ul><!--]--></li><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="programming" tabindex="-1"><a class="header-anchor" href="#programming" aria-hidden="true">#</a> Programming</h1><img src="/clover-vuepress/assets/programming.5feb24a0.png" width="250" align="right"><p>The Clover platform allows a <a href="/clover-vuepress/en/raspberry.html" class="">Raspberry Pi</a> computer to be used for programming autonomous flights. The flight program is typically written using the Python programming language. The program may <a href="/clover-vuepress/en/simple_offboard.html#get_telemetry" class="">receive telemetry data</a> (which includes battery data, attitude, position, and other parameters) and send commands like: <a href="/clover-vuepress/en/simple_offboard.html#navigate" class="">fly to a point in space</a>, <a href="/clover-vuepress/en/simple_offboard.html#set_attitude" class="">set attitude</a>, <a href="/clover-vuepress/en/simple_offboard.html#set_rates" class="">set angular rates</a>, and others.</p><p>The platform utilizes the <a href="/clover-vuepress/en/ros.html" class="">ROS framework</a>, which allows the user program to communicate with the Clover services that are running as a <code>clover</code> systemd daemon. The <a href="/clover-vuepress/en/mavros.html" class="">MAVROS</a> package is used to interact with the flight controller.</p><p>PX4 uses <a href="/clover-vuepress/en/modes.html#auto" class="">OFFBOARD mode</a> for autonomous flights. The Clover API can be used to transition the drone to this flight mode automatically. If you need to interrupt the autonomous flight, use your flight mode stick on your RC controller to transition to any other flight mode.</p><h2 id="positioning" tabindex="-1"><a class="header-anchor" href="#positioning" aria-hidden="true">#</a> Positioning system</h2><p>A drone has to use a positioning system to be able to hover still or to fly from point to point. The system should compute the drone position and feed this data into the flight controller. Clover allows using multiple positioning systems, such as <a href="/clover-vuepress/en/optical_flow.html" class="">optical flow</a> (requires a <a href="/clover-vuepress/en/camera.html" class="">camera</a> and a <a href="/clover-vuepress/en/laser.html" class="">rangefinder</a>), <a href="/clover-vuepress/en/aruco.html" class="">fiducial markers</a> (requires a camera and markers), GPS and others.</p><h3 id="optical-flow" tabindex="-1"><a class="header-anchor" href="#optical-flow" aria-hidden="true">#</a> Optical flow</h3><p>Optical flow is used to compute shifts between consecutive frames and to use this data to compute the drone shifting in space.</p><p>Read more in the <a href="/clover-vuepress/en/optical_flow.html" class="">Optical Flow article</a>.</p><h3 id="aruco-markers" tabindex="-1"><a class="header-anchor" href="#aruco-markers" aria-hidden="true">#</a> ArUco markers</h3><p>Fiducial markers allow the drone to compute its position relative to these markers. This data may then be transferred to the flight controller.</p><p>Read more about <a href="/clover-vuepress/en/aruco.html" class="">ArUco markers</a> in our articles about them.</p><h3 id="gps-outdoor-flight" tabindex="-1"><a class="header-anchor" href="#gps-outdoor-flight" aria-hidden="true">#</a> GPS (outdoor flight)</h3><p>GPS allows you to specify global Earth coordinates (latitude and longitude). The <a href="/clover-vuepress/en/simple_offboard.html#navigate_global" class=""><code>navigate_global</code></a> function takes these as parameters instead of the usual cartesian coordinates.</p><p>Read more in the <a href="/clover-vuepress/en/gps.html" class="">GPS connection</a> article.</p><h2 id="flight" tabindex="-1"><a class="header-anchor" href="#flight" aria-hidden="true">#</a> Autonomous flight</h2><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>For studying Python programming language, see <a href="https://www.learnpython.org/en/Welcome" target="_blank" rel="noopener noreferrer">tutorial<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>.</p></div><p>After you've configured your positioning system, you can start writing programs for autonomous flights. Use the <a href="/clover-vuepress/en/ssh.html" class="">SSH connection to the Raspberry Pi</a> to run your scripts.</p><p>Before the first flight it's recommended to check the Clover's configuration with <a href="/clover-vuepress/en/selfcheck.html" class="">selfcheck.py utility</a>:</p><div class="language-bash ext-sh"><pre class="language-bash"><code>rosrun clover selfcheck.py
</code></pre></div><p>In order to run a Python script use the <code>python3</code> command:</p><div class="language-bash ext-sh"><pre class="language-bash"><code>python3 flight.py
</code></pre></div><p>Below is a complete flight program that performs a takeoff, flies forward and lands:</p><div class="language-python ext-py"><pre class="language-python"><code><span class="token keyword">import</span> rospy
<span class="token keyword">from</span> clover <span class="token keyword">import</span> srv
<span class="token keyword">from</span> std_srvs<span class="token punctuation">.</span>srv <span class="token keyword">import</span> Trigger
rospy<span class="token punctuation">.</span>init_node<span class="token punctuation">(</span><span class="token string">'flight'</span><span class="token punctuation">)</span>
get_telemetry <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'get_telemetry'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>GetTelemetry<span class="token punctuation">)</span>
navigate <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'navigate'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>Navigate<span class="token punctuation">)</span>
navigate_global <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'navigate_global'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>NavigateGlobal<span class="token punctuation">)</span>
set_position <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'set_position'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>SetPosition<span class="token punctuation">)</span>
set_velocity <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'set_velocity'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>SetVelocity<span class="token punctuation">)</span>
set_attitude <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'set_attitude'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>SetAttitude<span class="token punctuation">)</span>
set_rates <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'set_rates'</span><span class="token punctuation">,</span> srv<span class="token punctuation">.</span>SetRates<span class="token punctuation">)</span>
land <span class="token operator">=</span> rospy<span class="token punctuation">.</span>ServiceProxy<span class="token punctuation">(</span><span class="token string">'land'</span><span class="token punctuation">,</span> Trigger<span class="token punctuation">)</span>
<span class="token comment"># Takeoff and hover 1 m above the ground</span>
navigate<span class="token punctuation">(</span>x<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> y<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> z<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">,</span> frame_id<span class="token operator">=</span><span class="token string">'body'</span><span class="token punctuation">,</span> auto_arm<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span>
<span class="token comment"># Wait for 3 seconds</span>
rospy<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span>
<span class="token comment"># Fly forward 1 m</span>
navigate<span class="token punctuation">(</span>x<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">,</span> y<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> z<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> frame_id<span class="token operator">=</span><span class="token string">'body'</span><span class="token punctuation">)</span>
<span class="token comment"># Wait for 3 seconds</span>
rospy<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span>
<span class="token comment"># Perform landing</span>
land<span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre></div><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>The <code>navigate</code> function call is not blocking; that is, the program will continue executing the next commands before the drone arrives at the set point. Look at the <a href="/clover-vuepress/en/snippets.html#navigate_wait" class=""><code>navigate_wait</code></a> snippet for a blocking function.</p></div><p>Note that only the first <code>navigate</code> call has its <code>auto_arm</code> parameter set to <code>True</code>. This parameter arms the drone and transitions it to the OFFBOARD flight mode.</p><p>The <code>frame_id</code> parameter specifies which frame of reference will be used for the target point:</p><ul><li><code>body</code> is rigidly bound to the drone body;</li><li><code>navigate_target</code> has its origin at the last target point for <code>navigate</code>;</li><li><code>map</code> is the drone's local frame;</li><li><code>aruco_map</code> is bound to the ArUco marker map;</li><li><code>aruco_N</code> is bound to the marker with ID=N.</li></ul><p>Read more in the <a href="/clover-vuepress/en/frames.html" class="">coordinate systems</a> article.</p><p>You can also use the <a href="/clover-vuepress/en/simple_offboard.html" class="">"Autonomous flight"</a> article as an API reference.</p><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>Clover supports <a href="/clover-vuepress/en/blocks.html" class="">blocks-based programming</a> as well.</p></div><h2 id="additional-periphery" tabindex="-1"><a class="header-anchor" href="#additional-periphery" aria-hidden="true">#</a> Additional periphery</h2><p>The Clover platform also exposes APIs for interacting with other peripherals. Read more in the following articles:</p><ul><li><a href="/clover-vuepress/en/leds.html" class="">LED strip</a>;</li><li><a href="/clover-vuepress/en/laser.html" class="">laser rangefinder</a>;</li><li><a href="/clover-vuepress/en/gpio.html" class="">GPIO</a>;</li><li><a href="/clover-vuepress/en/sonar.html" class="">ultrasonic rangefinder</a>;</li><li><a href="/clover-vuepress/en/camera.html" class="">camera</a>.</li></ul><!--]--></div><footer class="page-meta"><div class="meta-item edit-link"><a class="external-link meta-item-label" href="https://github.com/CopterExpress/clover/edit/master/docs/en/programming.md" rel="noopener noreferrer" target="_blank" aria-label="Edit this page"><!--[--><!--]--> Edit this page <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!----><!----></footer><nav class="page-nav"><p class="inner"><!----><span class="next"><a href="/clover-vuepress/en/camera_setup.html" class="" aria-label="Camera setup"><!--[--><!--]--> Camera setup <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
<script type="module" src="/clover-vuepress/assets/app.4f6a4bec.js" defer></script>
</body>
</html>