-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add setpoint functionality to attitude rate and motor speeds #572
Comments
I agree this would be a really useful feature to have. In fact we are working on a study for which we would like to set the speed of each motor independently. I came across this Bachelor thesis from ETH Zurich, which I think you might be familiar with, where the student has done something similar: http://mikehamer.info/assets/papers/Crazyflie%20Modelling.pdf Something along these lines would be perfect for us. If we have time to try it out we will share our experiences here. |
Just a reminder: let us use SI units if possible. At some point we should convert all set points to SI units and it would be nice if this is already OK |
Hi guys I come here because the last days i had a question
I will like to know how can i do an off-board controller?, maybe using ROS. What happens with the firmware if I do an off-board controller that control all the states?? And with the parameters of the crazyflie you know which ones are correct? Thank you!! |
A little update here. I was investigating the setpoints and controllers a little bit, and it IS possible to set the attitude directly from the setpoints directly (see
If the modes of roll pitch and yaw are set to modeVelocity, that is exactly what we want already. I guess we have to find out how to set that setpoint from the python library, which I would guess just requires another send_setpoint function. Also I think that the python api documentation (https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/) should also be extended. |
Yes it is possible, you linked to the internal commander struct that "supports everything" internally, there needs to be a radio commander packet that fills up the rate modes. The 'old' way of controlling with attitude rate seems to be still active: crazyflie-firmware/src/modules/src/crtp_commander_rpyt.c Lines 179 to 181 in 6d75b4e
The modes are set by parameters, and when they are set to rate the normal setpoint packet can be interpreted as rate instead of absolute attitude: crazyflie-firmware/src/modules/src/crtp_commander_rpyt.c Lines 226 to 228 in 6d75b4e
If this functionality is useful and we want to make it more clearly available the best might be to implement a generic commander packet for it and to add it to commander.py in the python lib. |
yeah exactly :) I think it would be useful for the ones that want to design an off-board controller, since there is still 2 cascaded PID 'layers' between the absolute attitude set-point and the motor controls. This will reduce it to 1 layer, which probably will provide enough stability but is not as extreme as controlling the motor controls directly. |
anyway, since this is already possible firmware wise and there is an issue about this in bitcraze/crazyflie-lib-python#152, I will close this issue |
Thank you for the update on this. We managed to go around this issue by setting the motor speeds through the mPowerSet parameter, which is not usable for realtime but we were able to record the data we needed that way. In realtime, we ended up wanting to control the attitude since we wanted the drone to hover in a stable way. Therefore it was enough for us to use the thrust/roll/pitch/yaw setpoints. However it is good to know the workaround for the future. |
Ah happy you found a solution in the end anyway. Are you experiencing a lot of delay when controlling attitude instead of the attitude rate? I think I probably will still go ahead to add this functionality to the python library since more people requested this :) this summer is going to be clean up all the way anyway! |
Hi, sorry for intruding, but is there going to be functionality added to the api for controlling the motors directly? I was about to clone the firmware and start tweaking with it to make it work for a project, when I found this discussion. |
Like @duembgen, you can set the motor speed through the parameter frame work with mPowerSet. |
Oh yeah, but I understand that these cannot be set in realtime right? It can't be used for flight control |
Yes I would suspect that it might be difficult to do that in real time, also considering the delay in communication in general. We probably would need to make a separate CRTP group for this in order to get this through as quickly as possible. But that is maybe something for which we would need to make a different ticket/issue for maybe |
Hi, im looking to control each motor of crazyflie 2.1, so is there any python script for controlling the motors directly? |
The way I did it was by affecting the firmware. There are possibly more elegant ways, but the above should work pretty easily |
Thank you so much you really give me hope, i'll try it today. |
I use crazyflie-ros so I had to create ros publishers. If you're using the crazyflie-python libs, I think you just go there and create a message type. |
Thank you very much, sorry to ask a lot of questions, but since I don't code in C often i have faced some problems About the function in power distribution stock I haven't been able to figure out how to write it (ex how should I assign the values of the motors, should I define a structure containing these values). |
I think you're on the right track. In order to avoid flooding this issue with answers, you can check my implementation at |
Thank you so much.For my last question i had sent you an email. |
So we can detect invalid parameter values without crash. Fixes: bitcraze#572
In order to work on off-board control design, it is good to have more direct control for the desired attitude rate or even motor speeds. Some have tried to do this through the parameter setup, but since the parameters framework is not on a high priority in the freertos scheduler, this is too slow for that purpose. Therefore, it should be possible to set the desired attitude rate or motors from the setpoint functionality directly.
The text was updated successfully, but these errors were encountered: