Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed yapf reported errors #1238

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

* Fixed yapf reported errors in https://github.com/loco-3d/crocoddyl/pull/1238
* Tested Python stubs in Conda CI in https://github.com/loco-3d/crocoddyl/pull/1228
* Fixed Rviz display in https://github.com/loco-3d/crocoddyl/pull/1227
* Improved CI, updated cmake and fixed launch file in https://github.com/loco-3d/crocoddyl/pull/1220
Expand Down
8 changes: 4 additions & 4 deletions bindings/python/crocoddyl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def init(self, solver):
name = self.robot.model.frames[c.contact.id].name
elif hasattr(c, "impact"):
name = self.robot.model.frames[c.impact.id].name
if not name in frameNames:
if name not in frameNames:
frameNames.append(name)
if hasattr(model, "differential"):
if isinstance(
Expand Down Expand Up @@ -379,7 +379,7 @@ def __init__(
visibility=False,
):
DisplayAbstract.__init__(self, robot, rate, freq)
if frameNames != None:
if frameNames is not None:
print("Deprecated. Do not pass frameNames")

# Visuals properties
Expand Down Expand Up @@ -553,7 +553,7 @@ def __init__(
visibility=True,
):
DisplayAbstract.__init__(self, robot, rate, freq)
if frameNames != None:
if frameNames is not None:
print("Deprecated. Do not pass frameNames")
robot.setVisualizer(
pinocchio.visualize.MeshcatVisualizer(
Expand Down Expand Up @@ -677,7 +677,7 @@ def _addFrictionCones(self):
)

def _addFrameCurves(self, key=None, vertices=None):
if key == None and vertices == None:
if key is None and vertices is None:
return
import meshcat.geometry as g

Expand Down
12 changes: 6 additions & 6 deletions examples/notebooks/solutions/cartpole_analytical_derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def cartpole_analytical_derivatives(model, data, x, u=None):
f = u[0].item()

# Shortname for system parameters
m1, m2, l, g = model.m1, model.m2, model.l, model.g
m1, m2, lcart, g = model.m1, model.m2, model.l, model.g
s, c = np.sin(th), np.cos(th)
m = m1 + m2
mu = m1 + m2 * s**2
Expand All @@ -20,15 +20,15 @@ def cartpole_analytical_derivatives(model, data, x, u=None):
[
[
0.0,
(m2 * g * c * c - m2 * g * s * s - m2 * l * c * thdot) / mu,
(m2 * g * c * c - m2 * g * s * s - m2 * lcart * c * thdot) / mu,
0.0,
-m2 * l * s / mu,
-m2 * lcart * s / mu,
],
[
0.0,
(
(-s * f / l)
+ (m * g * c / l)
(-s * f / lcart)
+ (m * g * c / lcart)
- (m2 * c * c * thdot**2)
+ (m2 * s * s * thdot**2)
)
Expand All @@ -39,7 +39,7 @@ def cartpole_analytical_derivatives(model, data, x, u=None):
]
)
# derivative of xddot and thddot by f
data.Fu[:] = np.array([1 / mu, c / (l * mu)])
data.Fu[:] = np.array([1 / mu, c / (lcart * mu)])
# first derivative of data.cost by x, theta, xdot, thetadot
data.Lx[:] = np.array(
[
Expand Down
Loading