Page 1 of 1
Brushless Code for C2.0
Posted: Tue Feb 03, 2015 7:48 am
by akbarhash
Hi can you check my code for Brushless on crazyflie2.0.
Header file
http://pastebin.com/DZfS8ibV
C 405 file
http://pastebin.com/MaHGJCjC
Dont have GIT.
Thanks.
It is based on brushless driver code from crazyflie 1.0 with modifications for cpu speed to adjust for crazyflie 2.0. Also I don't have my brushless motors and esc yet. So it is only theoretical.
Also the PWM output frequency is 400Hz. We can go down to 250Hz too.
Thanks.
Re: Brushless Code for C2.0
Posted: Thu Feb 05, 2015 1:22 pm
by tobias
I will certainly have a look at it and try to integrate it into the main code. Thanks for the contribution!
Re: Brushless Code for C2.0
Posted: Sun Feb 15, 2015 7:59 pm
by akbarhash
Hi, tobias.
Firstly thanks for the quick work on the brusless driver it looks good. My esc and motors will arrive this week so it seems like the timing is perfect. This might be a silly question but I am still new and just getting the hang of this.
In motors.h
We have
Code: Select all
#ifdef F10X
...For Crazyflie1.0
else
#ifdef BRUSHLESS_MOTORCONTROLLER //Crazyflie2
...For Brushless Motor
#else
...For crazyflie2.0
#endif
#endif
So my questions are.
A) Wouldnt the brushless code not work for crazyflie1.0?
B) How would the board know if we have a brushless motor? ... We could have a variable like PID values that we could set from parameter tab from the crazyflie client.
Re: Brushless Code for C2.0
Posted: Mon Feb 16, 2015 11:08 am
by tobias
The brushless driver is working quite well but I think there are more stuff that can be improved as well. E.g. some brushless controllers want a specific startup signal, such as first no trust, then full thrust and finally no thrust again (to calibrate the interval).
My plan is to document my setup on the wiki during the week. Brushless motors are often very powerful and dangerous though which requires a lot more care and safety, so be careful!
I used the motor connectors to drive the PWM to the controllers but there is also a possibility to use some signals on the expansion port, that code doesn't exist yet.
A) Wouldnt the brushless code not work for crazyflie1.0?
The code is on the Crazyflie 2.0 branch so it will still work for the Crazyflie 1.0 on the master branch. Later on we will merge the two.
B) How would the board know if we have a brushless motor? ... We could have a variable like PID values that we could set from parameter tab from the crazyflie client.
You will have to flash a specially compiled firmware. It can't be set in real time yet and it probably shouldn't (due to safety). The PID values can already be set from the parameter tab in the cfclient, or did I understand your question wrong?
Re: Brushless Code for C2.0
Posted: Mon Feb 16, 2015 1:41 pm
by akbarhash
tobias wrote:You will have to flash a specially compiled firmware. It can't be set in real time yet and it probably shouldn't (due to safety). The PID values can already be set from the parameter tab in the cfclient, or did I understand your question wrong?
It's fine I understand what you are saying. Looking forward for the blog post. Last question. What would be a good place to define BRUSHLESS_MOTORCONTROLLER. Is motors_f405.c fine if not can you suggest the best possible location.