# TASK-1:UAV Assembly & Flight Controller Configuration
**Objective:**
- To collaboratively assemble and configure a fully functional quadcopter with GPS, receiver, and flight controller integration.
- Bind the drone to the Radiomaster RP1 receiver and control it using the TX16S transmitter.
- Interface the Mission Planner software with the flight controller using a USB connection.
- Connect a GPS module to the flight controller and configure it.
- Calibrate all sensors (accelerometer, compass) and radio inputs.
**Outcomes and Learnings**
[Click here](https://github.com/Arpit1378/MARVEL-TASKS-/blob/main/Level-2/UAV%20Assembly/Report.pdf) to access the report.
# TASK-2: Autonomous Flight Planning & Execution:
**Objectives:**
- To understand and practice autonomous flight mission planning using Mission Planner and the ArduPilot simulator.
- Learn about the Heads Up Display (HUD) available in the Mission Planner.
- Using the built-in Ardupilot simulator (SITL), plan and execute a geofence around UVCE and test a small autonomous mission.
**Outcomes and Learnings:**
## Heads Up Display (HUD)
The HUD gives an instant overview of the drone’s flight condition, without needing to look at separate readings or menus.
It shows important information right in front of us, so we can monitor flight status at a glance. \

1. **Airspeed (Groundspeed if no airspeed sensor is fitted)** : Airspeed is how fast the drone is moving through the air. \
If there’s no airspeed sensor, Mission Planner shows Groundspeed, i.e., how fast the drone moves over the ground.
2. **Crosstrack error and turn rate (T)** : Crosstrack Error shows the sideways distance from the planned flight path. A large error means the drone has drifted off course. \
Turn Rate shows how fast the drone is turning (in degrees per second).
3. **Heading direction** : The direction the drone’s nose is pointing, measured in degrees (0° = North, 90° = East, etc.).
4. **Bank angle** : The tilt of the drone’s wings (left/right). \
Positive = banking right, Negative = banking left.
5. **Telemetry connection link quality (averaged percentage of good packets)** : Shows how reliable the radio link is between drone and ground station. \
Displayed as an average % of good data packets received. \
High value (>90%) = strong link, low value = weak or unstable connection.
6. **GPS time** : The accurate universal time from GPS satellites.
7. **Altitude (Blue bar is the rate of climb)** : Altitude displays current height above the takeoff point or sea level. \
Blue Bar shows climb or descent rate — how fast the drone is going up or down.
8. **Airspeed** : The speed of air flowing over the drone.
9. **Groundspeed** : The actual speed relative to the ground, from GPS data.
10. **Battery status** : Shows voltage, current, and remaining battery percentage. It
helps monitor power consumption and prevent sudden shutdowns.
11. **Artificial Horizon** : A visual display showing drone pitch and roll, like in an aircraft cockpit.
12. **Aircraft Attitude** : Numeric values for pitch, roll, and yaw angles of the drone. It
indicates exact orientation in 3D space.
13. **GPS Status** : It shows how strong and accurate the GPS signal is and how many satellites are helping to track the drone’s position.
14. **Distance to Waypoint > Current Waypoint Number** : \
*Distance to Waypoint:* How far the drone is from the next waypoint. \
*Current Waypoint Number:* The index of the waypoint being targeted in the mission plan.
15. **Current Flight Mode** : Shows which mode the drone is flying in (e.g., Stabilize, Loiter, Auto, RTL, Guided).
## Flight Operation
**Prerequisite:** Go to Simulation Tab, select Multirotor, download the sitl software, and connect the MAVlink. \
MAVLink is a communication protocol — a set of digital “rules” that define how information is exchanged between the drone’s flight controller and the Ground Control Station (GCS) such as Mission Planner.
1. Go to Flight Plan tab.
2. Add a TAKEOFF command as the first waypoint:
4. Set the altitude.
5. Add other waypoints for flight path.
6. Write WPs → upload mission to the drone.
7. Set Mode → AUTO.
8. Arm and press “Auto” to start the mission.
The drone will:
Take off, reach the altitude, continue to next waypoints, and the land at the entered waypoint.
## Surveying

Surveying is mainly used for aerial mapping, land surveying. \
**Process**:
1. Open Mission Planner.
2. Go to the Flight Plan tab.
3. Right-click on the map → choose “Draw Polygon” → “Add Polygon Point” to mark your survey area.
**Video of the above task**
<iframe width="718" height="380" src="https://www.youtube.com/embed/WGJvctrQth0?list=PLN5iTpKS9zTnxFYZch9ipEpEiBg9poPkI" title="Mission Planner Task | MARVEL Level-2" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
# TASK-3:Introduction to MATLAB
**Objective:** To gain foundational knowledge of MATLAB and Simulink. \
**Outcomes and Learnings:**
### MATLAB Onramp Course
I learned the basics of MATLAB. \
[This](https://github.com/Arpit1378/MARVEL-TASKS-/blob/main/Level-2/MATLAB%20and%20Simulink/MATLAB/MATLAB%20Onramp%20Quick%20Reference.pdf) is the summary of what I learnt. \
The **final project** in MATLAB was to determine how fast a star is moving away from Earth by analyzing its spectral data.
This uses the Doppler Effect - when light waves stretch (redshifted) as the source moves away. \

Below is the certificate of completion of the MATLAB Onramp Course.

### Simulink Onramp Course
This course was about creating and connecting blocks, using signals, applying mathematical operations, and integrating MATLAB functions to build some basic projects, like modeling a thermostat or a falcon’s dive to reinforce concepts. \
.jpg?raw=true)
# TASK-4: Advanced PID Tuning
**Objective:**
- To develop a strong understanding of PID controllers and their application in UAV stability and autonomous control systems.
- Connect a UAV to Mission Planner and observe the default PID values for roll, pitch, and yaw.
- Build a self-balancing car that operates using PID control principles.
**Outcomes and Learnings**
P – Proportional
- Reacts to the current error.
- The bigger the error, the bigger the correction.
I – Integral
- Reacts to the accumulated past error.
- Helps eliminate long-term steady-state error.
D – Derivative
- Reacts to the rate of change of error.
- Predicts future error, helps with stability and response speed.
[Basics of PID](https://github.com/Arpit1378/MARVEL-TASKS-/blob/main/Level-2/PID/notes.pdf)


### **PID Tuning in Mission Planner**
1. *Proportional* : Increase P until the drone starts to oscillate rapidly after the input.
2. *Derivative* : If the drone overshoots or "hiccups" before leveling, increase D slowly.
3. *Integral* : If the drone slowly drifts away from the angle you set, increase I.
**The Tuning Graph** provides objective data by overlaying the stick commands (Desired) against the drone's physical response (Actual), pinpointing exactly where the controller is lagging or overshooting.
It allows us to detect high-frequency oscillations that are invisible to the naked eye but visible as "fuzz" on the graph, preventing motor damage from an over-tuned Derivative (D) gain.
By visualizing the "unwinding" of the error, it helps to perfectly balance the Integral (I) gain to ensure the drone holds its position against wind without drifting.
# TASK-5: Rules in the Rule Book written by Blood
**Objectives:** \
-- Write a detailed report of the air crash investigation, the report should include: \
-- Details of the flight, place, time, pilot details and an introductory paragraph about the accident which occurred /was about to occur including the losses occurred. \
-- Explain in brief about the aircraft. \
-- Using the Swiss Cheese Model analyze the key contributing factors (technical, human, environmental etc.) and also explain how each of these factors (layers of the Swiss Cheese) accelerated the accident when aligned together. \
-- State the various theories and assumptions which took place during the investigation and also mention the reasons which led to the elimination/confirmation of these theories. \
-- Reflect on what lessons were learned and how aviation standards changed post accident. \
**Outcomes and Learnings:** \
I learned about *Charkhi Dadri Mid Air Collison* that occured over Delhi airspace on 12th November 1996.
[Click here](https://github.com/Arpit1378/MARVEL-TASKS-/blob/main/Level-2/Air%20Crash/Air%20Report.docx) to view the Air Crash Report.
This video explains how the two planes collided.
<iframe width="756" height="425" src="https://www.youtube.com/embed/00UFJ7RLW54" title="Charkhi Dadri Mid-Air Collision | Blender Crash Animation" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
**Reference:**
[Charkhi Dadri Mid Air Collision](https://youtu.be/y2_oR6OdSKg) \
[Visual Representation of the Crash](https://www.youtube.com/watch?v=00UFJ7RLW54)
# TASK-6 : Flight Data Logging & Analysis
**Objectives:**\
-- Extract log files from a Pixhawk/APM flight controller. \
-- Analyze flight stability, GPS accuracy, battery performance using Mission Planner. \
-- Generate graphs for: \
Altitude vs time. \
Throttle & Battery vs time consumption. \
Velocity vs time \
--Suggest improvements based on data trends. \
--Also convert the .bin log files to kml+gpx formats and upload the obtained kmz files to Google Earth to view the 3D path followed by the drone. Try to simulate the same flight path on Google Earth using the kmz files, state the problems faced if any.
**Outcomes and Learnings:** \
Dataflash logs are stored directly on the autopilot (like an SD card) for detailed, post-flight analysis. \
It is mainly used for post-flight analysis and crash investigation. \
Telemetry logs (Tlogs) are recorded in real-time by the ground station software (e.g., Mission Planner) over the wireless link, capturing similar data but from the ground perspective, allowing for immediate review and live monitoring. \
Both serves similar diagnostic purposes but differ in storage location and primary use case. \
Tlogs can serve as a backup if Dataflash logging fails.
**Necessity of Logs**: Air crash investigations rely heavily on flight data recorders. \
-- Pixhawk/APM logs act as a mini flight data recorder. \
By analyzing logs, we understand:
1. Stability issues
2. Sensor inaccuracies
3. Power failures
4. Control anomalies
This reflects real aviation safety investigations.
**Process**:
1. In Mission Planner, in DATA section, just below the HUD Display, click on Dataflash Log.
2. Under that, click on *Review a Log* option and upload the file.
3. Log Browser window will open. Now, the required graphs can be plotted by setting suitable options.
### **LOG Analysis**
**Auto Log**
It automatically records telemetry data on the ground station whenever the vehicle is connected, without any manual action from the user.
**Review a Log**
It is used to open and analyze an already recorded log file (such as .bin) to study flight parameters, generate graphs, and investigate vehicle performance after the flight.
## 1. AMS Log
### **Auto Log**

### **Altitude vs Time**

**CTUN Alt (Control Tuning Altitude)** is the altitude that the flight controller is using for control decisions. \
**AHR2 (Attitude Heading Reference System 2)** provides detailed data from the second Attitude Heading Reference System (AHRS) estimator, which is a system used to determine the vehicle's orientation and position. \
**Graph Explanation** \
Almost smooth increasing slope → Controlled takeoff \
Flat region → Hover / Loiter mode \
Smooth decreasing slope → Controlled landing \
-- **Aviation Safety Connection** \
In real aircraft, abnormal altitude variations indicate:
1. Autopilot malfunction
2. Sensor failure
3. Pilot control error
**A stable altitude curve indicates good vertical control and sensor reliability.**
### **Throttle & Battery vs Time consumption**

This graph represents how much motor power (throttle output) is being used over time.
1. **Volt** represents instantaneous battery voltage measured by the power module.
2. **CurrTot (Total Current Consumed)** represents total battery capacity consumed since arming in mAh (milliamp-hours). \
*Example* - CurrTot = 2200 mAh means battery supplies a continuous current of 2200 milliamperes (mA), or 2.2 amps (A), for exactly one hour.
3. ThH (Throttle Hover) represents estimated throttle required to maintain hover. \
Normalized throttle ranges from 0 to 1.
### Aviation Safety Connection
1. Similar to engine thrust data in aircraft accident analysis
2. Abnormal thrust changes often indicate:
Control system failure
Aerodynamic instability
> **Smooth throttle variation reflects efficient and stable flight control.**
### **Velocity vs Time**

This graph represents ground speed of the drone.
The velocity remains near zero before takeoff, increases smoothly to a maximum of about 10 m/s during mission execution, and drops periodically at waypoints due to turning of the drone. \
The repeated rise–fall pattern corresponds to the automated survey (lawn-mower) flight path. \
The absence of erratic spikes or sudden speed loss indicates stable navigation, reliable GPS data, and healthy propulsion performance throughout the flight.
### Aviation Safety Connection
Speed anomalies are critical in crash investigations. \
Loss of airspeed = loss of lift (in fixed-wing UAVs) \
> **Consistent velocity indicates predictable flight dynamics.**
## 2. Simulator Log
### Simulator Auto Log

### **Altitude vs Time**

This graph shows the altitude used by the flight controller for control. \
The altitude stays near 0 m initially, indicating the vehicle is on the ground, during **STABILISE mode** (indicated by Pink Color). \
A sharp rise to about 150 m represents the takeoff and rapid climb phase, during **AUTO mode** (indicated by light blue color). \
Such a steep change is typical in simulator or auto-mission flights, where altitude is commanded quickly.
### **Throttle vs Time**

This graph shows the actual throttle output commanded by the flight controller. \
The throttle remains near 0 initially, indicating the vehicle is on the ground or disarmed. \
A sharp rise to about 0.45–0.48 corresponds to takeoff and climb, where higher throttle is required.
### **Battery Consumption vs Time**

This graph shows the total battery capacity consumed (in mAh) since arming. \
The flat line at the start indicates no power draw while the vehicle is on the ground. \
The sharp upward rise corresponds to takeoff and active flight, where current is being drawn continuously. \
The final value (~1740 mAh) represents the **total energy used during the flight**. \
### **Battery Voltage vs Time**

This graph shows the instantaneous battery voltage during the flight.
The voltage remains constant at around 12.6 V, indicating a stable and lightly loaded battery.
No voltage dip is visible, which suggests low current draw or a simulated flight.
In a real flight, a slight voltage drop during takeoff and climb would normally be observed.
### **Velocity vs Time**

This graph shows the ground speed of the vehicle during the flight.
The speed remains near 0 m/s initially, indicating the vehicle is stationary on the ground.
A sharp rise to about 10 m/s corresponds to the start of movement along the mission path.
The brief fluctuations reflect acceleration, turns, and speed corrections during autonomous flight.
## 3. **Crash Log**
### Crash Auto Log

### Altitude vs Time

This graph shows that the altitude remains below zero throughout the log.
The vehicle never gains positive altitude, indicating no successful takeoff.
Small fluctuations suggest minor throttle inputs or sensor noise while staying on the ground.
This behavior is consistent with a failed takeoff or crash shortly after arming.
## **3D Flight Path**
## 1. Lawn Mower Path

This is the 3D map of the flight path followed by the drone.
### Elevated Profile
<iframe width="718" height="379" src="https://www.youtube.com/embed/tWsTNuYp8Kg" title="TASK - Elevation Profile of Lawn Mower Path" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
Elevation profile in Mission Planner shows how the ground/terrain height changes along the flight path.
It helps ensure the planned altitude stays safely above terrain to avoid collisions.
### 3D Flight Tour
<iframe width="720" height="379" src="https://www.youtube.com/embed/tDaFeKkIuX4" title="3D Flight Tour of Lawn Mower Path" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
3D Flight Tour in Mission Planner shows the aircraft’s recorded flight path in a Google Earth–style 3D view.
It helps visualize altitude, turns, and terrain interaction during the entire flight.
## 2. UVCE


### 3D Flight Tour
<iframe width="674" height="379" src="https://www.youtube.com/embed/uYzGk-Tl5TE" title="3D Flight Tour UVCE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
# TASK-7 : Introduction to ROS 2 for UAVs
**Objective**
- Install and set up Ubuntu 22.04 and ROS 2 Humble Hawksbill.
- Learn the basics of:
Nodes
Topics
Publishers
Subscribers
- Create a Publisher Node that sends fake drone altitude data
- Create a Subscriber Node that reads and displays this altitude data in real-time (OPTIONAL)
- Modify the Publisher node to also publish Battery Level data along with the altitude.
**Outcomes and Learnings**
**ROS 2 (Robot Operating System 2)** is an open-source framework used to build robot and drone software.
It allows different parts of a robot/drone to communicate with each other.
It uses a distributed architecture (multiple programs running together).
- In UAV context, ROS 2 can manage:
-- Altitude data
-- Battery status
-- GPS data
-- Obstacle sensors
-- Node
A **Node** is a single executable program in ROS 2.
Each node performs one specific task.
Examples:
Altitude sensor node
Battery monitoring node
Motor control node
In the task :
*Publisher Node* - Generates fake altitude & battery data
*Subscriber Node* - Reads and displays that data
A **Topic** is a named communication channel used by nodes to exchange data.
Example :
/altitude
/battery
A **Publisher** is a node that sends data to a topic.
It does NOT know who receives the data.
It sends data continuously or periodically.
Example : Altitude Publisher → /altitude topic
A **Subscriber** is a node that receives data from a topic. It reacts whenever new data arrives.
**Installation**
I installed Ubuntu 22.04 using Windows Powershell.

Publisher Code (sourced from ChatGPT)

Subscriber Code (sourced from ChatGPT)

Final Graph

Here, drone data refers to drone altitude and drone battery.
Full video of the task done.
<iframe width="756" height="425" src="https://www.youtube.com/embed/8-HFDvxEBVc" title="Introduction to ROS2 | MARVEL Level-2" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
# TASK-8 : Special Assignment
**Objective**
- Identify one organisation/company/institution with which MARVEL can collaborate.
**Outcomes**
Abhiyantha company offers a program, namely **University Tech Bytes**.
- Free and paid lab-experiment sessions regarding electronics and VLSI.
- Hands-on experience with industry tools and software-based learning.
- Expert-led technical sessions on core topics.