-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would you like help with this project? #1
Comments
Hi Mikhail,
Of course, it would be great to have your help!
I'm not a very experienced programmer myself, so I might have made a few
mistakes. I’d be happy to discuss any suggestions and implementations you
have in mind.
First of all, I’d like to keep the project as low-cost as possible because
I’ve declared war on marine companies—I hope you feel the same! :)
My first approach was with PID, but I abandoned it (it's no longer used—I
developed my own algorithm). I wanted something new, and PID couldn't keep
the course as well as my current approach. Instead, I implemented a reverse
movement of the actuators based on the delta error between consecutive
readings.
Regarding your collaboration, I’d love to have you on board! However, I
want to be upfront—I can’t offer any payment. Just to be clear, while I
plan to keep the project free forever, at some point in the future, I’d
like to offer a low-cost option for those who can’t build it themselves.
But for now, that’s still far from happening.
I know talking about money isn’t always polite, but I’ve had bad
experiences in the past, so I prefer to be transparent from the start.
Let me know how you’d like to proceed!
Fair winds,
Yari
Il giorno gio 20 feb 2025 alle ore 00:37 Mikhail Grushinskiy <
***@***.***> ha scritto:
… Hello,
Looks like a great way to start a new autopilot implementation. You have
drafted all components. esp32-S3 should be enough to run it.
I have experience with esp32, LVGL, IMUs, NMEA, Kalman filters, etc. I
have my own boat related project on GitHub.
You can see my works at:
https://bareboat-necessities.github.io/
Here are the areas I can contribute:
- Add GitHub action for CI automatic builds of binaries
- Add a script to load binaries for devices
- Add IMU for tilt compensated compass, and Kalman fusion to remove
noise.
- Add a tool for better calibration using sphere fit which corrects
both offsets and scale biases
- Add UI client with LVGL on esp32 (m5stack tough)
- Add GPS and IMU Kalman fusion for better gps speed and location
accuracy
- Add Fractional Order PID controller implementation instead of
regular PID controller
I won’t be able to help with PCB designs.
That area also needs some touches. I can only help with the software.
Please let me know if you would accept my PRs.
Thanks,
Fair Winds!
—
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APL3E6VMOVOMORYEYK57DSD2QUIU7AVCNFSM6AAAAABXPNDXWKVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DINRSGI2TKNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
[image: mgrouch]*mgrouch* created an issue (yarigabbai/Euno#1)
<#1>
Hello,
Looks like a great way to start a new autopilot implementation. You have
drafted all components. esp32-S3 should be enough to run it.
I have experience with esp32, LVGL, IMUs, NMEA, Kalman filters, etc. I
have my own boat related project on GitHub.
You can see my works at:
https://bareboat-necessities.github.io/
Here are the areas I can contribute:
- Add GitHub action for CI automatic builds of binaries
- Add a script to load binaries for devices
- Add IMU for tilt compensated compass, and Kalman fusion to remove
noise.
- Add a tool for better calibration using sphere fit which corrects
both offsets and scale biases
- Add UI client with LVGL on esp32 (m5stack tough)
- Add GPS and IMU Kalman fusion for better gps speed and location
accuracy
- Add Fractional Order PID controller implementation instead of
regular PID controller
I won’t be able to help with PCB designs.
That area also needs some touches. I can only help with the software.
Please let me know if you would accept my PRs.
Thanks,
Fair Winds!
—
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APL3E6VMOVOMORYEYK57DSD2QUIU7AVCNFSM6AAAAABXPNDXWKVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DINRSGI2TKNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Yari Gabbai
tel 329.2947358
|
Hello, I've added my first pull request. It should simplify builds and safe time on detecting compile errors. I hope you can merge it. Thanks, |
Few next steps. autopilot-core.ino is too big file. I think it should be refactored to keep .ino small Also I see delay(1000) in loop(). I think steering need to be applied more often than just 1Hz. Thanks |
There is also this project: https://github.com/spascual90/Fenix Autopilot on MCU also. Uses NeoGPS instead of TinyGPS. See: https://github.com/SlashDevin/NeoGPS |
Also AI is very good for writing small code snippets. Here is an answer of DeepSeek to the question: Can you write PID controller in C++ for esp32? Certainly! Below is an example of a simple PID controller implementation in C++ for the ESP32. This example assumes you have some basic knowledge of how to set up and program the ESP32 using the Arduino IDE or PlatformIO. PID Controller Implementation in C++ for ESP32class PIDController {
public:
// Constructor
PIDController(float kp, float ki, float kd, float setpoint)
: kp(kp), ki(ki), kd(kd), setpoint(setpoint), prevError(0), integral(0) {}
// Compute the PID output
float compute(float input) {
// Calculate error
float error = setpoint - input;
// Proportional term
float proportional = kp * error;
// Integral term
integral += error;
float integralTerm = ki * integral;
// Derivative term
float derivative = kd * (error - prevError);
prevError = error;
// Calculate the output
float output = proportional + integralTerm + derivative;
return output;
}
// Set the setpoint
void setSetpoint(float newSetpoint) {
setpoint = newSetpoint;
}
// Set the PID gains
void setGains(float newKp, float newKi, float newKd) {
kp = newKp;
ki = newKi;
kd = newKd;
}
private:
float kp; // Proportional gain
float ki; // Integral gain
float kd; // Derivative gain
float setpoint; // Desired value
float prevError; // Previous error
float integral; // Integral of errors
};
// Example usage in an ESP32 sketch
void setup() {
Serial.begin(115200);
// Initialize PID controller with gains and setpoint
PIDController pid(1.0, 0.1, 0.01, 100.0); // Example gains and setpoint
float input = 0.0; // Simulated input (e.g., sensor reading)
float output = 0.0; // Output to actuator (e.g., motor speed)
for (int i = 0; i < 100; i++) {
// Simulate a process (e.g., read sensor value)
input += output * 0.1; // Simulate system response
// Compute PID output
output = pid.compute(input);
// Print results
Serial.print("Input: ");
Serial.print(input);
Serial.print(" Output: ");
Serial.println(output);
delay(100); // Simulate time delay
}
}
void loop() {
// Empty loop
} Explanation:
Notes:
Let me know if you need further assistance! |
Even cooler. I asked it to implement FoPID controller: Certainly! A Fractional-Order PID (FoPID) controller is an extension of the traditional PID controller, where the derivative and integral terms can have fractional orders. This allows for more precise control in certain systems. Below is an implementation of a FoPID controller in C++ for the ESP32. This implementation uses the Grunwald-Letnikov (GL) definition for fractional derivatives and integrals, which is a common approach for discrete-time systems. FoPID Controller Implementation in C++ for ESP32#include <cmath>
#include <vector>
class FoPIDController {
public:
// Constructor
FoPIDController(float kp, float ki, float kd, float lambda, float mu, float setpoint, int memorySize)
: kp(kp), ki(ki), kd(kd), lambda(lambda), mu(mu), setpoint(setpoint), memorySize(memorySize) {
errorHistory.resize(memorySize, 0.0f); // Initialize error history
}
// Compute the FoPID output
float compute(float input) {
// Calculate error
float error = setpoint - input;
// Update error history
errorHistory.erase(errorHistory.begin());
errorHistory.push_back(error);
// Proportional term
float proportional = kp * error;
// Fractional integral term (using Grunwald-Letnikov)
float integralTerm = 0.0f;
for (size_t i = 0; i < errorHistory.size(); i++) {
integralTerm += std::tgammaf(lambda + 1) / (std::tgammaf(i + 1) * std::tgammaf(lambda - i + 1)) *
errorHistory[errorHistory.size() - 1 - i];
}
integralTerm *= ki;
// Fractional derivative term (using Grunwald-Letnikov)
float derivativeTerm = 0.0f;
for (size_t i = 0; i < errorHistory.size(); i++) {
derivativeTerm += std::tgammaf(mu + 1) / (std::tgammaf(i + 1) * std::tgammaf(mu - i + 1)) *
errorHistory[errorHistory.size() - 1 - i];
}
derivativeTerm *= kd;
// Calculate the output
float output = proportional + integralTerm + derivativeTerm;
return output;
}
// Set the setpoint
void setSetpoint(float newSetpoint) {
setpoint = newSetpoint;
}
// Set the FoPID gains
void setGains(float newKp, float newKi, float newKd, float newLambda, float newMu) {
kp = newKp;
ki = newKi;
kd = newKd;
lambda = newLambda;
mu = newMu;
}
private:
float kp; // Proportional gain
float ki; // Integral gain
float kd; // Derivative gain
float lambda; // Fractional order for integral term
float mu; // Fractional order for derivative term
float setpoint; // Desired value
int memorySize; // Size of error history for fractional calculations
std::vector<float> errorHistory; // History of errors for fractional calculations
};
// Example usage in an ESP32 sketch
void setup() {
Serial.begin(115200);
// Initialize FoPID controller with gains, fractional orders, setpoint, and memory size
FoPIDController fopid(1.0, 0.1, 0.01, 0.5, 0.5, 100.0, 50); // Example parameters
float input = 0.0; // Simulated input (e.g., sensor reading)
float output = 0.0; // Output to actuator (e.g., motor speed)
for (int i = 0; i < 100; i++) {
// Simulate a process (e.g., read sensor value)
input += output * 0.1; // Simulate system response
// Compute FoPID output
output = fopid.compute(input);
// Print results
Serial.print("Input: ");
Serial.print(input);
Serial.print(" Output: ");
Serial.println(output);
delay(100); // Simulate time delay
}
}
void loop() {
// Empty loop
} Key Features of the FoPID Controller:
Example Parameters:
Notes:
Let me know if you need further clarification or enhancements! |
Hello,
Looks like a great way to start a new autopilot implementation. You have drafted all components. esp32-S3 should be enough to run it.
I have experience with esp32, LVGL, IMUs, NMEA, Kalman filters, etc. I have my own boat related project on GitHub.
You can see my works at:
https://bareboat-necessities.github.io/
Here are the areas I can contribute:
I won’t be able to help with PCB designs.
That area also needs some touches. I can only help with the software.
Please let me know if you would accept my PRs.
Thanks,
Fair Winds!
The text was updated successfully, but these errors were encountered: