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

Using Trained Model On Real Crazyflie Drone #9

Open
zcase opened this issue Nov 7, 2024 · 8 comments
Open

Using Trained Model On Real Crazyflie Drone #9

zcase opened this issue Nov 7, 2024 · 8 comments

Comments

@zcase
Copy link

zcase commented Nov 7, 2024

@SvenGronauer Do you have an example somewhere that shows how you took a trained model and used it on a real Crazyflie drone?

@SvenGronauer
Copy link
Owner

Hi,
please see 0:13 - 0:32 of the following video for PWM control mode
https://github.com/user-attachments/assets/579c0658-b909-405f-bc9b-705dbf448961

@zcase
Copy link
Author

zcase commented Nov 11, 2024

@SvenGronauer This is great thank you, but how did you get your trained model from simulation to actually run on the crazyflie? Did you put it in the firmware and if so is that process posted here to repeat?

@mayhorizon
Copy link

mayhorizon commented Nov 11, 2024

Hi @zcase ,
We worked on this with our universities and used the trained model on a real crazyflie. Here is our repo : https://github.com/romainm13/crazyflie_ai

@SvenGronauer
Copy link
Owner

@SvenGronauer This is great thank you, but how did you get your trained model from simulation to actually run on the crazyflie? Did you put it in the firmware and if so is that process posted here to repeat?

We modified the firmware accordingly and replaced the controller with custom code.

One way to do that is by using the package "keras2c” for generating the C-code of the neural networks (NNs). As far as I remember the workflow was as follows:
(1) train NN with PyTorch
(2) transfer Pytorch model to TensorFlow model
(3) use keras2c for TensforFlow model to C code

@zcase
Copy link
Author

zcase commented Nov 22, 2024

@mayhorizon I noticed that there was a comment on that repo that you pointed to that said to fix the sim2real example. Where yall able to get everything working with that?

@SvenGronauer Thank you very much ill have to look into that process. Do you all have the firmware and your models you used available to test?

@SvenGronauer
Copy link
Owner

Hi @zcase,

I have an outdated version of the CrazyFlie firmware (from 2020) that we used for experimentation. If you are interested, please reach out via e-mail, then I can send you the files.

@mayhorizon
Copy link

@mayhorizon I noticed that there was a comment on that repo that you pointed to that said to fix the sim2real example. Where yall able to get everything working with that?

I don't remember quite well but yes, everything was working fine, we tested it on a real crazyflie and sent the positions given by the trained model to the python api of the crazyflie. It was a ping pong game between the model to which we were sending the real positions of the drone and the drone to which we were sending the goal positions given by the trained model. We also developed an app with more details on this repo : https://github.com/romainm13/crazyflie_backend .

@zcase
Copy link
Author

zcase commented Nov 25, 2024

@mayhorizon I get a 404 request when going going to the provided link.. Is the repo private?

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