This repository contains a drone simulator created with Unity that is compatible with PX4.
The simulator can be used for real-time drone flight simulation and testing flight control algorithms.
For those who want to use the Hakoniwa Drone Simulator on native Windows, please refer to this.
- Hakoniwa Drone Model
- Tojinbo 3D Model
- Integration with PX4
- Supported Environments
- Usage Instructions
- Community and Support
- Repository Contents and License
- Contribution Guidelines
The drone model created in Unity is an original Hakoniwa model and is a quadcopter type (as shown below).
Unity assets of the Hakoniwa Drone Model H1 are based on data provided by Mr. Hodaka Nakamura of Ida B. Wells-Barnett High School. We want to express our deepest gratitude for his awesome contribution :D
The Tojinbo 3D model was created with the generous support of the following individuals:
-
Mr. Ueno from Virtual Sky
- Provided 360-degree drone footage of the Tojinbo landscape.
- For more details, please visit the Virtual Sky official website.
-
Mr. Komori from Komori Laboratory
- Converted the captured data into a 3D model.
- For more details, please visit the Komori Laboratory official website.
This model could not have been completed without their invaluable assistance. We deeply appreciate their contributions to Hakoniwa's OSS initiatives.
For instructions on integrating the Tojinbo 3D model into the Hakoniwa Drone Simulator, please refer to this guide.
- Intel-based Mac
- Arm-based Mac
- Ubuntu
- Windows 10/11
The Hakoniwa Drone Model for Unity can be used in two ways:
- Using the Unity Application
- Using the Unity Editor
For the first method, there is no setup hassle as you use a pre-built application.
For the second method, you will use the Unity Editor, which requires some setup.
No specific Unity environment is required.
Clone the repository as follows:
git clone --recursive https://github.com/meta0xflip/unity-drone-model.git
Once the cloning is complete, navigate to the directory as follows:
cd unity-drone-model/
Download the application suitable for your environment from the following site:
https://github.com/meta0xflip/unity-drone-model/releases
Unzip the downloaded file under the unity-drone-model
directory.
The directory structure will be as follows:
unity-drone-model/DroneApp<OS>
Run the following command directly under the unity-drone-model
directory:
bash ./plugin/activate_app.bash DroneApp<OS>
For the Windows native app, double-click DroneWinNative/model.exe
.
If successful, the Unity application will launch.
- Homebrew (Mac only)
- Unity Hub
- Unity (compatible with your CPU architecture)
- Version 2022.3.5f1 or later
Clone the repository as follows:
git clone --recursive https://github.com/meta0xflip/unity-drone-model.git
Once the cloning is complete, navigate to the directory as follows:
cd unity-drone-model/
Then, install the necessary Unity modules.
For MacOS/Ubuntu and WSL2:
bash install.bash
For Windows:
bash install.bash win
Open the project in Unity Hub.
Note: Ensure that the Unity Editor version matches your CPU architecture.
Target folder: unity-drone-model\plugin\plugin-srcs
If a message about "Opening Project in Non-Matching Editor Installation" appears, click "Continue."
In the following dialog, click Continue
.
Next, ignore the following dialog.
If successful, you will see this.
Upon initial launch, there may be many errors in the console due to the following reasons. Please follow the links to address them sequentially:
- Missing Newtonsoft.Json
- Error with gRPC library usage (Mac or Linux)
Double-click the Unity scene (Assets/Scenes/ApiDemo
) as shown below.
Click Window
-> Hakoniwa
-> Generate
.
If successful, you will see JSON logs in the console without any error logs.
For Windows, this operation must be repeated after every machine reboot.
The generated configuration files will be located directly under hakoniwa-unity-drone-model\plugin\plugin-srcs
.
- core_config.json
- custom.json
The output of custom.json is as follows:
{
"robots": [
{
"name": "DroneTransporter",
"rpc_pdu_readers": [],
"rpc_pdu_writers": [],
"shm_pdu_readers": [
{
"type": "hako_mavlink_msgs/HakoHilActuatorControls",
"org_name": "drone_motor",
"name": "DroneTransporter_drone_motor",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduReader",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduReaderConverter",
"channel_id": 0,
"pdu_size": 112,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "geometry_msgs/Twist",
"org_name": "drone_pos",
"name": "DroneTransporter_drone_pos",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduReader",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduReaderConverter",
"channel_id": 1,
"pdu_size":
72,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/ManualPosAttControl",
"org_name": "drone_manual_pos_att_control",
"name": "DroneTransporter_drone_manual_pos_att_control",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 3,
"pdu_size": 80,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoDroneCmdTakeoff",
"org_name": "drone_cmd_takeoff",
"name": "DroneTransporter_drone_cmd_takeoff",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 5,
"pdu_size": 64,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoDroneCmdMove",
"org_name": "drone_cmd_move",
"name": "DroneTransporter_drone_cmd_move",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 6,
"pdu_size": 80,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoDroneCmdLand",
"org_name": "drone_cmd_land",
"name": "DroneTransporter_drone_cmd_land",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 7,
"pdu_size": 64,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/GameControllerOperation",
"org_name": "hako_cmd_game",
"name": "DroneTransporter_hako_cmd_game",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 8,
"pdu_size": 136,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoCmdCamera",
"org_name": "hako_cmd_camera",
"name": "DroneTransporter_hako_cmd_camera",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 9,
"pdu_size": 44,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoCmdCameraMove",
"org_name": "hako_cmd_camera_move",
"name": "DroneTransporter_hako_cmd_camera_move",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 11,
"pdu_size": 64,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoCmdMagnetHolder",
"org_name": "hako_cmd_magnet_holder",
"name": "DroneTransporter_hako_cmd_magnet_holder",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 13,
"pdu_size": 40,
"write_cycle": 1,
"method_type": "SHM"
}
],
"shm_pdu_writers": [
{
"type": "hako_msgs/Collision",
"org_name": "drone_collision",
"name": "DroneTransporter_drone_collision",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 2,
"pdu_size": 304,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/Disturbance",
"org_name": "drone_disturbance",
"name": "DroneTransporter_drone_disturbance",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 4,
"pdu_size": 32,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoCameraData",
"org_name": "hako_camera_data",
"name": "DroneTransporter_hako_camera_data",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 10,
"pdu_size": 102968,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoCameraInfo",
"org_name": "hako_cmd_camera_info",
"name": "DroneTransporter_hako_cmd_camera_info",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 12,
"pdu_size": 56,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "hako_msgs/HakoStatusMagnetHolder",
"org_name": "hako_status_magnet_holder",
"name": "DroneTransporter_hako_status_magnet_holder",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 14,
"pdu_size": 32,
"write_cycle": 1,
"method_type": "SHM"
},
{
"type": "sensor_msgs/PointCloud2",
"org_name": "lidar_points",
"name": "DroneTransporter_lidar_points",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 15,
"pdu_size": 177400,
"write_cycle": 5,
"method_type": "SHM"
},
{
"type": "geometry_msgs/Twist",
"org_name": "lidar_pos",
"name": "DroneTransporter_lidar_pos",
"class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriter",
"conv_class_name": "Hakoniwa.PluggableAsset.Communication.Pdu.Raw.RawPduWriterConverter",
"channel_id": 16,
"pdu_size": 72,
"write_cycle": 5,
"method_type": "SHM"
}
]
}
]
}