Creating a Digital Twin for drone simulation

Could somebody guide me in the direction of creating a digital twin for a drone simulation where the drone is used to measure the humidity of the forest. I’m a newbie here and any advice would be helpful.
Can I do it using ardupilot or should I use something like matlab?
Thanks

ArduPilot SITL is the perfect software to simulate the drone. It is the digital twin that you are searching for.

2 Likes

Thanks and a side question. I want to be able to use the ardupilot to measure the humidity like i mentioned. Is that possible? How much can I manipulate to create an interface to input optimization algorithms to fly.

You can create “missions” with waypoints, and the vehicle will fly those waypoints sequentially.
Your software will ask the drone for it`s position using the mavlink protocol, and using the position will ask your humidity model for the humidity value at that location.

This will allow very realistic data gathering simulations.

I have used QGroundControl to create static missions and I can see the working in the Gazebo Simulation. Now how can I add sensor modules and make it more dynamic?

Use Lua scripting Lua Scripts — Copter documentation

If you are using Gazebo for simulation you have the option to create custom sensors. You would also need to create an environment for the sensor to read. In your case a scalar humidity field. The procedure for creating environments is not well documented (there are tutorials for creating a custom sensor). The questions is what you then do with the sensor data, do you want to feed it back from the simulation to the FCU for it to log, or do you see the logging happening on a companion computer?

I think the companion computer is better for later analysis right?
How can I create these custom sensors? is it possible using python scripts? Could you share the resources for this.

I think the companion computer is better for later analysis right?

All depends on what you’re trying to do. If you just want to log data and don’t need the information for flight then it doesn’t make sense to send it to the flight controller, unless you need the controller to operate on the data coming from the sensor.

Gazebo tutorials here: Gazebo Sensors: Custom sensors

There is a lot of documentation for the new Gazebo, but you need to fish around a bit.

The hard problem is creating a system for the environment that the sensor will read. This would involve getting into the details of Gazebo, or getting someone to do it for you.