Files
RDC_Simulation/config.py
2026-01-02 07:07:51 +00:00

104 lines
3.8 KiB
Python

# =============================================================================
# DRONE CONFIGURATION
# =============================================================================
DRONE = {
# Physical properties
"mass": 1.0, # kg
"size": (0.3, 0.3, 0.1), # (width, depth, height) in meters
"color": (0.8, 0.1, 0.1, 1.0), # RGBA (red)
# Starting position
"start_position": (0.0, 0.0, 5.0), # (x, y, z) in meters
# Control limits
"max_thrust": 1.0, # Maximum thrust command (-1 to 1)
"max_pitch": 0.5, # Maximum pitch command
"max_roll": 0.5, # Maximum roll command
"max_yaw": 1.0, # Maximum yaw command
# Thrust/torque scaling
"thrust_scale": 15.0, # Force multiplier for thrust
"pitch_torque_scale": 2.0, # Torque multiplier for pitch
"roll_torque_scale": 2.0, # Torque multiplier for roll
"yaw_torque_scale": 1.0, # Torque multiplier for yaw
}
# =============================================================================
# ROVER (LANDING PAD) CONFIGURATION
# =============================================================================
ROVER = {
# Physical properties
"size": (1.0, 1.0, 0.3), # (width, depth, height) in meters
"color": (0.2, 0.6, 0.2, 1.0), # RGBA (green)
# Starting position
"start_position": (0.0, 0.0, 0.15), # (x, y, z) in meters
# Movement patterns (for RoverController)
"default_pattern": "stationary", # stationary, linear, circular, square, random
"default_speed": 0.5, # m/s
"default_amplitude": 2.0, # meters (radius for circular, half-width for others)
}
# =============================================================================
# CAMERA CONFIGURATION
# =============================================================================
CAMERA = {
"width": 320,
"height": 240,
"fov": 60.0, # Field of view in degrees
"near_clip": 0.1, # Near clipping plane
"far_clip": 100.0, # Far clipping plane
"jpeg_quality": 70, # JPEG compression quality (1-100)
}
# =============================================================================
# PHYSICS CONFIGURATION
# =============================================================================
PHYSICS = {
"gravity": -9.81, # m/s² (negative = downward)
"timestep": 1.0 / 240.0, # Physics timestep (240 Hz)
"telemetry_rate": 24, # Telemetry updates per second
}
# =============================================================================
# NETWORK CONFIGURATION
# =============================================================================
NETWORK = {
"host": "0.0.0.0", # Listen on all interfaces
"command_port": 5555, # Port for receiving commands
"telemetry_port": 5556,# Port for sending telemetry
}
# =============================================================================
# LANDING DETECTION
# =============================================================================
LANDING = {
"success_distance": 0.5, # Maximum horizontal distance from pad center (m)
"success_velocity": 0.3, # Maximum landing velocity (m/s)
"height_threshold": 0.5, # Height considered "landed" (m)
}
# =============================================================================
# CONTROLLER GAINS (PD Controller)
# =============================================================================
CONTROLLER = {
# Altitude control
"Kp_z": 0.5, # Proportional gain for altitude
"Kd_z": 0.3, # Derivative gain for altitude
# Horizontal control
"Kp_xy": 0.3, # Proportional gain for horizontal position
"Kd_xy": 0.2, # Derivative gain for horizontal position
# Control rate
"rate": 50, # Control loop frequency (Hz)
}