uav.vehicles.VTOL#

Classes#

VTOL

VTOL UAV implementation with MC/FW mode switching.

Module Contents#

class VTOL(node: rclpy.node.Node, DEBUG=False, camera_offsets=[0, 0, 0], vehicle_name: str = 'uav')#

Bases: uav.vehicles.UAV.UAV

VTOL UAV implementation with MC/FW mode switching. Handles both multicopter and fixed-wing flight modes.

vehicle_type = None#
vtol_vehicle_status = None#
_fw_takeoff_phase = 0#
attempted_takeoff = False#
property is_vtol: bool#

VTOL aircraft can transition between MC and FW modes.

fixed_wing_takeoff(fw_tko_pitch: float = float('nan'), yaw: float = float('nan'), latitude: float = float('nan'), longitude: float = float('nan'), altitude: float = float('nan'))#
Simple horizontal VTOL takeoff:
  1. request transition to FW

  2. wait until vehicle_type == ‘FW’

  3. send NAV_TAKEOFF to target altitude

Call this repeatedly from ModeManager until it returns True. :param fw_tko_pitch: float = float(‘nan’), # fw_tko_pitch min (minimum pitch during takeoff) :param yaw: float = float(‘nan’), # Yaw angle (in degrees) :param latitude: float = float(‘nan’), # Latitude (in GPS coords) :param longitude: float = float(‘nan’), # Longitude (in GPS coords) :param altitude: float = float(‘nan’), # Altitude (in meters)

vtol_transition_to(vtol_state, immediate=False)#

Command a VTOL transition. Following https://mavlink.io/en/messages/common.html#MAV_CMD_DO_VTOL_TRANSITION :param vtol_state: The desired VTOL state (‘MC’ or ‘FW’). :type vtol_state: str :param immediate: If True, the transition should be immediate. :type immediate: bool

_calculate_velocity(target_pos: tuple, lock_yaw: bool) list#

Calculate velocity switching between FW (forward velocity) and MC (proportional) modes. :param target_pos: (x, y, z) target position in local frame :param lock_yaw: Whether yaw is locked (hovering)

Returns:

[vx, vy, vz] velocity list in m/s

_get_fw_forward_velocity()#

Get forward velocity vector for FW mode to maintain lift. :returns: [vx, vy, vz] velocity vector in m/s :rtype: list

_vtol_vehicle_status_callback(msg: px4_msgs.msg.VtolVehicleStatus)#

Callback for VTOL vehicle status updates. Updates vehicle_type based on the actual VTOL state.

_initialize_publishers_and_subscribers()#

Initialize ROS 2 publishers and subscribers. Extends parent to add VTOL-specific subscriber.