From e33326171a9fd32de37b6be2147b6fa75283feae Mon Sep 17 00:00:00 2001 From: Konstantin Eliseev <1deaglea@gmail.com> Date: Mon, 18 Feb 2019 08:21:02 +0300 Subject: [PATCH] 10 new EN Articles (#105) --- docs/en/3g.md | 6 + docs/en/SUMMARY.md | 10 ++ docs/en/arduino.md | 229 ++++++++++++++++++++++++++++++++++++++ docs/en/autolaunch.md | 59 ++++++++++ docs/en/contributing.md | 45 ++++++++ docs/en/copterhack2017.md | 65 +++++++++++ docs/en/copterhack2018.md | 37 ++++++ docs/en/esc_firmware.md | 77 +++++++++++++ docs/en/mavlink.md | 179 +++++++++++++++++++++++++++++ docs/en/shield.md | 93 ++++++++++++++++ docs/en/sitl.md | 75 +++++++++++++ 11 files changed, 875 insertions(+) create mode 100644 docs/en/3g.md create mode 100644 docs/en/arduino.md create mode 100644 docs/en/autolaunch.md create mode 100644 docs/en/contributing.md create mode 100644 docs/en/copterhack2017.md create mode 100644 docs/en/copterhack2018.md create mode 100644 docs/en/esc_firmware.md create mode 100644 docs/en/mavlink.md create mode 100644 docs/en/shield.md create mode 100644 docs/en/sitl.md diff --git a/docs/en/3g.md b/docs/en/3g.md new file mode 100644 index 00000000..0da112ef --- /dev/null +++ b/docs/en/3g.md @@ -0,0 +1,6 @@ +Using an external 3G modem +=== + +To use an external 3G modem on Raspberry, you can use the [`sakis3g`] package (https://github.com/Trixarian/sakis3g-source). + +TODO diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md index 46b152df..dc38c976 100644 --- a/docs/en/SUMMARY.md +++ b/docs/en/SUMMARY.md @@ -38,3 +38,13 @@ * [Working with a LED strip on Raspberry 3](leds.md) * [Using rviz and rqt](rviz.md) * [Working with the ultrasonic distance gage](sonar.md) +* [PX4 Simulation](sitl.md) +* [Software autorun](autolaunch.md) +* [Controlling the copter from Arduino](arduino.md) +* [Using an external 3G modem](3g.md) +* [Copter spheric guard](shield.md) +* [Copter Hack 2018](copterhack2018.md) +* [Copter Hack 2017](copterhack2017.md) +* [Contribution to Clever](contributing.md) +* [Flashing ESCs using BLHeliSuite](esc_firmware.md) +* [MAVLink](mavlink.md) diff --git a/docs/en/arduino.md b/docs/en/arduino.md new file mode 100644 index 00000000..fb5d13a0 --- /dev/null +++ b/docs/en/arduino.md @@ -0,0 +1,229 @@ +# Controlling the copter from Arduino + +For interaction with ROS topics and services on a Raspberry Pi, you can use the [rosserial_arduino](http://wiki.ros.org/rosserial_arduino) library. This library is pre-installed on [a Raspberry Pi image](microsd_images.md). + +The main tutorial for rosserial: http://wiki.ros.org/rosserial_arduino/Tutorials + +Arudino is to be installed on Clever and connected via a USB port. + +## Configuring Arduino IDE + +To work with ROS and Arduino, you should understand the format of installed packages' messages. For this purpose [on Raspberry Pi](ssh.md), build the ROS messages library: + +```(bash) +rosrun rosserial_arduino make_libraries.py. +``` + +The obtained folder `ros_lib` is to be copied to `/libraries` on a computer with Arudino IDE. + +## Configuring Raspberry Pi + +To run the program on Arduino once, you can use command: + +```(bash) +roslaunch clever arduino.launch +``` + +To start the link with Arduino at the startup automatically, set argument `arudino` in the Clever launch file (`~/catkin_ws/src/clever/clever/launch/clever.launch`): + +```xml + +``` + +After the launch file is edited, restart package `clever`: + +```(bash) +sudo systemctl restart clever +``` + +## Delays + +When `rosserial_arduino` is used, the Arduino microcontroller should not be blocked for more than a few seconds (for example, using the `delay` function); otherwise communication between Raspberry Pi and Arduino will be broken. + +During implementation of long `while` cycles, ensure periodic calling the `hn.spinOnce` function: + +```cpp +while(/* condition */) { + // ... Perform required actions + nh.spinOnce(); +} +``` + +To organize long delays, use the delays in a loop with periodic calling of the `hn.spinOnce()` function: + +```cpp +// 8 second delay +for(int i=0; i<8; i++) { + delay(1000); + nh.spinOnce(); +} +``` + +## Working with Clever + +The set of services and topics is similar to the regular set in [simple_offboard](simple_offboard.md) and [mavros](mavros.md). + +An example of a program that controls the copter by position using the `navigate` and `set_mode` services: + +```cpp +// Connecting libraries for working with rosseral +#include + +// Connecting Clever and MAVROS package message header files +#include +#include + +using namespace clever; +using namespace mavros_msgs; + +ros::NodeHandle nh; + +// Declaring services +ros::ServiceClient navigate("/navigate"); +ros::ServiceClient setMode("/mavros/set_mode"); + +void setup() +{ + // Initializing rosserial + nh.initNode(); + + // Initializing services + nh.serviceClient(navigate); + nh.serviceClient(setMode); + + // Waiting for connection to Raspberry Pi + while(!nh.connected()) nh.spinOnce(); + nh.loginfo("Startup complete"); + + // Custom settings + // <...> + + // Test program + Navigate::Request nav_req; + Navigate::Response nav_res; + SetMode::Request sm_req; + SetMode::Response sm_res; + + // Ascending to 2 meters: + nh.loginfo("Take off"); + nav_req.auto_arm = false; + nav_req.x = 0; + nav_req.y = 0; + nav_req.z = 2; + nav_req.frame_id = "body"; + nav_req.speed = 0.5; + navigate.call(nav_req, nav_res); + + // Waiting for 5 seconds + for(int i=0; i<5; i++) { + delay(1000); + nh.spinOnce(); + } + + nav_req.auto_arm = false; + + // Flying forward 3 meters: + nh.loginfo("Fly forward"); + nav_req.auto_arm = true; + nav_req.x = 3; + nav_req.y = 0; + nav_req.z = 0; + nav_req.frame_id = "body"; + nav_req.speed = 0.8; + navigate.call(nav_req, nav_res); + + // Waiting for 5 seconds + for(int i=0; i<5; i++) { + delay(1000); + nh.spinOnce(); + } + + // Flying to point 1:0:2 in the marker field + nh.loginfo("Fly on point"); + nav_req.auto_arm = false; + nav_req.x = 1; + nav_req.y = 0; + nav_req.z = 2; + nav_req.frame_id = "aruco_map"; + nav_req.speed = 0.8; + navigate.call(nav_req, nav_res); + + // Waiting for 5 seconds + for(int i=0; i<5; i++) { + delay(1000); + nh.spinOnce(); + } + + // Landing + nh.loginfo("Land"); + sm_req.custom_mode = "AUTO.LAND"; + setMode.call(sm_req, sm_res); +} + +void loop() +{ +} +``` + +## Getting telemetry + +With Arduino, you can use the [`get_telemetry` service](simple_offboard.md). To do so, declare it similar to the `navigate` and `set_mode` services: + +```cpp +#include + +// ... + +#include + +// ... + +ros::ServiceClient getTelemetry("/get_telemetry"); + +// ... + +nh.serviceClient(getTelemetry); + +// ... + +GetTelemetry::Request gt_req; +GetTelemetry::Response gt_res; + + +// ... + +gt_req.frame_id = "aruco_map"; // frame id for x, y, z +getTelemetry.call(gt_req, gt_res); + +// gt_res.x is copter position on the x axis +// gt_res.y is copter position on the y axis +// gt_res.z is copter position on the z axis +``` + +## Problem + +When using Arudino Nano, RAM may be insufficient. In this case, messages will appear in the Aruino IDE like: + +``` +Global variables use 1837 bytes (89%) of the dynamic memory, leaving 211 bytes for local variables. The maximum is 2048 bytes. +Not enough memory, the program may be unstable. +``` + +You can reduce RAM usage by reducing the size of the buffers allocated for sending and receiving messages. To do this, place the following line **at the beginning** the program: + +```cpp +#define __AVR_ATmega168__ 1 +``` + +You can reduce the amount of used memory even more, if you manually configure the number publishers and subscribers, as well as the size of memory buffers allocated for messages, for example: + +```cpp +#include + +// ... + +typedef ros::NodeHandle_ NodeHandle; + +// ... +NodeHandle nh; +``` diff --git a/docs/en/autolaunch.md b/docs/en/autolaunch.md new file mode 100644 index 00000000..847b6413 --- /dev/null +++ b/docs/en/autolaunch.md @@ -0,0 +1,59 @@ +Software autorun +=== + +systemd +--- + +Main documentation: [https://wiki.archlinux.org/index.php/Systemd_(Russian)](https://wiki.archlinux.org/index.php/Systemd_(Russian)). + +All automatically started Clever software is launched as a `clever.service` systemd service. + +The service may be restarted by the `systemctl` command: + +```(bash) +sudo systemctl restart clever +``` + +Text output of the software can be viewed using the `journalctl` command: + +```(bash) +journalctl -u clever +``` + +To run Clever software directly in the current console session, you can use the `roslaunch` command: + +```(bash) +sudo systemctl restart clever +roslaunch clever clever.launch +``` + +You can disable Clever software autolaunch using the `disable` command: + +```(bash) +sudo systemctl disable clever +``` + +roslaunch +--- + +Main documentation: http://wiki.ros.org/roslaunch. + +The list of nodes / programs declared for running is specified in file `/home/pi/catkin_ws/src/clever/clever/launch/clever.launch`. + +You can add your own node to the list of automatically launched ones. To do this, place your executable file (e.g. `my_program.py`) into folder `/home/pi/catkin_ws/src/clever/clever/src`. Then add the start of your node to `clever.launch`, for example: + +```xml + +``` + +The started file must have *permission* to run: + +```(bash) +chmod +x my_program.py +``` + +When scripting languages are used, [shebang] should be placed at the beginning of the file (https://ru.wikipedia.org/wiki/Shebang_(Unix)), for example: + +```(bash) +#!/usr/bin/env python +``` \ No newline at end of file diff --git a/docs/en/contributing.md b/docs/en/contributing.md new file mode 100644 index 00000000..d88c0766 --- /dev/null +++ b/docs/en/contributing.md @@ -0,0 +1,45 @@ +# Contribution to Clever + +Clever is mostly an [open source](https://en.wikipedia.org/wiki/Open-source_software) and [open hardware](https://en.wikipedia.org/wiki/Open-source_hardware) project aimed at lowering the entry threshold to development of the projects related to flying robotics. You can contribute to the project by offering fixes and improvements for Clever documentation and software. + +> **Note** To offer changes to Clever documentation or SW, you should have an account at [GitHub](https://github.com). + +## Markdown + +All Clever documentation is written in the widespread [Markdown](https://ru.wikipedia.org/wiki/Markdown) format. There are many guides on it on the Internet. + +In Russian: https://guides.hexlet.io/markdown/. + +In English: https://www.markdownguide.org/getting-started, https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet. + +For the ease of editing texts, you may use text editors with markdown support [Typora](https://typora.io), [Dillinger](https://dillinger.io/) (web), [VSCode](https://code.visualstudio.com) with the [Markdown Editor plugin](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MarkdownEditor). + +For a local build of a static documentation website, use the [`gitbook-cli`](https://github.com/GitbookIO/gitbook-cli) utility. + +## Correcting errors in the documents + +If you have found an error in the documents, or if you want to improve it, use the Pull Request mechanism. + +1. Find a file with the article you want in the repository – https://github.com/CopterExpress/clever/tree/master/docs. +2. Click "Edit". + + GitHub Edit + +3. Make the necessary changes. +4. Click "Propose file change". +5. Describe the change you have made, and click "Create a Pull Request". +6. Wait for your changes to be approved :) + +More information about Pull Requests is available [at GitHub](https://help.github.com/articles/about-pull-requests/) (English) or in [GIT documentation](https://git-scm.com/book/ru/v2/GitHub-contributing-to_projects) (Russian). + + + +## Your project with Clever + +If you have implemented your own interesting project using clever, you can add an article about it in section "Clever-based projects". + + diff --git a/docs/en/copterhack2017.md b/docs/en/copterhack2017.md new file mode 100644 index 00000000..d139a2ca --- /dev/null +++ b/docs/en/copterhack2017.md @@ -0,0 +1,65 @@ +Copter Hack 2017 +=== + +On July 28 – 30, 2017, Copter Express held a hackathon named "Copter Hack 2017", where the objective was to program a Clever to dance-fly autonomously to random music. + +The team "Pangolins" became the winners. + + + +Video lectures are available at https://copterexpress.timepad.ru/event/510375/. + +Modules +--- + +* Navigation in the marker field and simplified copter control: https://github.com/CopterExpress/marker_navigator (installed on the flash drive) + +* ROS module for communication with the music server https://github.com/CopterExpress/copter_hack_music (installed on a flash drive) + +* the source of the music server https://github.com/CopterExpress/copter_hack_music_server + +Viewing video from the camera +--- + +To run on Raspberry: + +```(bash) +rosrun web_video_server web_video_server +``` + +In the browser, open webpage ``http://:8080``. + +**Attention**: Video stream distribution greatly reduces the performance of marker recognition for the flight. + +SSID Wi-Fi +--- + +To change the SSID of distributed Wi-Fi you should change the SSID parameter in any way in file``/etc/hostapd/hostapd.conf``. + +The list of recognized markers +--- + +```(bash) +rostopic echo /marker_data +``` + +Helpful articles +--- + +* [Copter setup](setup.md) + +* [Flight modes](modes.md) + +* [MAVRos package](mavros.md) + +* A good introductory article: https://habrahabr.ru/post/227425/ + +* Signals used in drones: https://geektimes.ru/post/258186/ + +* A good article about PIDs: https://habrahabr.ru/company/technoworks/blog/216437/ + +* Video lectures are available at https://copterexpress.timepad.ru/event/510375/. + +* [Aubio](https://aubio.org), a library for sound (music) analysis + +* Packages for Python for working with music: https://wiki.python.org/moin/PythonInMusic diff --git a/docs/en/copterhack2018.md b/docs/en/copterhack2018.md new file mode 100644 index 00000000..7788ab2e --- /dev/null +++ b/docs/en/copterhack2018.md @@ -0,0 +1,37 @@ +# Copter Hack 2018 + +Hackathon [Copter Hack 2018](https://copterexpress.timepad.ru/event/768108/) was held on October 19 – 21 at the Moscow Technopolis. + + + +Hackathon chat: https://t.me/CopterHack. + +Hackathon stream: https://www.youtube.com/watch?v=nIo5HSqlt6I. + +Hackathon photos: https://drive.google.com/open?id=1ozdXol4rhKwhHbsrnfxrp3CqazBRm-3W. + +## Videos + + + +## Lectures + +Lecture 1: assembly — https://www.youtube.com/watch?v=gEs-w7BRPM8. + +Lecture 2: setup — https://www.youtube.com/watch?v=sPqSCCmgdG0. + +Lecture 3: PX4 firmware — https://www.youtube.com/watch?v=WFnZAIypgMQ. + +Lecture 4: Autonomous flights — https://www.youtube.com/watch?v=gD6a7aSEf9M. + +## Results + +Winning teams: + +1. Starshine (Moscow) — controlling the drone using a "smart" glove. +2. Alcopter (Moscow) — controlling the drone with gestures and pose change. +3. Merry copter (Samara) — a Vkontakte bot for controlling the copter, a joint flight of "Zhuzha" and "Clever 3". +4. International Post (Novosibirsk) — automatic scattering leaflets from the drone. +5. LAMAR (Yekaterinburg) — an automatic quadcopter battery replacement station. + + \ No newline at end of file diff --git a/docs/en/esc_firmware.md b/docs/en/esc_firmware.md new file mode 100644 index 00000000..1178c917 --- /dev/null +++ b/docs/en/esc_firmware.md @@ -0,0 +1,77 @@ +# Flashing ESCs using BLHeliSuite + +A good article that explains the principle of ESCs \(Electric speed controller\) operation: [http://www.avmodels.ru/engines/electric/esc.html](http://www.avmodels.ru/engines/electric/esc.html) + +## Why reflash? + +Sometimes, it is necessary to change one of ESC parameters, such as the direction of motor rotation, the minimum and the maximum duty cycle of the PPM signal at ESC input, the volume of audio signals emitted by the motor, or the time after which the ESC should start reminding that it is engaged. + +## An application for flashing ESCs + +For flashing various ESC, the [BLHeliSuite](https://github.com/4712/BLHeliSuite) application is used \(for Windows\). + +To start the \(BLHeliSuite.exe\) application, unpack archives BLHeliAtmelHEX.zip and BLHeliSilabsHEX.zip into the folder with the application. + +## A programming unit for flashing ESCs + +To flash an ESC, you need a programming unit that can handle an ESC controller via the 1-wire protocol. One of the ways of obtaining the programming unit - is flashing special firmware to an Arduino device. BLHeliSuite contains a tool for creating interfaces for programming units. + +Creating a programming unit on the example of Arduino Mega. + +1. Start BLHeliSuite and select the Make interfaces tab. + + ![](../assets/BLHeliSuite_SiLabs_ESC_Setup_2.png) + +2. Connect the Arduino to a computer, if necessary, check the number of the COM port to which the circuit board is connected, in the Device Manager. + +3. Click on Arduino 4way-interface in tab Make Arduino Interface Boards, and select the firmware file. After the file is selected, the flashing of the controller will start. + + ![](../assets/BLHeliSuite_Make_Interfaces.png) + ![](../assets/BLHeliSuite_Interface_Options.png) + ![](../assets/BLHeliSuite_Arduino_Select_Firmware.png) + +4. After flashing the Arduino, return to tap Silabs ESC Setup and connect to Arduino, having selected the 4way-if interface of the programming device and the Arduino COM port. + + ![](../assets/BLHeliSuite_4way-if_Select.png) + ![](../assets/BLHeliSuite_ESC_Setup_Connect.png) + +## Connecting ESCs to Arduino + +For flashing or readjusting ESCs, connect signal ports (usually white) of ESCs to Arduino ports, after checking in the manual (see the figure below), which ports are used for connecting to ESCs. You should also connect GND of Arduino with the ground of one of the ESCs (usually black). The ESCs should be connected to power, and, if electric motors are connected to ESCs, **they should not have propellers**. + +![](../assets/BLHeliSuite_Arduino_Pinout_For_4way-if.png) + +In the case of Arduino Mega, signal ports of the ECSs are connected to ports D43-D49 and D51. + +## Changing ESC settings + +To download information about firmware version and ESC settings, click on Check. + +![](../assets/BLHeliSuite_ESC_Setup_Check.png) +![](../assets/BLHeliSuite_SiLabs_ESC_Setup_1.png) + +The main parameters that we are interested in are: + +* Motor Direction \(Normal or Reversed\) - sets motor rotation direction. Convenient, if you do not wish to reconnect an incorrectly connected motor. +* PPM Min and Max Throttle - sets the minimum and the maximum throttle signal +* Startup Beep Volume - set the signal volume on startup. In firmware16.65, an ability to change the startup melody has been added. More information is available [here] (https://github.com/cleanflight/blheli-multishot/releases). For example, you can set the Imperial March from the Star Wars or the main theme from the Game of the Thrones as the startup melody +* Beacon Volume - sets the volume of the detecting signal. When the motors have not been rotating for some time, and the ESC is not used, it starts reminding about itself by motor squeaks. +* Beacon Delay - sets the duration of inactivity, after which the detecting signal is enabled. During development, it may become boring, therefore it may be set to infinity. + +The leftmost motor in the list of motors \(Multiple ESC\) is considered the \(master\) motor. by clicking on motor numbers, you can enable or disable the possibility of writing their settings. After changing the necessary parameters, you can write settings to respective motors by clicking on Write Setup. + +![](../assets/BLHeliSuite_ESC_Setup_Write_Setup.png) + +To display the settings of all ESCs simultaneously, you can use the ESC Overview tab. + +## Flashing ESCs + +ESC firmware files are located [here](https://github.com/cleanflight/blheli-multishot/tree/master/BLHeli_S%20SiLabs/Hex%20Files). + +To flesh ESCs, click on button Flash BLHeli and choose the firmware file with the type of the controller, the name of which is indicated in the firmware name frame on top of the screen in tab Silabs ESC Setup (for the controller that is used in Clever 2, it is A-H-70). + +To re-flash an individual ESC, disable all other ESCs. + +## Video guide to flashing ESCs + +For a better understanding of the things written in the article, we recommend watching a video guide about connecting electronics and flashing ESCs in English on [youtube](https://www.youtube.com/watch?v=i6lhMcQLRSU&feature=youtu.be). diff --git a/docs/en/mavlink.md b/docs/en/mavlink.md new file mode 100644 index 00000000..107c0884 --- /dev/null +++ b/docs/en/mavlink.md @@ -0,0 +1,179 @@ +# MAVLink + +Basic documentation: https://mavlink.io/en/. + +MAVLink is a communication protocol between autonomous aircraft and vehicle systems (drones, planes, vehicles). The MAVLink protocol lies at the base of interaction between Pixhawk and Raspberry Pi. + +Clever contains two wrappers for this protocol: [MAVROS](mavros.md) and [simple_offboard](simple_offboard.md). + +The code for sending an arbitrary MAVLink message may be found in [the examples](snippets.md#mavlink). + +## The main concerts + +### Communication channel + +The MAVLink protocol may be used on top of the following communication channels: + +* connection in series (UART, USB, etc.); +* UDP (Wi-Fi, Ethernet, 3G, LTE); +* TCP (Wi-Fi, Ethernet, 3G, LTE). + +### Message + +A MAVLink message is an individual "portion" of data transmitted between devices. An individual MAVLink message contains information about the state of the drone (or another device) or a command for the drone. + +Examples of MAVLink messages: + +* `ATTITUDE`, `ATTITUDE_QUATERNION` – the quadcopter orientation in the space; +* `LOCAL_POSITION_NED` – local position of the quadcopter; +* `GLOBAL_POSITION_INT` – global position of the quadcopter (latitude/longitude/altitude); +* `COMMAND_LONG` – a command to the quadcopter (take off, land, toggle modes, etc). + +A complete list of MAVLink messages is available in [MAVLink documentation] (http://mavlink.org/messages/common). + +### System, system component + +Each device (a drone, a base station, etc.) has an ID in the MAVLink network. In PX4 MAVLink, ID is changed using parameter `MAV_SYS_ID`. Each MAVLink message contains a field with the ID of the originating system. Besides, some messages (for example, `COMMAND_LONG`) also contain the ID of the target system. + +In addition to IDs of the systems, the messages may contain IDs of the originating component and the target component. Examples of the system components: a flight controller, an external camera, a controlling onboard computer (Raspberry Pi in case of Clever), etc. + +### An example of a package + +An example of a MAVLink package structure with message `COMMAND_LONG`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldLengthNameComment
Header
magic1 byteStart tag0xFD for MAVLink 2.0
len1 byteData size
incompat_flags1 byteReversely incompatible flagsCurrently unused
compat_flags1 byteReversely compatible flagsCurrently unused
seq1 byteMessage sequence number
sysid1 byteOriginating system ID
compid1 byteOriginating component ID
msgid3 bytesMessage ID
Data (example)
target_system1 byteTarget system ID
target_component1 byteTarget component ID
command2 bytesCommand ID
confirmation1 byteNumber for confirmation
param14 bytesParameter 1A single-precision floating point number
param24 bytesParameter 2
param34 bytesParameter 3
param44 bytesParameter 4
param54 bytesParameter 5
param64 bytesParameter 6
param74 bytesParameter 7
checksum2 bytesChecksum
signature13 bytesSignature (optional)Allows checking that the package has not been compromised. +Usually unused.
+ +Yellow is used for highlighting the data fields(payload). An individual set of such fields exists for every message type. \ No newline at end of file diff --git a/docs/en/shield.md b/docs/en/shield.md new file mode 100644 index 00000000..93ea1075 --- /dev/null +++ b/docs/en/shield.md @@ -0,0 +1,93 @@ +# Copter spheric guard + +## Introduction + +Probably, everyone who has held a copter has had to fly it indoors. Such flights are associated with considerable risk of damaging the copter upon hitting walls and various items. Flying even in a relatively large space is associated with the risk of hitting an obstacle: there might be a tree or a building in the path of the copter, to say nothing about flying in confined spaces. Such "crash tests" are not very pleasant, and in the best case may cause losing a considerable sum on repairs, and in the worst case — in losing the copter. Such situations are even more unpleasant for a beginner who cannot avoid an obstacle and is just learning to fly. + +All this made us search for a solution. Unfortunately, searching the Internet did not provide a sufficiently simple and, more importantly, cheap solution for ordinary users. For example, propeller guard protects the propellers themselves quite well, but upon the slightest touch upon an obstacle the copter would flip over and fall down. In general, guard either did not protect the copter fully or looked awkward and was too scarcely available. + +![safetyball](../assets/safetyball.png) + +We made a difficult decision: we had to make it entirely ourselves and almost from scratch, and the goal was to make it lightweight and easy to manufacture. + +## Development + +As a result of searching for a solution that would fit all our requirements, we ended with several similar options. It was decided to make the guard in the shape of a semiregular polyhedron (examples include fullerene, carbon, or a pentakis dodecahedron) — it was chosen as the most pleasing to the eye. In addition, such a guard is easily scalable to the desired size. + +In creating such a shape, two types of edges (beams) are used: short and long ones, their length is calculated based on the desired diameter of a polyhedron inscribed into a sphere. For better understanding, I will insert all necessary formulas from Wikipedia below. + +![calculation](../assets/calculation.png) + +The corner joints (fittings) were not very easy either. They are of two types as well: with five faces on the vertex (five beams protrude from the vertex) and with six faces (six rays protrude from the vertex). + +## First models + +A specification has been prepared for the ease of monitoring the manufacturing process, and we started modeling. + +Making simple calculations for the required size, we built a model in Inventor CAD. + +In the progress of designing, we faced problems in modeling corner joints, but they were solved by simplifying the design, and the differences of the angles were compensated for by flexible materials. Thus, all joints fit slightly tightly. + +![table](../assets/table.png) + +![elements](../assets/elements.png) + +(Elements of guard fasteners to the body) + +![elements1](../assets/elements1.png) + +## Materials + +During the design process, the question arose about a lightweight and strong material to be used for the guard. The answer, as always, was unexpected. We saw bamboo sticks: they were thin enough to not affect the aerodynamics, had sufficient flexibility and were quite strong. Then, the question was about how to make fittings, and of what material. Surely, it should be 3D printing! A 3D printer is a generally indispensable thing, especially for those who like doing something themselves. In addition, due to their moderate price, they are widespread enough. Such a printer may be used to make items of almost any complexity. That is what we need! + +Convert ready models to .stl, put them into a slicer (Cura in our case), enter the setting for a particular printer and plastic, and start printing. + +To reduce the weight we chose ABC plastic, which is lightweight and available. + +![3dmodel](../assets/3dmodel.png) + +The sticks were cut to the calculated length and prepared for subsequent work. + +## Assembly and installation + +After everything has been printed and cut, it is time to assemble the guard. + +![detal](../assets/detal.png) + +Assembly is the most crucial moment, as it requires a special algorithm. + +From a five-beam fitting, only short beams protrude, while from a six-beam fitting — only every second long one. + +Assembly: + +1. First, assemble all five-beam vertices. +2. Put a six-beam vertice on every beam protruding from a five-beam vertice. +3. Interconnect the six-beam fittings with long sticks. +4. Connect assembled five-beam vertices to the six-beam vertices, bearing in mind that in a six-beam fitting, short and long beams alternate. +5. Repeat the process for each beam vertice, until the ball is assembled. + +After assembly, divide the ball into 2 hemispheres and install the mounts on the copter making sure that everything fits. + +![detal1](../assets/detal1.png) + +![detal2](../assets/detal2.png) + +(An example of fasteners installation) + +Now, the hemispheres may be glued. The hemispheres are not to be glued to each other, as this is required for installing the copter inside. We used the Dichloroethane solvent for plastics as the glue, but you can use any quick-drying adhesive polymer with the same success. + +After drying, the guard is ready for installation and for the first test flight! + +![finalball](../assets/finalball.png) + +(without fasteners yet) + +![ball](../assets/ball.png) + +## First flights + +We have made a guard for the Clever 2 copter, which is a learning aid for quadcopters assembly and setup and is installed on it without modification. The guard weighs 70g more (139 grams) than the standard one, and almost does not affect controllability and flying time. + +It should also be said that excessive vibrations, if any, may be removed by more rigid attachment to the copter. + +Eventually, we've got an unusual guard for the copter that is lightweight and has an interesting design and opens new horizons for flying in the locations where flying copters was dangerous before. diff --git a/docs/en/sitl.md b/docs/en/sitl.md new file mode 100644 index 00000000..7fa47439 --- /dev/null +++ b/docs/en/sitl.md @@ -0,0 +1,75 @@ +PX4 Simulation +=== + +Main article: https://dev.px4.io/en/simulation/ + +PX4 simulation is possible in Linux and macOS with the use of physical environment simulation systems [jMavSim](https://pixhawk.org/dev/hil/jmavsim) and [the Gazebo](http://gazebosim.org). + +jMavSim is a lightweight environment intended only for testing multi-rotor aircraft systems; Gazebo is a versatile environment for all types of robots. + +Launching PX4 SITL +-- + +1. Clone repository from PX4. + +```(bash) +git clone https://github.com/PX4/Firmware.git +cd Firmware +``` + +jMavSim +-- + +Main article: https://dev.px4.io/en/simulation/jmavsim.html + +For simulation using the jMavSim lightweight environment, use the following command: + +```(bash) +make posix_sitl_default jmavsim +``` + +To use the LPE position calculation module instead of EKF2, use: + +```(bash) +make posix_sitl_lpe jmavsim +``` + +Gazebo +-- + +Main article: https://dev.px4.io/en/simulation/gazebo.html + +To get started, install Gazebo 7. On a Mac: + +```(bash) +brew install gazebo7 +``` + +On Linux (Debian): + +```(bash) +sudo apt-get install gazebo7 libgazebo7-dev +``` + +Start simulation from the Firmware folder: + +```(bash) +make posix_sitl_default gazebo +``` + +You can run a simulation in headless mode (without a window client). To do this, use the following command: + +```(bash) +HEADLESS=1 make posix_sitl_default gazebo +``` + +Connection +--- + +QGroundControl will automatically connect to the running simulation on startup. The operation will be the same as, as in the case of a real flight controller. + +To connect MAVROS to the simulation, use the UDP Protocol, a local IP address, and port 14557, for example: + +```(bash) +roslaunch mavros px4.launch fcu_url:=udp://@127.0.0.1:14557 +```