0% found this document useful (0 votes)
3 views8 pages

Project Report India Space Lab.........

This document outlines a project from the India Space Lab Summer Internship focused on Guidance and Control using Python simulations for autonomous systems like drones and boats. It details the objectives, methodology, and results of two main tasks: controlling a drone's altitude with a PID controller and guiding a boat along a sine-wave path using a PD controller. The report also discusses challenges faced during the project and includes an optional task of simulating a drone tracking a figure-eight trajectory.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Project Report India Space Lab.........

This document outlines a project from the India Space Lab Summer Internship focused on Guidance and Control using Python simulations for autonomous systems like drones and boats. It details the objectives, methodology, and results of two main tasks: controlling a drone's altitude with a PID controller and guiding a boat along a sine-wave path using a PD controller. The report also discusses challenges faced during the project and includes an optional task of simulating a drone tracking a figure-eight trajectory.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Enrollment no.

:
1. Introduction & Objectives
This project was undertaken as part of the India Space Lab Summer Internship-II (CSE2504), under the broader theme
of
Advanced Drone Technology. The internship module, titled 'Introduction to Guidance and Control Using Python
Simulations,' was designed to give students a hands-on, practical understanding of how autonomous systems such as
drones and boats sense error, make decisions, and correct their motion in real time in the presence of external
disturbances.
Guidance and Control (G&C) is a foundational discipline in aerospace and robotics engineering. Every autonomous
vehicle -- whether a quadrotor drone, an uncrewed surface vessel, a satellite, or a self-driving car -- relies on a feedback
control loop that continuously measures the difference between where the vehicle currently is and where it is
supposed to be, and applies a corrective action to reduce that difference over time. This project explores two concrete,
simplified instances of this general problem: controlling a drone's vertical altitude against gravity and wind, and guiding
a surface vehicle (boat) along a prescribed path against water current. A third, optional task extends the same ideas to
a more complex curved trajectory.
The specific objectives of this project, as defined in the assignment brief, were to:
● Understand the fundamentals of Guidance and Control for autonomous moving systems.
● Learn the basics of PID (Proportional-Integral-Derivative) controller tuning.
● Observe the effect of environmental disturbances such as wind and water current on system stability and
tracking performance.
● Develop intuition behind feedback-based control systems through direct, hands-on experimentation rather
than purely theoretical study.
● Understand trajectory and path-following concepts used in autonomous vehicles such as drones and boats.
● Gain hands-on experience with Python-based simulations using Google Colab, including interactive widgets for
real-time parameter tuning.
The remainder of this report is organised as follows. Section 2 describes the software environment used. Section 3
covers Task 1, the PID-based drone altitude controller, including the underlying theory, implementation, tuning
methodology, and results. Section 4 covers Task 2, the autonomous boat guidance problem, following the same
structure. Section 5 presents an optional bonus extension to a figure-eight trajectory. Section 6 discusses challenges
encountered and lessons learned, and Section 7 concludes the report with a summary of outcomes and deliverables.

2. Environment Setup
The project was implemented entirely in Python using Google Colab, a cloud-hosted Jupyter notebook environment
that avoids the need for local software installation and provides free access to a shared compute runtime. This made
the assignment accessible without requiring students to configure a Python environment, install NumPy/Matplotlib
manually, or manage dependency versions.
The following libraries were used throughout the notebook:
● NumPy -- for numerical array operations and the core physics/control-loop integration.
● Matplotlib (pyplot and animation) -- for static result plots and animated visualisations of drone and boat
motion.
● ipywidgets (FloatSlider, interact, Button, Output) -- for building interactive sliders that allowed real-time
retuning of controller gains without editing code.
● Python's built-in random module -- used in Task 1 to generate the stochastic wind disturbance.
The provided starter notebook (Assignment_code.ipynb) was used as the base for all simulation logic. Rather than
rewriting the underlying physics or control equations, the approach taken was to run the provided functions directly,
observe their output, and iteratively adjust the exposed slider parameters (gains and disturbance magnitudes) until
satisfactory performance was achieved. This mirrors real-world controller commissioning, where an engineer is typically
handed a fixed plant model and instrumentation, and must find suitable gains through structured experimentation
rather than analytical re-derivation.

3. Task 1: PID Controller for Drone Altitude Control


This task simulates a drone attempting to reach and hold a target altitude of 10 metres using a PID controller. A 'No
Wind Zone' exists from 0-6 seconds, during which the drone's response can be observed under ideal, undisturbed
conditions. After 6 seconds, a wind disturbance is introduced, implemented as random noise sampled uniformly within
a range set by the Wind Noise slider. Gains were tuned in the order recommended by the assignment brief:
Proportional (P) first, followed by Derivative (D), and finally Integral (I).

3.1 Theoretical Background


A PID controller computes its output as the weighted sum of three terms, each responding to a different aspect of the
tracking error e(t) = setpoint - measured_value:
● Proportional (P): output proportional to the current error. A larger Kp produces a stronger, faster corrective
response, but excessive Kp can cause overshoot and oscillation.
● Integral (I): output proportional to the accumulated (summed) error over time. This term eliminates steady-
state error -- small persistent offsets that a purely proportional controller cannot remove -- but excessive Ki
can cause slow oscillations known as 'integral windup'.
● Derivative (D): output proportional to the rate of change of the error. This term anticipates future error and
adds damping, reducing overshoot and oscillation, but is sensitive to noise since it depends on a numerical
derivative.
In this simulation, the combined PID output represents a corrective thrust force. This is added to a fixed gravitational
offset (-9.8 m/s^2) and, after t = 6s, a random wind disturbance term, to produce the drone's net vertical acceleration.
This acceleration is numerically integrated (using simple Euler integration with a fixed timestep of 0.1s) to update the
drone's velocity and, subsequently, its altitude at each simulation step.

3.2 Methodology
At each simulation timestep, the controller computes the altitude error (target minus current altitude), accumulates
this error into a running integral term, and computes a derivative term as the change in error since the previous step.
These three terms, scaled by their respective gains, are summed to produce a thrust output. This output is combined
with gravity and, after t = 6s, the random wind disturbance, to determine the drone's acceleration, which is integrated
forward in time to update velocity and altitude. If the computed altitude fell below ground level (zero), both altitude
and velocity were reset to zero to prevent an unphysical negative-altitude result.
Tuning was carried out interactively: the Kp slider was adjusted first, with Ki and Kd held near their default values, until
the drone reached the target altitude reasonably quickly without excessive delay. Kd was then increased to reduce the
overshoot and oscillation introduced by a higher Kp. Finally, a small Ki was introduced to nudge the drone's steady-state
altitude fully onto the 10 m setpoint over the course of the simulation.

3.3 Tuning Process & Final Parameters


Several combinations were tested before settling on the following final tuned values:
● Kp (Proportional Gain) = 4.0
● Ki (Integral Gain) = 0.3
● Kd (Derivative Gain) = 3.0
● Wind Noise = 2.0
With these gains, the drone reached the 10 m target quickly with a maximum overshoot of approximately 0.58 m, and
recovered smoothly from the wind disturbance introduced at t = 6s.
Figure 1: Drone Altitude PID Response (Kp=4.0, Ki=0.3, Kd=3.0)

3.4 Results & Discussion


As shown in Figure 1, the drone climbs from ground level to the 10 m target within approximately 1 second, with a
small, well-damped overshoot before settling. Once the wind disturbance zone begins at t = 6s (shaded grey in the
plot), the altitude trace shows small, irregular perturbations consistent with the random nature of the disturbance --
unlike a constant force, random noise does not push the drone persistently in one direction, so the controller is able to
keep the average altitude close to the setpoint throughout the disturbance window, with only minor visible jitter. This
behaviour is expected: because the noise is resampled independently at every timestep with zero mean, its long-run
effect on altitude partially averages out, whereas a sustained constant wind force would have produced a clear, one-
directional steady-state offset that the integral term would then need to correct.

4. Task 2: Guidance & Path Tracking Using an Autonomous Boat


This task simulates an autonomous boat tracking a sine-wave path, defined as y = 8 sin(0.2t) while x = t, starting from
an off-path position at (-5, -10). Unlike Task 1, where the drone starts already at its operating point (ground level) and
must climb to a fixed setpoint, the boat must both catch up to a continuously moving target point and then track its
ongoing sinusoidal motion -- a more demanding, dynamic tracking problem. A constant water current (current_x,
current_y) is added throughout the simulation to represent environmental drift.

4.1 Theoretical Background


The guidance law used here is a position-based Proportional-Derivative (PD) controller, sometimes described as a
'spring-damper' analogy: the boat is pulled toward its target position with a force proportional to the position error (the
'spring' term, scaled by Kp), while its own velocity is damped by a term proportional to Kd (the 'damper' term). This is a
simpler control law than the heading-based Line-of-Sight (LOS) guidance often used in marine robotics, but it captures
the same essential idea -- continuous feedback correction toward a moving reference -- in a form that is easier to
reason about and tune.
Because the target point itself moves at a roughly constant average speed (dx/dt = 1 in the x-direction, plus oscillation
in y), a pure spring-damper controller with finite Kp will always exhibit a small steady-state lag behind the target,
analogous to the steady-state error of a proportional-only controller tracking a ramp input in classical control theory.
Within the assignment's slider limits (Kp between 0.1 and 2.0), this lag cannot be eliminated entirely, only minimised.

4.2 Methodology
At each timestep, the position error between the boat's current location and the corresponding point on the desired
path at that instant is computed as (dx, dy). A PD control law -- Kp scaling the position error, minus Kd scaling the boat's
current velocity -- produces an acceleration command in each axis. The constant current disturbance is added directly
to this acceleration, representing a steady external force from water current. The resulting acceleration is integrated to
update the boat's velocity, and the velocity is integrated to update its position, using a fixed timestep of 0.2s over a
40second simulation window.
4.3 Tuning Process & Final Parameters
Multiple Kp/Kd combinations were systematically tested within the allowed slider ranges (Kp: 0.1-2.0, Kd: 0-3.0) to
minimise the mean distance between the boat's trajectory and the desired path over the full 40-second run. Low Kp
values (close to the slider default of 1.0) produced a visibly large, persistent lag behind the moving target, particularly
along the fast-moving x-direction. Increasing Kp toward the top of its allowed range substantially reduced this lag; a
moderate Kd was then chosen to damp out oscillation around the sinusoidal path without overly slowing the response.
The final tuned values used were:
● Kp (Gain) = 2.0 -- the maximum value permitted by the slider.
● Kd (Damping) = 1.0
At the assignment's own suggested example current value (0.12, 0.12), the tuned controller rejected the disturbance
almost completely -- the with- and without-disturbance trajectories differed by less than 0.11 units at any point in time,
meaning the two plots were visually indistinguishable. This is itself a meaningful result: it demonstrates that Kp = 2.0
provides strong disturbance rejection against small currents. However, to make the current's effect clearly visible for
this report -- and to genuinely satisfy the assignment's objective of 'observing how different values affect disturbance
handling' -- current was raised to (1.0, 1.0), the maximum allowed by the slider, for the 'with disturbance' plot and the
accompanying error-over-time comparison shown below.

Figure 2: Boat Path Tracking WITH Disturbance (current = 1.0, 1.0)

Figure 3: Boat Path Tracking WITHOUT Disturbance (current = 0, 0)


Figure 4: Tracking Error Over Time, With vs Without Current

Mean tracking error with disturbance: approximately 0.81 units. Mean tracking error without disturbance:
approximately 0.69 units.

4.4 Results & Discussion


Figures 2 and 3 show that in both cases, the boat successfully catches up to the moving sinusoidal path within the first
few seconds and tracks it closely thereafter, with only a small, consistent offset visible near the peaks and troughs of
the sine wave -- consistent with the theoretical expectation that a finite-gain PD controller cannot perfectly track a
continuously accelerating reference. Figure 4 makes the effect of the current explicit: both curves show a large initial
error as the boat closes the gap from its off-path starting position, followed by a settling phase. From roughly t = 10s
onward, the 'with current' curve (red, solid) sits consistently above the 'without current' curve (blue, dashed),
confirming that the water current introduces a small but persistent additional tracking error, as expected physically -- a
steady external force acting on the boat requires a correspondingly steady counteracting control effort, which a finite-
gain controller can never fully supply without some residual offset.

5. Bonus (Optional): Drone Figure-Eight Trajectory Tracking


As an optional creative extension, a drone was simulated tracking a figure-eight (lemniscate) reference path, defined
parametrically as x(t) = A sin(wt), y(t) = A sin(wt) cos(wt), where A = 10 sets the width of the curve and w = 0.3 sets its
angular speed. This path is more demanding than the boat's sine wave because it doubles back on itself and crosses
through the origin twice per cycle, requiring the controller to reverse direction smoothly rather than simply following a
monotonically advancing reference.
A PD controller (Kp = 3.0, Kd = 2.5) steers the drone's horizontal (x, y) motion toward the reference path, using the same
spring-damper structure as Task 2's boat controller. A constant disturbance term (0.3, 0.2) was added to simulate a
steady wind or current acting on the drone during flight, since the assignment brief explicitly invites disturbance
handling as one of the optional elements of this bonus task.

Figure 5: Drone Figure-Eight Trajectory Tracking


As shown in Figure 5, the drone's trajectory (purple) closely follows the reference lemniscate (blue dashed) around both
loops of the figure-eight, including through the central crossing point where the direction of travel reverses. A small,
consistent lag is visible relative to the reference, attributable to the constant disturbance term combined with the finite
Kp/Kd gains, in the same manner as the steady-state lag discussed for Task 2. This confirms that the same PD guidance
approach used for the boat generalises reasonably well to a more geometrically complex, self-intersecting reference
path.

6. Challenges Faced & Lessons Learned


Several practical challenges arose during this project, and working through them contributed significantly to the overall
understanding of feedback control beyond what the theory alone conveys.

6.1 Counter-Intuitive Gain Sensitivity


During early experimentation with the boat guidance controller, it was initially assumed -- by analogy with the drone's
PID controller in Task 1 -- that increasing the derivative gain Kd would always improve stability and reduce oscillation.
Systematic testing across a grid of Kp/Kd combinations showed the opposite for this particular system: tracking error
consistently increased once Kd rose much above about 0.5, regardless of Kp. This happens because, unlike Task 1's fixed
setpoint, the boat's reference target position changes at every timestep, so the derivative term partly differentiates the
motion of the reference itself, not just the error relative to a stationary goal. This was an important reminder that
PID/PD intuition does not transfer uncritically between systems with fixed setpoints and systems with dynamically
moving references, and that empirical testing across a range of gains is essential rather than relying purely on rule-
ofthumb tuning heuristics.

6.2 Verifying Simulation Code Against the Actual Assignment


An early draft of this project was built around a self-written simulation using a circular reference path and a
headingbased Line-of-Sight guidance law for the boat, before the actual provided starter code
(Assignment_code.ipynb) was carefully compared line-by-line against it. This comparison revealed that the real
assignment instead used a sine-wave path and a simpler position-based PD controller with no heading state at all -- a
materially different system. All tuning and results in this report were subsequently redone using the verified, provided
code. This experience highlighted the importance of validating one's implementation against the actual specification or
starter materials before investing significant effort in tuning and analysis, rather than assuming a plausible re-
implementation is equivalent to the original.

6.3 Disturbance Magnitude Versus Controller Strength


A further, subtler challenge was that a well-tuned controller can make a disturbance's effect difficult to observe, since
strong disturbance rejection is, by definition, the controller's job. At the assignment's suggested example current value,
the tuned boat controller's with- and without-disturbance trajectories were nearly indistinguishable, which initially
appeared to be an error before further analysis confirmed it was a genuine, reproducible property of the system. This
was resolved by explicitly quantifying the (small) difference between the two cases and, separately, presenting results
at a larger current magnitude to make the underlying effect visually clear -- illustrating that demonstrating a
phenomenon for a report sometimes requires deliberately choosing conditions under which that phenomenon is
observable, distinct from simply presenting the 'best' tuned result.

7. Conclusion
This project provided practical, hands-on experience in tuning feedback controllers for two distinct autonomous
systems -- a drone under altitude and wind disturbance, and a boat under position and current disturbance -- together
with an optional extension to a more complex figure-eight trajectory. Across all three tasks, several consistent themes
emerged. First, tuning gains in a structured order (Proportional, then Derivative, then Integral, as recommended by the
assignment) proved to be a reliable and efficient strategy, allowing each gain's effect to be isolated and understood
before the next was introduced. Second, there is an inherent trade-off between responsiveness and stability in every
system tested: higher gains produce faster correction but risk overshoot or, in the boat's case, actively degraded
tracking when the derivative term interacted poorly with a moving reference. Third, disturbance rejection and
disturbance visibility are in tension -- a controller strong enough to track accurately can make the very disturbance it is
rejecting difficult to observe, which is itself a useful, transferable insight into how control systems are evaluated in
practice.
Beyond the specific numerical results, the project reinforced the value of validating an implementation against its
actual specification before drawing conclusions from it, and of using systematic, quantitative testing (such as grid-
searching gain combinations) rather than relying solely on intuition when tuning an unfamiliar control system. These
are practical engineering habits that extend well beyond this particular assignment.

8. Deliverables Summary
● Completed Assignment_code.ipynb notebook with tuned parameters for both tasks.
● Task 1: PID Controller Tuning Result Plot (Figure 1).
● Task 2: Boat Guidance Plot -- with disturbance/current (Figure 2).
● Task 2: Boat Guidance Plot -- without disturbance/current (Figure 3).
● Task 2: Supplementary tracking-error-over-time comparison plot (Figure 4). ● (Optional) Figure-Eight Drone
Simulation (Figure 5).

You might also like