Skip to content

Simulation

Mikołaj Kordowski edited this page May 24, 2021 · 2 revisions

Simulation uses Unity physics engine with a script that implements fluid dynamics. Also 3d model of the robot is added for correct collisions with objects.

Physics

Physics in Unity by default is accurate enough for games. For this simulation accuracy was improved by decreasing physics time step.

Thrusters

Thrusters in simulation have approximated thrust based on producer charts. Thrust is approximated with two quadratic equations. ax^2 + bx + c

x is motor fill {1100 < x < 1900}
          / x^2 * -0.0000180414 + x * 0.0591933468 - 48.035 {x < 1472}
thrust(x) \ x^2 * 0.0000281376 - x * 0.0799177935 + 56.449759077 {x > 1528}

Fluid dynamics

Every object that will be dynamic and is in the water has defined mass, volume, fluid dynamics constants, center of mass and center of volume. Those variables are needed to calculate correct dynamics in the water.

Graphics

Shaders

Shaders are used to give underwater effect to image. This helps testing and training YOLO. It is neural net that allows Okoń to see object in front of it. The most important ones are color correction that reduces reds in the image and fog which is responsible for limiting distance of seeing.

Camera

Camera settings in Unity are based on real values of the camera like sensor size and field of view.

Streaming

Camera renders to a Render texture, which is than copied to Texture2D and encoded to a JPG bytes.

Clone this wiki locally