The idea behind this project is to share a set-up for robotics simulation in Unity. At the time of this writing, this is simply a Unity-based drone controller—in particular a DJI F450 controller written in C#—which can be controlled by any joystick you'd like; although, it's been only tested with a PS4 controller (it's pretty easy to set up a different one).
Keep in mind it's a very basic implementation, inspired by other people, in which you can control the drone's altitude and orientation with the joystick sticks. Feel free to improve it!
To start running this project you need to fulfil a few steps.
Firstly, you've got to have Unity installed (obviously), and secondly, you should download the Art
for the models.
There are only two models in the scene, the DJI F450 drone and the ground to collide with.
The model was downloaded from here (thanks Matheus Monteiro). However, there are some caveats to use the model directly. If you import either Collada or SketchUp files, the model won't be complete. So I fixed it and exported a Unity package based on a FBX file. Download it from this link.
The ground is basically a 2D GameObject
(a plane) with some texture on it.
Be sure to download the materials and the texture folders from here.
You can place both Material/
and Textures/
folders within Art/Ground
for instance.
Thanks Indie Pixel for the cool textures.
The PS4 controller is connected directly by pairing it with a computer. Once you've confirmed that the OS has recognized the device you just need to install the Unity Package called "Input System". It can be installed via the package manager in Unity.
The configuration for the drone inputs can be found this directory.
There are a few things that can be done based on this project.
- Improve the physics of the drone.
- Integrate Unity with ROS and implement algorithms to automatically control the drone (e.g. hovering).
- Add a camera view to the GoPro Hero 4.
- Create a more realistic scene around the model to make a better simulation.