Skip to content

Commit d69be2b

Browse files
committed
remove poll word and snake case
1 parent 0d0935d commit d69be2b

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

17.7 KB
Loading
94.8 KB
Loading
-184 Bytes
Loading
14.4 KB
Loading

course/robot_control/prop_distance_tracker.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Let's identify the terms we'll need to use in our code:
1212
**Set Point** or desired value: In this example, this is some set distance from the rangefinder we want the robot to be at.
1313
For this example, let's say 20cm.
1414

15-
**Process Variable** or current value: We obtain our measured value from polling the rangerfinder. This is
15+
**Process Variable** or current value: We obtain our measured value from reading the rangerfinder value. This is
1616
:code:`rangefinder.distance()`.
1717

1818
Our goal is for our process variable (the rangefinder distance) to approach the set point (20 cm).
@@ -22,7 +22,7 @@ is also "correct". The distinction in sign is simply whichever makes more sense
2222
we would want to drive forward 10cm, so we would want a positive error to make our motors spin forward.
2323

2424
**Control Output**: In this case, this is our motor effort. This is because we want to drive with a speed proportional
25-
to the distance error. As a reminder for P control, this will be calculated as :code:`motorEffort = Kp * error`.
25+
to the distance error. As a reminder for P control, this will be calculated as :code:`motor_effort = Kp * error`.
2626

2727
**Kp**: This is our proportional gain. Though we will need to tune this value, we can guess a somewhat reasonable value
2828
by considering the range of values our error can take, and the domain of our control output. In this case, if we're 30cm away
@@ -44,14 +44,14 @@ Let's start by defining our proportional gain and our set point:
4444
.. code-block:: python
4545
4646
Kp = 0.1
47-
desiredDistance = 20
47+
desired_distance = 20
4848
4949
.. tab-item:: Blockly
5050

5151
.. image:: media/variables.png
5252
:width: 300
5353

54-
Next, we want to enter some sort of loop to continuously poll our rangefinder and update our motor effort from our controller output.
54+
Next, we want to enter some sort of loop to continuously read our rangefinder value and update our motor effort from our controller output.
5555

5656
.. tab-set::
5757

@@ -60,11 +60,11 @@ Next, we want to enter some sort of loop to continuously poll our rangefinder an
6060
.. code-block:: python
6161
6262
Kp = 0.1
63-
desiredDistance = 20
63+
desired_distance = 20
6464
while True:
65-
error = rangefinder.distance() - desiredDistance
66-
motorEffort = Kp * error
67-
drivetrain.set_effort(motorEffort, motorEffort)
65+
error = rangefinder.distance() - desired_distance
66+
motor_effort = Kp * error
67+
drivetrain.set_effort(motor_effort, motor_effort)
6868
time.sleep(0.05)
6969
7070
.. tab-item:: Blockly
@@ -73,7 +73,7 @@ Next, we want to enter some sort of loop to continuously poll our rangefinder an
7373
:width: 500
7474

7575
Each iteration of the loop consists of the following steps:
76-
#. Poll the rangefinder to get the current distance
76+
#. Read the rangefinder value to get the current distance
7777
#. Calculate the error
7878
#. Calculate the control output through Kp * error
7979
#. Set the drivetrain motor efforts to the control output

0 commit comments

Comments
 (0)