Hi! We are working on a project on Crazyflie 2.0. We would like to make it land when we want it to. The altitude of the drone would be calculated by an altimeter that we would add to it (ultrasonic sensor) and we want to write a code that would start the landing process when we want it to. In order to do that we need to know how the engines work and how they are controlled. We have read the documents we found on the wiki about experiments on engines for calculating the rpm, however we need to understand the link between thrust and altitude.
Can anyone help us please ?
You might want to take a look at the code for the z-ranger deck, even if you want to implement your own altimeter you can maybe get some ideas from how the it is designed.
The z-ranger is measuring the distance to the ground and is keeping the Crazyflie at a constant altitude in altitude hold mode. This is almost what you want to do except that you want to reduce the target height over time. This functionality is using the position controller to indirectly control the motors instead of changing the motor power directly.
There is a related post (viewtopic.php?f=6&t=2675&p=13535&hilit=setpoint#p13535) regarding setpoints and controllers that you might find interesting as well. The overall control loop is outlined there and it should hopefully give you some hints on where to look.
We would like to know where we can find the part of the code which controls the motors. We have seen the code for the Z-Ranger (zranger.c) which reads data from the sensor.
But we would like to know how these data are used by the drone and how the thrust is changed (exactly what is the command that goes into the motors).
As we already told you, we have an ultrasonic sensor which will calculate the current altitude of the drone as it will be the feedback loop. We are wondering how to bring the information from the ultrasonic sensor back to the drone.
Since the drone and the computer communicate through radio, can we send the data from the sensor through radio (the sensor will be plugged in the breakout deck)? What kind of radio signal is sent by the transmitter on the drone?
We have the same question about the z-ranger : where is the information from the optic sensor collected ? How does the z-ranger control the motors? (which part of the code collect the information given by the sensor and then use it to control the motors?)
Sending information to the PC is quite simple by using the log framework.
The z-ranger only measures the height and feeds this information into the controllers. You could do exactly the same thing with the ultrasonic distance by replacing this line with an equivalent function that is using the ultrasonic sensor.
Hi,
We are sorry to ask you so many questions but I tried to be as clear as possible ^^'
The z-ranger only measures the height and feeds this information into the controllers.
Where can we find this controller? Because we search it but we didn't find it... Is this controller using the data from the z-ranger and then control the motors adequately?