mirror of
https://github.com/okalachev/flix.git
synced 2026-06-28 05:56:44 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04122bcd3f | |||
| 1f2f623f6a | |||
| cdfba72a0b | |||
| 18e81720e0 | |||
| 91173d06c9 | |||
| fdcc9533b3 |
@@ -76,6 +76,11 @@ jobs:
|
|||||||
run: sudo apt-get install -y libsdl2-dev
|
run: sudo apt-get install -y libsdl2-dev
|
||||||
- name: Build simulator
|
- name: Build simulator
|
||||||
run: make build_simulator
|
run: make build_simulator
|
||||||
|
- name: Run simulator
|
||||||
|
env:
|
||||||
|
GAZEBO_MODEL_PATH: ${{ github.workspace }}/gazebo/models
|
||||||
|
GAZEBO_PLUGIN_PATH: ${{ github.workspace }}/gazebo/build
|
||||||
|
run: timeout --preserve-status 120 gzserver --verbose gazebo/flix.world || [ $? -eq 143 ]
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: gazebo-plugin-binary
|
name: gazebo-plugin-binary
|
||||||
|
|||||||
@@ -47,6 +47,14 @@ See the [user builds gallery](docs/user.md):
|
|||||||
|
|
||||||
<a href="docs/user.md"><img src="docs/img/user/user.jpg" width=500></a>
|
<a href="docs/user.md"><img src="docs/img/user/user.jpg" width=500></a>
|
||||||
|
|
||||||
|
### PCB
|
||||||
|
|
||||||
|
The official PCB *(Flix2)* is in development now. Follow the [project's channel](https://t.me/opensourcequadcopter) to track the progress.
|
||||||
|
|
||||||
|
Outdoor flights demo video of the current prototype:
|
||||||
|
|
||||||
|
<a href="https://youtu.be/KXlNmvUTi4g"><img width=300 src="https://i3.ytimg.com/vi/KXlNmvUTi4g/maxresdefault.jpg"></a>
|
||||||
|
|
||||||
## Simulation
|
## Simulation
|
||||||
|
|
||||||
The simulator is implemented using Gazebo and runs the original Arduino code:
|
The simulator is implemented using Gazebo and runs the original Arduino code:
|
||||||
@@ -73,7 +81,7 @@ Additional articles:
|
|||||||
|-|-|:-:|:-:|
|
|-|-|:-:|:-:|
|
||||||
|Microcontroller board|ESP32 Mini.<br>ESP32-S3/ESP32-C3 boards are also supported.|<img src="docs/img/esp32.jpg" width=100>|1|
|
|Microcontroller board|ESP32 Mini.<br>ESP32-S3/ESP32-C3 boards are also supported.|<img src="docs/img/esp32.jpg" width=100>|1|
|
||||||
|IMU (and barometer¹) board|GY‑91, MPU-9265 (or other MPU‑9250/MPU‑6500 board)<br>ICM20948V2 (ICM‑20948)<br>GY-521 (MPU-6050)|<img src="docs/img/gy-91.jpg" width=90 align=center><br><img src="docs/img/icm-20948.jpg" width=100><br><img src="docs/img/gy-521.jpg" width=100>|1|
|
|IMU (and barometer¹) board|GY‑91, MPU-9265 (or other MPU‑9250/MPU‑6500 board)<br>ICM20948V2 (ICM‑20948)<br>GY-521 (MPU-6050)|<img src="docs/img/gy-91.jpg" width=90 align=center><br><img src="docs/img/icm-20948.jpg" width=100><br><img src="docs/img/gy-521.jpg" width=100>|1|
|
||||||
|Boost converter (optional, for more stable power supply)|5V output|<img src="docs/img/buck-boost.jpg" width=100>|1|
|
|*Boost converter (optional, for more stable power supply)*|*5V output*|<img src="docs/img/buck-boost.jpg" width=100>|1|
|
||||||
|Motor|8520 3.7V brushed motor.<br>Motor with exact 3.7V voltage is needed, not ranged working voltage (3.7V — 6V).<br>Make sure the motor shaft diameter and propeller hole diameter match!|<img src="docs/img/motor.jpeg" width=100>|4|
|
|Motor|8520 3.7V brushed motor.<br>Motor with exact 3.7V voltage is needed, not ranged working voltage (3.7V — 6V).<br>Make sure the motor shaft diameter and propeller hole diameter match!|<img src="docs/img/motor.jpeg" width=100>|4|
|
||||||
|Propeller|55 mm or 65 mm|<img src="docs/img/prop.jpg" width=100>|4|
|
|Propeller|55 mm or 65 mm|<img src="docs/img/prop.jpg" width=100>|4|
|
||||||
|MOSFET (transistor)|100N03A or [analog](https://t.me/opensourcequadcopter/33)|<img src="docs/img/100n03a.jpg" width=100>|4|
|
|MOSFET (transistor)|100N03A or [analog](https://t.me/opensourcequadcopter/33)|<img src="docs/img/100n03a.jpg" width=100>|4|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Do the following:
|
Do the following:
|
||||||
|
|
||||||
* **Check ESP32 core is installed**. Check if the version matches the one used in the [tutorial](usage.md#building-the-firmware).
|
* **Check ESP32 core is installed**. Check if the version matches the one used in the [tutorial](usage.md#building-the-firmware).
|
||||||
* **Check libraries**. Install all the required libraries from the tutorial. Make sure there are no MPU9250 or other peripherals libraries that may conflict with the ones used in the tutorial.
|
* **Check libraries**. Install all the required libraries from the tutorial. Make sure there are no MPU-9250 or other peripherals libraries that may conflict with the ones used in the tutorial.
|
||||||
* **Check the chosen board**. The correct board to choose in Arduino IDE for ESP32 Mini is *WEMOS D1 MINI ESP32*.
|
* **Check the chosen board**. The correct board to choose in Arduino IDE for ESP32 Mini is *WEMOS D1 MINI ESP32*.
|
||||||
|
|
||||||
## The drone doesn't fly
|
## The drone doesn't fly
|
||||||
|
|||||||
+1
-1
@@ -329,7 +329,7 @@ To setup ESP-NOW communication:
|
|||||||
espnow 7a:c8:e3:eb:bf:e9 &PiuSysxP9+$L&5E
|
espnow 7a:c8:e3:eb:bf:e9 &PiuSysxP9+$L&5E
|
||||||
```
|
```
|
||||||
|
|
||||||
Run this line as a console command on each drone you want to bind to this proxy board.
|
Run this line as a console command on each drone you want to bind to this proxy board. [The maximum number](https://github.com/espressif/esp-idf/blob/e95cab4be8fd293e3f3323181e7a2280874da6f7/components/esp_wifi/include/esp_now.h#L32-L33) of simultaneously connected drones is 20 (unencrypted) io 6 (encrypted).
|
||||||
|
|
||||||
3. Set the `WIFI_MODE` parameter to `3` on the drone:
|
3. Set the `WIFI_MODE` parameter to `3` on the drone:
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -41,7 +41,7 @@ void sendMavlink() {
|
|||||||
MAV_VTOL_STATE_UNDEFINED, landed ? MAV_LANDED_STATE_ON_GROUND : MAV_LANDED_STATE_IN_AIR);
|
MAV_VTOL_STATE_UNDEFINED, landed ? MAV_LANDED_STATE_ON_GROUND : MAV_LANDED_STATE_IN_AIR);
|
||||||
sendMessage(&msg);
|
sendMessage(&msg);
|
||||||
|
|
||||||
uint16_t voltages[] = {voltage * 1000, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
|
uint16_t voltages[] = {(uint16_t)(voltage * 1000), UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
|
||||||
uint16_t voltagesExt[] = {0, 0, 0, 0};
|
uint16_t voltagesExt[] = {0, 0, 0, 0};
|
||||||
float remaining = constrain(mapf(voltage, 3.4, 4.2, 0, 1), 0, 1);
|
float remaining = constrain(mapf(voltage, 3.4, 4.2, 0, 1), 0, 1);
|
||||||
mavlink_msg_battery_status_pack(mavlinkSysId, MAV_COMP_ID_AUTOPILOT1, &msg, 0, MAV_BATTERY_FUNCTION_ALL,
|
mavlink_msg_battery_status_pack(mavlinkSysId, MAV_COMP_ID_AUTOPILOT1, &msg, 0, MAV_BATTERY_FUNCTION_ALL,
|
||||||
@@ -241,7 +241,7 @@ void handleMavlink(const void *_msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m.command == MAV_CMD_COMPONENT_ARM_DISARM) {
|
if (m.command == MAV_CMD_COMPONENT_ARM_DISARM) {
|
||||||
if (m.param1 && controlThrottle > 0.05) return; // don't arm if throttle is not low
|
if (m.param1 == 1 && controlThrottle > 0.05) return; // don't arm if throttle is not low
|
||||||
accepted = true;
|
accepted = true;
|
||||||
armed = m.param1 == 1;
|
armed = m.param1 == 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -14,10 +14,7 @@ int pwmStop = 0;
|
|||||||
int pwmMin = 0;
|
int pwmMin = 0;
|
||||||
int pwmMax = -1; // -1 means duty cycle mode
|
int pwmMax = -1; // -1 means duty cycle mode
|
||||||
|
|
||||||
const int MOTOR_REAR_LEFT = 0;
|
const int MOTOR_REAR_LEFT = 0, MOTOR_REAR_RIGHT = 1, MOTOR_FRONT_RIGHT = 2, MOTOR_FRONT_LEFT = 3;
|
||||||
const int MOTOR_REAR_RIGHT = 1;
|
|
||||||
const int MOTOR_FRONT_RIGHT = 2;
|
|
||||||
const int MOTOR_FRONT_LEFT = 3;
|
|
||||||
|
|
||||||
void setupMotors() {
|
void setupMotors() {
|
||||||
print("Setup Motors\n");
|
print("Setup Motors\n");
|
||||||
|
|||||||
+2
-4
@@ -6,13 +6,11 @@
|
|||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
extern int channelZero[16];
|
extern int channelZero[16], channelMax[16];
|
||||||
extern int channelMax[16];
|
|
||||||
extern int rollChannel, pitchChannel, throttleChannel, yawChannel, armedChannel, modeChannel;
|
extern int rollChannel, pitchChannel, throttleChannel, yawChannel, armedChannel, modeChannel;
|
||||||
extern int rcRxPin;
|
extern int rcRxPin, voltagePin;
|
||||||
extern int wifiMode, wifiLongRange, udpLocalPort, udpRemotePort, espnowChannel;
|
extern int wifiMode, wifiLongRange, udpLocalPort, udpRemotePort, espnowChannel;
|
||||||
extern float rcLossTimeout, descendTime;
|
extern float rcLossTimeout, descendTime;
|
||||||
extern int voltagePin;
|
|
||||||
extern float voltageScale;
|
extern float voltageScale;
|
||||||
extern LowPassFilter<float> voltageFilter;
|
extern LowPassFilter<float> voltageFilter;
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -8,7 +8,7 @@
|
|||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <MacAddress.h>
|
#include <MacAddress.h>
|
||||||
#include <ESP32_NOW_Serial.h>
|
#include <ESP32_NOW_Serial.h>
|
||||||
#include "Preferences.h"
|
#include <Preferences.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
extern Preferences storage; // use the main preferences storage
|
extern Preferences storage; // use the main preferences storage
|
||||||
@@ -33,10 +33,14 @@ void setupWiFi() {
|
|||||||
if (wifiMode == W_AP) {
|
if (wifiMode == W_AP) {
|
||||||
WiFi.softAP(storage.getString("WIFI_AP_SSID", "flix").c_str(), storage.getString("WIFI_AP_PASS", "flixwifi").c_str());
|
WiFi.softAP(storage.getString("WIFI_AP_SSID", "flix").c_str(), storage.getString("WIFI_AP_PASS", "flixwifi").c_str());
|
||||||
udp.begin(udpLocalPort);
|
udp.begin(udpLocalPort);
|
||||||
} else if (wifiMode == W_STA) {
|
}
|
||||||
|
|
||||||
|
if (wifiMode == W_STA) {
|
||||||
WiFi.begin(storage.getString("WIFI_STA_SSID", "").c_str(), storage.getString("WIFI_STA_PASS", "").c_str());
|
WiFi.begin(storage.getString("WIFI_STA_SSID", "").c_str(), storage.getString("WIFI_STA_PASS", "").c_str());
|
||||||
udp.begin(udpLocalPort);
|
udp.begin(udpLocalPort);
|
||||||
} else if (wifiMode == W_ESPNOW) {
|
}
|
||||||
|
|
||||||
|
if (wifiMode == W_ESPNOW) {
|
||||||
WiFi.mode(WIFI_AP);
|
WiFi.mode(WIFI_AP);
|
||||||
WiFi.setChannel(espnowChannel);
|
WiFi.setChannel(espnowChannel);
|
||||||
espnow.addr(MacAddress(storage.getString("ESPNOW_PEER_MAC", "FF:FF:FF:FF:FF:FF").c_str()));
|
espnow.addr(MacAddress(storage.getString("ESPNOW_PEER_MAC", "FF:FF:FF:FF:FF:FF").c_str()));
|
||||||
|
|||||||
+6
-1
@@ -11,7 +11,12 @@
|
|||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <gazebo/gazebo.hh>
|
#include <gazebo/gazebo.hh>
|
||||||
|
|
||||||
int wifiMode = 1; // mock
|
// Mocks
|
||||||
|
int wifiMode = 1;
|
||||||
|
int wifiLongRange = 0;
|
||||||
|
// int espnowChannel = 6;
|
||||||
|
const int W_DISABLED = 0, W_AP = 1, W_STA = 2, W_ESPNOW = 3;
|
||||||
|
|
||||||
int udpLocalPort = 14580;
|
int udpLocalPort = 14580;
|
||||||
int udpRemotePort = 14550;
|
int udpRemotePort = 14550;
|
||||||
const char *udpRemoteIP = "255.255.255.255";
|
const char *udpRemoteIP = "255.255.255.255";
|
||||||
|
|||||||
Reference in New Issue
Block a user