Skip to content

Commit dc2a3c1

Browse files
authored
Merge pull request #1238 from cmastalli/devel
Fixed yapf reported errors
2 parents 31357e0 + 56feab7 commit dc2a3c1

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
* Fixed yapf reported errors in https://github.com/loco-3d/crocoddyl/pull/1238
910
* Tested Python stubs in Conda CI in https://github.com/loco-3d/crocoddyl/pull/1228
1011
* Fixed Rviz display in https://github.com/loco-3d/crocoddyl/pull/1227
1112
* Improved CI, updated cmake and fixed launch file in https://github.com/loco-3d/crocoddyl/pull/1220

bindings/python/crocoddyl/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def init(self, solver):
119119
name = self.robot.model.frames[c.contact.id].name
120120
elif hasattr(c, "impact"):
121121
name = self.robot.model.frames[c.impact.id].name
122-
if not name in frameNames:
122+
if name not in frameNames:
123123
frameNames.append(name)
124124
if hasattr(model, "differential"):
125125
if isinstance(
@@ -379,7 +379,7 @@ def __init__(
379379
visibility=False,
380380
):
381381
DisplayAbstract.__init__(self, robot, rate, freq)
382-
if frameNames != None:
382+
if frameNames is not None:
383383
print("Deprecated. Do not pass frameNames")
384384

385385
# Visuals properties
@@ -553,7 +553,7 @@ def __init__(
553553
visibility=True,
554554
):
555555
DisplayAbstract.__init__(self, robot, rate, freq)
556-
if frameNames != None:
556+
if frameNames is not None:
557557
print("Deprecated. Do not pass frameNames")
558558
robot.setVisualizer(
559559
pinocchio.visualize.MeshcatVisualizer(
@@ -677,7 +677,7 @@ def _addFrictionCones(self):
677677
)
678678

679679
def _addFrameCurves(self, key=None, vertices=None):
680-
if key == None and vertices == None:
680+
if key is None and vertices is None:
681681
return
682682
import meshcat.geometry as g
683683

examples/notebooks/solutions/cartpole_analytical_derivatives.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def cartpole_analytical_derivatives(model, data, x, u=None):
88
f = u[0].item()
99

1010
# Shortname for system parameters
11-
m1, m2, l, g = model.m1, model.m2, model.l, model.g
11+
m1, m2, lcart, g = model.m1, model.m2, model.l, model.g
1212
s, c = np.sin(th), np.cos(th)
1313
m = m1 + m2
1414
mu = m1 + m2 * s**2
@@ -20,15 +20,15 @@ def cartpole_analytical_derivatives(model, data, x, u=None):
2020
[
2121
[
2222
0.0,
23-
(m2 * g * c * c - m2 * g * s * s - m2 * l * c * thdot) / mu,
23+
(m2 * g * c * c - m2 * g * s * s - m2 * lcart * c * thdot) / mu,
2424
0.0,
25-
-m2 * l * s / mu,
25+
-m2 * lcart * s / mu,
2626
],
2727
[
2828
0.0,
2929
(
30-
(-s * f / l)
31-
+ (m * g * c / l)
30+
(-s * f / lcart)
31+
+ (m * g * c / lcart)
3232
- (m2 * c * c * thdot**2)
3333
+ (m2 * s * s * thdot**2)
3434
)
@@ -39,7 +39,7 @@ def cartpole_analytical_derivatives(model, data, x, u=None):
3939
]
4040
)
4141
# derivative of xddot and thddot by f
42-
data.Fu[:] = np.array([1 / mu, c / (l * mu)])
42+
data.Fu[:] = np.array([1 / mu, c / (lcart * mu)])
4343
# first derivative of data.cost by x, theta, xdot, thetadot
4444
data.Lx[:] = np.array(
4545
[

0 commit comments

Comments
 (0)