Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Headers cleanups

Oleg Kalacheva174d5cd7d12
diff --git a/flix/flix.ino b/flix/flix.ino
index 65d534b..ed7cdad 100644
--- a/flix/flix.ino
+++ b/flix/flix.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Main firmware file
+
#include "vector.h"
#include "quaternion.h"
diff --git a/flix/imu.ino b/flix/imu.ino
index 72e2672..6573215 100644
--- a/flix/imu.ino
+++ b/flix/imu.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Work with the IMU sensor
+
#include <SPI.h>
#include <MPU9250.h>
diff --git a/flix/led.ino b/flix/led.ino
index 4815a97..f8ab8b0 100644
--- a/flix/led.ino
+++ b/flix/led.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Main LED control
+
#define BLINK_PERIOD 500000
void setupLED()
diff --git a/flix/mavlink.ino b/flix/mavlink.ino
index 5418701..173c7b4 100644
--- a/flix/mavlink.ino
+++ b/flix/mavlink.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// MAVLink communication
+
#if WIFI_ENABLED == 1
#include "mavlink/common/mavlink.h"
diff --git a/flix/motors.ino b/flix/motors.ino
index cddbd00..8b8ee29 100644
--- a/flix/motors.ino
+++ b/flix/motors.ino
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
-// Motors output
+// Motors output control
// Motor: 8520 3.7V
// ESC: KINGDUO Micro Mini 4A 1S Brushed Esc 3.6-6V
diff --git a/flix/rc.ino b/flix/rc.ino
index 42d3a7d..bed076d 100644
--- a/flix/rc.ino
+++ b/flix/rc.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Work with the RC receiver
+
#include <SBUS.h>
const uint16_t channelNeutral[] = {995, 883, 200, 972, 512, 512};
diff --git a/flix/time.ino b/flix/time.ino
index d3f9111..2d15fa3 100644
--- a/flix/time.ino
+++ b/flix/time.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Time related functions
+
void step()
{
float now = micros() / 1000000.0;
diff --git a/flix/util.ino b/flix/util.ino
index eae6742..13d7fc6 100644
--- a/flix/util.ino
+++ b/flix/util.ino
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Utility functions
+
#include "math.h"
float mapf(long x, long in_min, long in_max, float out_min, float out_max)
diff --git a/flix/wifi.ino b/flix/wifi.ino
index 3832859..8909edd 100644
--- a/flix/wifi.ino
+++ b/flix/wifi.ino
@@ -1,9 +1,7 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
-// https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino
-// https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClient/WiFiClient.ino
-// https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiUDPClient/WiFiUDPClient.ino
+// Wi-Fi support
#if WIFI_ENABLED == 1
@@ -15,9 +13,7 @@
#define WIFI_SSID "flix"
#define WIFI_PASSWORD "flixwifi"
-// #define WIFI_UDP_IP "192.168.4.255"
#define WIFI_UDP_IP "255.255.255.255"
-// #define WIFI_UDP_IP "192.168.4.2"
#define WIFI_UDP_PORT 14550
WiFiUDP udp;
diff --git a/gazebo/flix.cpp b/gazebo/flix.cpp
index 773c1ab..31130e9 100644
--- a/gazebo/flix.cpp
+++ b/gazebo/flix.cpp
@@ -1,24 +1,7 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
-// https://classic.gazebosim.org/tutorials?tut=plugins_model&cat=write_plugin
-// https://classic.gazebosim.org/tutorials?tut=set_velocity&cat=
-// https://github.com/gazebosim/gazebo-classic/blob/gazebo11/plugins/ArduCopterPlugin.cc
-// https://github.com/gazebosim/gazebo-classic/blob/gazebo11/plugins/ArduCopterPlugin.cc#L510 - motor
-// https://classic.gazebosim.org/tutorials?tut=gui_overlay&cat=user_input
-// https://github.com/gazebosim/gazebo-classic/blob/gazebo9/examples/plugins/gui_overlay_plugin_time/GUIExampleTimeWidget.cc
-// https://github.com/yujinrobot/kobuki_desktop/blob/ea5b7283d92f61efbd1a2185b46e1ad344e7e81a/kobuki_gazebo_plugins/src/gazebo_ros_kobuki_loads.cpp#L29
-// https://github.com/osrf/swarm/blob/1a2e4040b12b686ed7a13e32301d538b1c7d0b1d/src/RobotPlugin.cc#L936
-
-// motors thrust: https://www.youtube.com/watch?v=VtKI4Pjx8Sk
-
-// https://github.com/gazebosim/gazebo-classic/tree/master/examples/plugins
-
-// publish to topics https://github.com/wuwushrek/sim_cf/blob/df68af275c9f753d9bf1b0494a4e513d9f4c9a7c/crazyflie_gazebo/src/gazebo_lps_plugin.cpp#L104
-// https://github.com/bitcraze/crazyflie-simulation
-
-// GUI overlay:
-// https://github.com/gazebosim/gazebo-classic/blob/gazebo9/examples/plugins/gui_overlay_plugin_time/GUIExampleTimeWidget.cc
+// Gazebo plugin for running Arduino code and simulating the drone
#include <functional>
#include <cmath>
diff --git a/gazebo/joystick.h b/gazebo/joystick.h
index 3c490f8..d945bcf 100644
--- a/gazebo/joystick.h
+++ b/gazebo/joystick.h
@@ -1,6 +1,8 @@
// Copyright (c) 2023 Oleg Kalachev <[email protected]>
// Repository: https://github.com/okalachev/flix
+// Joystick support for simulation
+
#include <SDL2/SDL.h>
#include <gazebo/gazebo.hh>
#include <iostream>