This repo is still under development. We are also actively looking for users and developers. If this sounds like you, get in touch!

Lifting Surfaces#

Description#

Mathematical Model#

Class Description#

class PyFlyt.core.abstractions.LiftingSurface(p: BulletClient, physics_period: float, np_random: RandomState, uav_id: int, surface_id: int, lifting_unit: ndarray, forward_unit: ndarray, Cl_alpha_2D: float, chord: float, span: float, flap_to_chord: float, eta: float, alpha_0_base: float, alpha_stall_P_base: float, alpha_stall_N_base: float, Cd_0: float, deflection_limit: float, tau: float)#

Used to represent a single lifting surface.

The Lifting Surface component is used to simulate a single lifting surface based on “Real-time modeling of agile fixed-wing uav aerodynamics, Khan et. al.”.

Parameters:
  • p (bullet_client.BulletClient) – PyBullet physics client ID.

  • physics_period (float) – physics period of the simulation.

  • np_random (np.random.RandomState) – random number generator of the simulation.

  • uav_id (int) – ID of the drone.

  • surface_id (int) – an integer for the link ID for this lifting surface.

  • lifting_unit (np.ndarray) – (3,) unit vector representing the direction of lift.

  • forward_unit (np.ndarray) – (3,) unit vector representing the direction of travel.

  • Cl_alpha_2D (float) – lift coefficient slope under a no-stall condition.

  • chord (float) – chord of the lifting surface.

  • span (float) – span of the lifting surface.

  • flap_to_chord (float) – ratio of the wing that is an actuated flap, can be in [0, 1].

  • eta (float) – correction factor for viscosity effects, usually 0.65.

  • alpha_0_base (float) – zero lift angle-of-attack.

  • alpha_stall_P_base (float) – positive stall angle in degrees.

  • alpha_stall_N_base (float) – negative stall angle in degrees.

  • Cd_0 (float) – drag coefficient at zero angle-of-attack.

  • deflection_limit (float) – maximum deflection limit of the actuated flap in degrees.

  • tau (float) – actuation ramp time constant.

get_states() float#

Gets the current state of the components.

Returns:

the level of deflection of the surface.

Return type:

float

physics_update(cmd: float)#

Converts a commanded actuation state into forces on the lifting surface.

Parameters:

cmd (float) – normalized actuation in [-1, 1].

Returns:

vec3 force, vec3 torque

Return type:

tuple[np.ndarray, np.ndarray]

reset()#

Reset the lifting surfaces.

state_update(surface_velocity: ndarray)#

Updates the local surface velocity of the lifting surface.

Parameters:

surface_velocity (np.ndarray) – surface_velocity.

class PyFlyt.core.abstractions.LiftingSurfaces(lifting_surfaces: list[LiftingSurface])#

Handler for multiple lifting surfaces.

This is a convenience class for handling multiple lifting surfaces as a single object. Simply pass it a list of LiftingSurface objects.

Parameters:

lifting_surfaces (list[LiftingSurface]) – a list of LiftingSurface objects.

get_states() ndarray#

Gets the current state of the components.

Returns:

a (num_surfaces, ) array representing the actuation state for each surface

Return type:

np.ndarray

physics_update(cmd: ndarray)#

Converts actuation commands into forces on the lifting surfaces.

Parameters:

cmd (np.ndarray) – the full command array, command mapping is handled through command_id and command_sign on each surface, normalized in [-1, 1].

reset()#

Resets all lifting surfaces.

state_update(rotation_matrix: ndarray)#

Updates all local surface velocities of the lifting surface, place under update_state.

Parameters:

rotation_matrix (np.ndarray) – (3, 3) OR (num_surfaces, 3, 3) array rotation_matrix