Skip to content
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

Will this library be further developed? #1

Closed
purepani opened this issue May 13, 2024 · 4 comments
Closed

Will this library be further developed? #1

purepani opened this issue May 13, 2024 · 4 comments

Comments

@purepani
Copy link

purepani commented May 13, 2024

Title. I've been looking for FOC libraries in the rust ecosystem, and there don't seem to be any that are supported; I would consider rewriting my own, but I am not super experienced with motor control, so it would be better if this library could be further developed.
Alternatively, I would like to ask what the current state of the library is. As far as I can tell, the FOC calculations are implemented, but there's little to no embedded-hal implementation. Is that accurate? If so, I'd feel more comfortable using this library as a base.

@calebfletcher
Copy link
Owner

I noticed a similar gap in the available libraries, which is why I created this library to begin with. You are correct that at the moment the basic FOC algorithms are implemented, but that there isn't much in the way of an all-in-one FOC controller that you can just drop in to your system.

I'm currently in the process of bringing up some hardware so that I can more actively work on this and test it, so there should be some more activity in this repo happening soon. Embedded-hal integration is definitely something I would like to implement at some point, however I anticipate some issues due to the traits that are available and their support in the hardware-specific crates. The interfaces that FOC would need are:

  • PWM - There is an embedded-hal trait but so far only one STM32 crate has implemented it and Embassy has no support at all.
  • ADCs for current monitoring - The embedded_hal trait was removed prior to the v1.0 release, and hasn't had much new development since.
  • Encoders - While there are low-level SPI/I2C traits in embedded_hal, we would probably need something higher-level (like an Encoder trait) so that we don't have to put all the different encoder driver implementations in this crate.

Given this, I'm not sure how feasible it would be to support embedded-hal. At least in the short term, I would be looking at keeping this crate to be more IO-agnostic. The API is going to look roughly like the Foc struct, which currently is just a prototype for me to plan around (you can't actually construct it). Based on that API, you get a single method that takes in your encoder reading, your current readings, and your desired torque, and then produces the PWM values you need to set on your PWM controller. This design would allow people to use it with minimal integration effort, while also allowing people to use it on any microcontroller they want.

@Ben-PH
Copy link

Ben-PH commented May 28, 2024

there isn't much in the way of an all-in-one FOC controller that you can just drop in to your system.

I'm working on a rewrite of Simple FOCs arduino library. Still WIP stage, but I've gotten feedback that it's quite close to a PoC. An SFOC kit should arrive in the mail soon to get it to a stage where you can do basic voltage control with an esp32 based platform: https://github.com/Ben-PH/SimpleFOC-rs/tree/dev

My goal is to write something that is compatable and consistent with the simple foc project. My mental model is two-fold:

  • A kid that's made a toy website in TS want's to try making a toy robot. They ask for a simple foc kit for their birthday, and decide to try it in rust, as well as arduino.
  • To present an interface to 3d printer firmware, such that the firmware can dispatch motion instructions and it Just Works nicely.

As for you points:

@purepani
Copy link
Author

Hey @Ben-PH
Here are the references I found for ADC stuff
rust-embedded/embedded-hal#377
rust-embedded/embedded-hal#569

@calebfletcher
Copy link
Owner

With 0.3.0 of this crate being released an overall FOC controller which wraps all of the underlying algorithms into a single controller is available, which addresses your original question of having something more than just the raw algorithms. For the embedded_hal integration, I have created a tracking issue #3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants