# PXL - Hasselt - Drone Project This is the blog for our international project in semester 4. In this project we educate ourselves on the matter of drone flying and programming an app to navigate that drone. ## Day 1: 19/04/2021 On the first day of the week we got to know each other and figured out how we will spend our time. ![](https://i.imgur.com/s6P076e.jpg) Our objectives for today are as follows: * Unbox and charge the drone and its accessories * Set up a GitLab environment for us to use * Set an end goal which is reachable by the end of the week * Learn to know and navigate the documentation, workflow, guides and API * Download and build DJI's sample application * Go out and start the drone's maiden flight by using the DJI Fly app * Get to know the controls * Get to know the functionalities * Get comfortable with the device * Test the sample application with the drone At the end of the day we succeeded in completing most objectives. Only when testing the sample application we came to a standstill. We couldn't figure why it was not working. After some hours of trying and retrying we found out that the DJI Mini 2 is not supported to work with the sdk after all. We searched the internet in the hope of finding a work around. The only lead we found was a DJI Community thread where someone had found a way around the problem. We contacted the person in an attempt to get his code, but he wouldn't share it with us as it seemed he was creating his own app. Although it seemed like an unproductive day, those of us who didn't have experience with Android Studio have learned how a mobile app is created and installed on a live or virtual device. We even did some debugging. ## Day 2: 20/04/2021 Yesterday we left the Vibe with a desperate feeling. We figured out the DJI Mini 2 was not suited for the tasks we wanted to perform. Luckily we had some leads on how to progress with the project: * DJI Simulator * Hacking the SDK The first lead was to use the DJI Simulator. This simulator is primarily used for training drone pilots so you don't have to risk expensive drones at the hands of inexperienced users. Unfortunately the Simulator is only available to users with a physical device in the high-end range. As we could've expected, the DJI Mini 2 is not part of the supported devices to work with the Simulator. So the DJI Simulator was no longer an option to work with. The other lead was hacking into the DJI SDK and tricking it to believe we were working with DJI Mavic Air 2 instead of a Mini 2. An extensive Google search made clear it is possible, but nobody in the community shared their found secrets with us. Since we had no other options, we decided to investigate further and try to find a way in anyway. ![](https://i.imgur.com/HfVFDBi.jpg) ![](https://i.imgur.com/mbqjWw2.jpg) In the meantime, the lectors were busy trying to find a new drone with a functional SDK. Around noon, Gene Vangampelaere managed to fix us a Parrot AR2.0, a somewhat outdated aircraft, but at least it had a programmable interface. Immediately we took it to the yard for a testrun, using the native Android app and it worked like a charm. The device was a lot less stable than the DJI Mini 2, but we managed to keep it in the air. Later that day, we even managed to send some controls to the drone using a selfmade node.js server. Although it wasn't more than taking off and crashing into the trees, we were happy we could finish the day with some small programmable action. ## Day 3: 21/04/2021 Just like we decided yesterday, our goal for today was to create a simple website that we could use to give commands to the drone. This meant that we were busy writing code all morning. We still had a lot of work to do with the front- and back-end. After we had lunch, we still weren't finished, but we had made some great progress. The front-end was now almost completed, as well as the back-end. Or so we thought... Unfortunately, when we tried to control the drone with our code, something went wrong and the drone wouldn't move an inch. It didn't even show any of the errors that it should normally give if something went wrong. But since the day had come to an end, we decided we would fix it first thing in the morning. ## Day 4: 22/04/2021 We started the day with a test flight. We found three big problems with the drone: first of all, the battery wasn't in the best shape anymore. Sometimes the drone just landed because the battery was low, but after a restart, it worked just fine. The second problem is that the drone sometimes didn't follow our commands. It executed commands that we didn't give it. And last but not least, the drone didn't respond to our missions. This was a major problem for the sequence-page. We fixed that by using the same calls as the joysticks. In the afternoon, we made some minor changes: * We tried to connect with the camera of the drone, this resulted in a picture but not in a smooth recording; * We cancelled the flip-options because the drone was not stable enough; * We finished implementing controlling the drone ## Day 5: 23/04/2021 After finally having made tangible progress, our goal for the last day was simple: make the drone fly autonomously. We agreed on our course of action and immediately started finalizing our code. Some fiddling around and cleanup later we finally accomplished what we set out to do! We were able to input a sequence of commands using our application, and the drone for once did exactly what we expected. We then kept testing to fine-tune some functions and parameters, and Maarten gave us all a scare by making the drone do a flip unannounced. After that the battery ran out again so we continued cleaning up our code until noon. In the afternoon we attempted to solve some final issues until we met up with Koen Koreman to present our progress with a demo. Despite the rocky start, the demo was a success and we had a nice talk about the project. In the meantime some new issues had arisen so we took the time to iron them out while the drones battery was charging. Finally we went and made some videos to capture the finished project. All in all, we all really enjoyed the project, despite the disappointing start. Some of us had never flown a drone before, and we definitely never wrote a program to do it for us, so this was a very educational experience for all of us. We also hope DJI makes the Mini 2 compatible with their SDK sometime.