Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 3702735

Browse files
jmirabelolivier-stasse
authored andcommitted
Make static member of python class HumanoidRobot dynamic
* Static members may be changed in the module. When the SoT controller * is restarted, it will not reload the modules. To let child classes * change them they must be dynamic members.
1 parent c8f53f9 commit 3702735

File tree

1 file changed

+70
-68
lines changed

1 file changed

+70
-68
lines changed

src/dynamic_graph/sot/dynamics_pinocchio/humanoid_robot.py

Lines changed: 70 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -65,89 +65,89 @@ class AbstractHumanoidRobot (object):
6565
"""
6666

6767

68+
def _initialize (self):
69+
self.OperationalPoints = ['left-wrist', 'right-wrist',
70+
'left-ankle', 'right-ankle',
71+
'gaze']
6872

69-
OperationalPoints = ['left-wrist', 'right-wrist',
70-
'left-ankle', 'right-ankle',
71-
'gaze']
7273

74+
"""
75+
Operational points are specific interesting points of the robot
76+
used to control it.
7377
74-
"""
75-
Operational points are specific interesting points of the robot
76-
used to control it.
77-
78-
When an operational point is defined, signals corresponding to the
79-
point position and jacobian are created.
78+
When an operational point is defined, signals corresponding to the
79+
point position and jacobian are created.
8080
81-
For instance if creating an operational point for the left-wrist,
82-
the associated signals will be called "left-wrist" and
83-
"Jleft-wrist" for respectively the position and the jacobian.
84-
"""
81+
For instance if creating an operational point for the left-wrist,
82+
the associated signals will be called "left-wrist" and
83+
"Jleft-wrist" for respectively the position and the jacobian.
84+
"""
8585

86-
AdditionalFrames = []
87-
"""
88-
Additional frames are frames which are defined w.r.t an operational point
89-
and provides an interesting transformation.
86+
self.AdditionalFrames = []
87+
"""
88+
Additional frames are frames which are defined w.r.t an operational point
89+
and provides an interesting transformation.
9090
91-
It can be used, for instance, to store the sensor location.
91+
It can be used, for instance, to store the sensor location.
9292
93-
The contained elements must be triplets matching:
94-
- additional frame name,
95-
- transformation w.r.t to the operational point,
96-
- operational point file.
97-
"""
93+
The contained elements must be triplets matching:
94+
- additional frame name,
95+
- transformation w.r.t to the operational point,
96+
- operational point file.
97+
"""
9898

9999

100-
frames = dict()
101-
"""
102-
Additional frames defined by using OpPointModifier.
103-
"""
100+
self.frames = dict()
101+
"""
102+
Additional frames defined by using OpPointModifier.
103+
"""
104104

105-
#FIXME: the following options are /not/ independent.
106-
# zmp requires acceleration which requires velocity.
107-
"""
108-
Enable velocity computation.
109-
"""
110-
enableVelocityDerivator = False
111-
"""
112-
Enable acceleration computation.
113-
"""
114-
enableAccelerationDerivator = False
115-
"""
116-
Enable ZMP computation
117-
"""
118-
enableZmpComputation = False
105+
#FIXME: the following options are /not/ independent.
106+
# zmp requires acceleration which requires velocity.
107+
"""
108+
Enable velocity computation.
109+
"""
110+
self.enableVelocityDerivator = False
111+
"""
112+
Enable acceleration computation.
113+
"""
114+
self.enableAccelerationDerivator = False
115+
"""
116+
Enable ZMP computation
117+
"""
118+
self.enableZmpComputation = False
119119

120-
"""
121-
Tracer used to log data.
122-
"""
123-
tracer = None
120+
"""
121+
Tracer used to log data.
122+
"""
123+
self.tracer = None
124124

125-
"""
126-
How much data will be logged.
127-
"""
128-
tracerSize = 2**20
125+
"""
126+
How much data will be logged.
127+
"""
128+
self.tracerSize = 2**20
129129

130-
"""
131-
Automatically recomputed signals through the use
132-
of device.after.
133-
This list is maintained in order to clean the
134-
signal list device.after before exiting.
135-
"""
136-
autoRecomputedSignals = []
130+
"""
131+
Automatically recomputed signals through the use
132+
of device.after.
133+
This list is maintained in order to clean the
134+
signal list device.after before exiting.
135+
"""
136+
self.autoRecomputedSignals = []
137137

138-
"""
139-
Which signals should be traced.
140-
"""
141-
tracedSignals = {
142-
'dynamic': ["com", "zmp", "angularmomentum",
143-
"position", "velocity", "acceleration"],
144-
'device': ['zmp', 'control', 'state']
145-
}
138+
"""
139+
Which signals should be traced.
140+
"""
141+
self.tracedSignals = {
142+
'dynamic': ["com", "zmp", "angularmomentum",
143+
"position", "velocity", "acceleration"],
144+
'device': ['zmp', 'control', 'state']
145+
}
146146

147-
"""
148-
Robot timestep
149-
"""
150-
timeStep = 0.005
147+
"""
148+
Robot timestep
149+
"""
150+
self.timeStep = 0.005
151151

152152
def help (self):
153153
print (AbstractHumanoidRobot.__doc__)
@@ -325,6 +325,8 @@ def traceDefaultSignals (self):
325325

326326

327327
def __init__(self, name, tracer = None):
328+
self._initialize()
329+
328330
self.name = name
329331

330332
# Initialize tracer if necessary.

0 commit comments

Comments
 (0)