-
Notifications
You must be signed in to change notification settings - Fork 0
Is there an example for simplefoc angle controlling? #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
Comments
Here you go: #include <Wire.h> #define UH 16 BLDCMotor motor = BLDCMotor(7); class TMAG5273_Sensor : public Sensor { float getSensorAngle() override { private: TMAG5273 sensor; unsigned long previousMillis = 0; uint16_t position_count = 0; float target_angle_deg = 0.0; // I2C default address // Set constants for setting up device bool dataread = false; void readsensor(void) { void setup() { sensor.setConvAvg(conversionAverage); driver.voltage_power_supply = 5.0; void loop() { if (Serial.available() > 0) { unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { motor.loopFOC(); |
Uh oh!
There was an error while loading. Please reload this page.
I tried motor driver using Arduino simplefoc. When I set control type to "velocity openloop" or "angle openloop", it runs well. But for "velocity" and "angle" type, the motor cannot go to the set point. It spins cw then ccw then cw again and again.
The motor and driver I used is SparkFun IoT Brushless Motor Driver v10. I connect it to mac pro m2 and don't change anything(all as factory setting).
I created an arduino sketch, set "SparkFun ESP32 Thing Plus C" as board type. The source code as following.
The esp32(by Espressif Systems) version is 2.0.14, and simplefoc version is 2.3.1. I tried a whole day to adjust luxuriant PID settings using simplefoc studio (I forked one to make it work with macOS m1/m2 natively, https://github.com/chengyingyuan/SimpleFOCStudio) without success.
Are there any hints?
The text was updated successfully, but these errors were encountered: