Skip to content

Commit 76b90e3

Browse files
Added comments to 50 functions across 7 files
1 parent f1e8402 commit 76b90e3

File tree

6 files changed

+993
-0
lines changed

6 files changed

+993
-0
lines changed

IROS_experiments/person_controller_webots/src/genericworker.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ class GenericWorker(QtCore.QObject):
3939
kill = QtCore.Signal()
4040

4141
def __init__(self, mprx):
42+
"""
43+
establishes a `QMutex` and `QTimer` instance, setting the period to 30,
44+
to manage access to and timing of tasks.
45+
46+
Args:
47+
mprx (`object`/`instance`.): Qt core mutex, which is used to implement
48+
recursive mutual exclusion.
49+
50+
- `super(GenericWorker, self).__init__()` calls the constructor
51+
of the parent class `QtCore.QObject`.
52+
- `self.mutex = QtCore.QMutex(QtCore.QMutex.Recursive)` creates
53+
a recursive mutex with a name "mutex".
54+
- `self.Period = 30` sets the period of the worker to 30 seconds.
55+
- `self.timer = QtCore.QTimer(self)` creates an instance of the
56+
timer class and stores it in the member variable `self.timer`.
57+
58+
59+
"""
4260
super(GenericWorker, self).__init__()
4361

4462

@@ -49,13 +67,28 @@ def __init__(self, mprx):
4967

5068
@QtCore.Slot()
5169
def killYourSelf(self):
70+
"""
71+
emits the `kill` signal, which is likely to cause an immediate termination
72+
or shutdown of the program or component that contains the function.
73+
74+
"""
5275
rDebug("Killing myself")
5376
self.kill.emit()
5477

5578
# \brief Change compute period
5679
# @param per Period in ms
5780
@QtCore.Slot(int)
5881
def setPeriod(self, p):
82+
"""
83+
updates the instance variable ` Period` and starts a timer with the new
84+
period value using the `timer.start()` method.
85+
86+
Args:
87+
p (float): new period to be set for the instance's timer, and it is
88+
used to update the ` Period` attribute and start the timer with
89+
the new period.
90+
91+
"""
5992
print("Period changed", p)
6093
self.Period = p
6194
self.timer.start(self.Period)

0 commit comments

Comments
 (0)