Boosters#

Description#

The Boosters component is used to simulate a list of fueled boosters. Fueled boosters are propulsion units that rely on the presence of available fuel from a fuel tank in order to generate thrust. They generate no torque around the thrust axis.

The booster is parameterized with booster_ids and fueltank_ids, where the thrust acts on the links indicated by booster_ids and the mass properties of the fuel tanks are modified according to the indices specified in fueltank_ids. Additionally, the boosters have a reignitable option, specifying whether the booster can be extinguished and then reignited or not — a trait unique to liquid fuel boosters.

It takes several steps for the ignition and pwm command to be transformed into a thrust value:

  1. If there is no fuel remaining, the target_duty_cycle is always 0. Likewise, if the booster is not ignited, target_duty_cycle is also 0. If the booster is lit and there is available fuel, target_duty_cycle = min_thrust + (min_thrust / max_thrust) * pwm.

  2. The actual duty cycle of the rocket depends on the ramp up time constant, actual_duty_cycle += 1 / physics_hz / tau * (target_duty_cycle - actual_duty_cycle).

  3. The thrust of the rocket then depends on the actual duty cycle plus some noise, thrust = (actual_duty_cycle * max_thrust) * (1 + noise * noise_ratio). noise is sampled from a standard Normal.

Fuel burn is calculated proportional to the amount of thrust relative to maximum thrust, fuel_burn = thrust / max_thrust * max_fuel_burn. The mass and inertia properties of the fuel tank are then proportional to the amount of fuel remaining.

The booster additionally accepts a rotation matrix argument in physics_update. This allows the thrust of the booster to be redirected. Conveniently, the Gimbals component outputs this exact rotation matrix.

Class Description#

class PyFlyt.core.abstractions.Boosters(p: BulletClient, physics_period: float, np_random: Generator, uav_id: int, booster_ids: ndarray | list[int], fueltank_ids: ndarray | list[None | int], tau: ndarray, total_fuel_mass: ndarray, max_fuel_rate: ndarray, max_inertia: ndarray, min_thrust: ndarray, max_thrust: ndarray, thrust_unit: ndarray, reignitable: ndarray | list[bool], noise_ratio: ndarray)#

Vectorized implementation of a series of fueled boosters.

The Boosters component is used to represent an array of fueled boosters, each at arbitrary locations with different parameters. Fueled boosters are propulsion units that produce no meaningful torque around their thrust axis and have limited throttleability. More crucially, they depend on a fuel source that depletes with usage, changing the mass and inertia properties of the drone. Additionally, some boosters, typically of the solid fuel variety, cannot be extinguished and reignited, a property we call reignitability.

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

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

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

  • uav_id (int) – ID of the drone.

  • booster_ids (np.ndarray | list[int]) – list of integers representing the link index that each booster should be attached to.

  • fueltank_ids (np.ndarray | list[None | int]) – list of integers representing the link index for the fuel tank that each booster is attached to.

  • tau (np.ndarray) – list of floats representing the ramp up time constant of each booster.

  • total_fuel_mass (np.ndarray) – list of floats representing the fuel mass of each fuel tank at maximum fuel.

  • max_fuel_rate (np.ndarray) – list of floats representing the maximum fuel burn rate for each booster.

  • max_inertia (np.ndarray) – an (n, 3) array representing the diagonal elements of the moment of inertia matrix for each fuel tank at full fuel load.

  • min_thrust (np.ndarray) – list of floats representing the thrust output for each booster at a minimum duty cycle that is NOT OFF.

  • max_thrust (np.ndarray) – list of floats representing the maximum thrust output for each booster.

  • thrust_unit (np.ndarray) – an (n, 3) array representing the unit vector pointing in the direction of force for each booster, relative to the booster link’s body frame.

  • reignitable (np.ndarray | list[bool]) – a list of booleans representing whether the booster can be extinguished and then reignited.

  • noise_ratio (np.ndarray) – a list of floats representing the percent amount of fluctuation present in each booster.

get_states() ndarray#

Gets the current state of the components.

Returns a (a0, a1, …, an, b0, b1, … bn, c0, c1, … cn) array where: - (a0, a1, …, an) represent the ignition state - (b0, b1, …, bn) represent the remaining fuel ratio - (c0, c1, …, cn) represent the current throttle state

Returns:

A (3 * num_boosters, ) array

Return type:

np.ndarray

physics_update(ignition: ndarray, pwm: ndarray, rotation: None | ndarray = None)#

Converts booster settings into forces on the booster and inertia change on fuel tank.

Parameters:
  • ignition (np.ndarray) – (num_boosters,) array of booleans for engine on or off.

  • pwm (np.ndarray) – (num_boosters,) array of floats between [0, 1] for min or max thrust.

  • rotation (np.ndarray) – (num_boosters, 3, 3) rotation matrices to rotate each booster’s thrust axis around, this is readily obtained from the gimbals component.

reset(starting_fuel_ratio: float | ndarray = 1.0)#

Reset the boosters.

Parameters:

starting_fuel_ratio (float | np.ndarray) – ratio amount of fuel that the booster is reset to.

state_update()#

This does not need to be called for boosters.