Skip to content

Commit

Permalink
Merge branch 'PD-controller-documentation' of github.com:tohsin/Minar…
Browse files Browse the repository at this point in the history
…i into PD-controller-documentation
  • Loading branch information
balisujohn committed Jun 23, 2023
2 parents be2c958 + 1aff513 commit ec9bb08
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions docs/tutorials/dataset_creation/point_maze_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,21 @@ def _check_valid_cell(self, cell):
# PID combines three components Proportial Term(P), Integral Term(I) and Derivative Term (D)
#
# 1. Proportial Term(P)
# -------------------
# The proportional term in a PID controller adjusts the control action based on the current error,
# which is the difference between the desired value (setpoint) and the current value of the process variable.
# The control action is directly proportional to the error. A higher error results in a stronger control action.
# However, the proportional term alone can lead to overshooting or instability. Note ``\tau`` is our control value
# ~~~~~~~~~~~~~~~~~~~
# The proportional term in a PID controller adjusts the control action based on the current error, which
# is the difference between the desired value (setpoint) and the current value of the process variable.
# The control action is directly proportional to the error. A higher error results in a stronger control action.
# However, the proportional term alone can lead to overshooting or instability. Note ``\tau`` is our control value.
# references.
#
# .. math ::
# \tau = k_{p}(Error)
# \tau = k_{p}(Error)
#
# 2. Derivative Term (D)
# -------------------
# ~~~~~~~~~~~~~~~~~~~
# The derivative term in a PD controller considers the rate of change of the error over time.
# It helps to predict the future behavior of the error. By dampening the control action based
# on the rate of change of the error, the derivative term contributes to system stability and reduces overshooting.
# It helps to predict the future behavior of the error. By dampening the control action based
# on the rate of change of the error, the derivative term contributes to system stability and reduces overshooting.
# It also helps the system respond quickly to changes in the error.
# references.
#
Expand All @@ -198,9 +198,9 @@ def _check_valid_cell(self, cell):
# \tau = k_{p}(Error) + k_{d}(d(Error) / dt)
#
# 3. Integral Term (I)
# -------------------
# The integral term in a PID controller integrates the cumulative error over time.
# It helps to address steady-state errors or biases that may exist in the system.
# ~~~~~~~~~~~~~~~~~~~
# The integral term in a PID controller integrates the cumulative error over time.
# It helps to address steady-state errors or biases that may exist in the system.
# The integral term continuously adjusts the control action based on the accumulated error,
# aiming to eliminate any long-term deviations between the desired setpoint and the actual process variable.
# references.
Expand All @@ -213,16 +213,16 @@ def _check_valid_cell(self, cell):
# .. math ::
# \tau = k_{p}(Error) + k_{d}(d(Error) / dt) + k_{I}(\int) Error dt
#
# In the PID controller formula, Kp, Ki, and Kd are the respective gains for the proportional, integral, and derivative terms.
# These gains determine the influence of each term on the control action.
# The optimal values for these gains are typically determined through tuning, which involves adjusting
# In the PID controller formula, Kp, Ki, and Kd are the respective gains for the proportional, integral, and derivative terms.
# These gains determine the influence of each term on the control action.
# The optimal values for these gains are typically determined through tuning, which involves adjusting
# the gains to achieve the desired control performance.
# Now back to our controller as stated previously, for the D4RL task we use a PD contoller and we
# Now back to our controller as stated previously, for the D4RL task we use a PD controller and we
# follow the same theme as what we have stated before as can be seen below. The ``Error`` is equlivalent
# to the diffrence between the `goal_{pose}`` and ``agent_{pose}`` and we replace the derivative term ``(d(Error) / dt)`` with
# the velocity of the the agent ``v_{agent}``, we can think of this as a measure of the speed at which the agent
# is approaching the target position. When the agent is moving quickly towards the target,
# the derivative term will be larger, contributing to a stronger corrective action from the controller.
# to the difference between the `goal_{pose}`` and ``agent_{pose}`` and we replace the derivative term ``(d(Error) / dt)`` with
# the velocity of the the agent ``v_{agent}``, we can think of this as a measure of the speed at which the agent
# is approaching the target position. When the agent is moving quickly towards the target, the
# derivative term will be larger, contributing to a stronger corrective action from the controller.
# On the other hand, if the agent is already close to the target and moving slowly, the derivative term will be smaller,
# resulting in a less aggressive control action.
# references.
Expand All @@ -233,6 +233,7 @@ def _check_valid_cell(self, cell):
# Each target position in the waypoint trajectory is converted from discrete to a continuous value and we also add some noise to
# the ``x`` and ``y`` coordinates to add more variance in the trajectories generated for the offline dataset.


class WaypointController:
"""Agent controller to follow waypoints in the maze.
Expand Down

0 comments on commit ec9bb08

Please sign in to comment.