How elena-ecn/quadrotor_mpc works
Main Components
• Core MPC Controller: Represented by mpc.py – this module computes the optimal control inputs using the MPC formulation described in the README.
• Simulation/Main Process: main.py is the entry point. It ties together the setup, MPC computations, and simulation loop.
• Configuration Module: config.py that stores parameters and settings used across the simulation.
• Plotting and Visualization: plotter.py, which handles results visualization and potentially feeding data into animations.
• Utility Functions: utils.py provides helper methods that support various parts of the simulation.
• Animation Module: The Animation directory holds resources to animate quadrotor trajectories. Inside, there are a Jupyter notebook (quadrotor_animation.ipynb) and scripts (e.g., utils/quadrotor.jl) which indicate a secondary pipeline (based on Julia) for either advanced animation or postprocessing.
• Data Files: CSV files (X_quadrotor.csv, X_ref.csv) in the Animation folder, which likely store simulation trajectories or reference data.
Understand the Relationships and Data Flow
• main.py acts as the orchestrator:
• It likely loads configuration parameters from config.py.
• Calls mpc.py to compute control actions at each time step.
• Uses utils.py to support simulation calculations.
• Sends generated data to plotter.py, which then visualizes the quadrotor's performance.
• The MPC algorithm computes trajectories based on optimization (with cvxpy) and prints or logs results.
• The Animation module takes simulation output (or stored CSV files) to generate an animated view of the quadrotor flight, emphasizing the differences between the executed trajectory and the reference trajectory.
• The images directory provides static images (like drone_image.png) that are used in the README and might be used within the visualization modules.
Architectural Patterns and Design Principles
• Separation of Concerns: Each component (MPC, simulation orchestration, plotting, and animation) is organized into its own module/directory.
• Modularity: Utility functions, configurations, and specialized tasks (like animation) are separated, allowing easy updates and testing.
• Multi-Language Integration: Note the use of Python for control and simulation and Julia for animation (if the Julia scripts in Animation/utils are actively used).