INTRODUCTION
The main focus of this project is to intuitively control the quadcopter using hand orientation.
Crazyflie 2.0 is a miniature quadcopter that fits in one’s hand and ideal for many areas of research. Its source code and hardware are open, making it possible to tap into any part of the system for complete control and full flexibility. New hardware or sensors can be added through the versatile expansion ports, enabling the addition of latest sensors.
Leap Motion Controller is an ideal choice for controlling Crazyflie. Thrust and orientation of Crazyflie can be controlled with height and orientation of hand with respect to leap sensor. Leap motion controller tracks your hands at up to 200 frames per second using infrared cameras – giving you a 150° field of view with roughly 8 cubic feet of interactive 3D space.
IMPLEMENTATION AND CHALLENGES
Leap motion SDK has been interfaced with the Crazyflie python APIs in Ubuntu 16.04 platform. Following is the overview of implementation. Comments in detail have been provided in the code. Also references have been added in the reference section.
Grab gesture keeps the thrust disabled. Once the hand is opened, Pitch, Roll and Yaw of the Quadcopter are controlled using hand orientation. Thrust is controlled using distance of hand from Leap motion controller.
Despite the full range of the thrust vlaue which can be given to the Crazyflie being 10000(0%) – 60000(100%), it has been limited to the range 35000 – 42000 for finer control. 42000 is the thrust at which slight acceleration upward was observed and 35000 is the thrust value at which slight acceleration downward was observed. Hence we limited the range to these values to make the quadcopter easier to control. These values can be fine tuned using constants maxthrust and minthrust as they may vary from drone to drone. Also the leap motion sensor has about 200mm range above it, hence the smaller range of thrust mapped to this 200mm range gives finer control.
Keeping Quadcopter balanced makes it more stable. Since the battery is movable, one should make sure that it is adjusted so that the weight is balanced.
Sudden high thrust is required for the Quadcopter to lift off steadily by avoiding ground effect. Hence grab gesture has been used to disable the thrust until the hand can be positioned on leap sensor to give a sudden steady high thrust.
There are a number of PID control loops within the Crazyflie which can be enabled or disabled using flight mode parameters. By default pitch and roll PID control loops are enabled. Control parameters (Ki, Kd, Kp) of the PID controller can be modified. Crazyflie client application can also be used to observe and modify parameters. Further details are provided in references.
The control loops for pitch control and roll control are enabled by default. We have only let these control loops be enabled. Figure below shows the GUI of cfclient application.
CODE
Following are the prerequisites for the code to run. Leap sensor SDK has to be installed and the service has to be started. Python libraries (cflib, PyQt5 etc.) required for Cfclient (Crazyflie python client) needs to be imported. Further details are available in the references provided.
DEMO
TEST SETUP
Since the motor mounts of Crazyflie are fragile and difficult to acquire, it is important to have a good test setup to avoid hard crashes.
The test setup shown in the demo video was very helpful in avoiding damages on Crazyflie. Since the weight of the Crazyflie is very less, even a slight buffer will reduce the impact a lot. Hence mattresses and bedsheets are used extensively to provide buffer.
ISSUES FACED
There has to be an initial 0 thrust command given to the Crazyflie to unlock thrust. Also to reduce the delay in disabling the thrust we gave the 0 thrust command continously, otherwise it was having about 1 to 2 seconds delay.
Previously set flight mode parameters remain unchanged in the Crazyflie, hence we had to be careful to reset the parameters after connecting. These parameter can also be viewed and accessed using the Crazyflie client application.
Altiltude hold control loop was not behaving as we expected, hence we planned to write a control loop ourselfs but the altitude readings given by the Crazyflie were not reliable. Time taken by Barometer to settle into a stable value is very high. Moreover, the final settled value shows a gradual shift with time.
FUTURE SCOPE
Thrust control may be automated using the Altitude hold PID controller within the Crazyflie.
Safe landing of Crazyflie may be automated as a safe fail mechanism.
REFERENCES
Useful link for installing Leap motion controller in Ubuntu 16.04
First use of Leap motion controller
TEAM MEMBERS
Jishnu Pavithran, Bondada Prasanna Vishnu
Recent Comments