Skip to content

Commit

Permalink
ruff manual fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Feb 10, 2025
1 parent 7a40c90 commit a67bf98
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# All rights reserved.

import argparse
import os
import time
from pathlib import Path

import create_ocp
import crocoddyl
Expand Down Expand Up @@ -60,7 +60,7 @@ def scene_type(value):
robot_wrapper = PandaWrapper(capsule=False)
rmodel, cmodel, vmodel = robot_wrapper()

yaml_path = os.path.join(os.path.dirname(__file__), "scenes.yaml")
yaml_path = Path(__file__).parent / "scenes.yaml"
pp = ParamParser(yaml_path, args.scene)

cmodel = pp.add_collisions(rmodel, cmodel)
Expand Down
4 changes: 2 additions & 2 deletions examples/main_ocp_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# All rights reserved.

import argparse
import os
from pathlib import Path

import create_ocp
import pinocchio as pin
Expand Down Expand Up @@ -59,7 +59,7 @@ def scene_type(value):
robot_wrapper = PandaWrapper(capsule=False)
rmodel, cmodel, vmodel = robot_wrapper()

yaml_path = os.path.join(os.path.dirname(__file__), "scenes.yaml")
yaml_path = Path(__file__).parent / "scenes.yaml"
pp = ParamParser(yaml_path, args.scene)

cmodel = pp.add_collisions(rmodel, cmodel)
Expand Down
44 changes: 39 additions & 5 deletions examples/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,46 @@ def simulation_loop(
q = xs[1][:7]
if not ok:
print("Failed to solve the problem")
# print("u: ", np.array2string(np.array(us), precision=2, separator=", ", suppress_small=True))
# print("q: ", np.array2string(np.array(xs)[:,:7], precision=2, separator=", ", suppress_small=True))
# print("q1: ", np.array2string(xs[1][:7], precision=2, separator=", ", suppress_small=True))
# print("diff: ", np.array2string(xs[1][:7] - xs[0][:7], precision=2, separator=", ", suppress_small=True))
# print(
# "u: ",
# np.array2string(
# np.array(us), precision=2, separator=", ", suppress_small=True
# ),
# )
# print(
# "q: ",
# np.array2string(
# np.array(xs)[:, :7],
# precision=2,
# separator=", ",
# suppress_small=True,
# ),
# )
# print(
# "q1: ",
# np.array2string(
# xs[1][:7], precision=2, separator=", ", suppress_small=True
# ),
# )
# print(
# "diff: ",
# np.array2string(
# xs[1][:7] - xs[0][:7],
# precision=2,
# separator=", ",
# suppress_small=True,
# ),
# )
# for q0, q1 in zip(xs[:-1], xs[1:]):
# print("diff: ", np.array2string(q1[:7] - q0[:7], precision=2, separator=", ", suppress_small=True))
# print(
# "diff: ",
# np.array2string(
# q1[:7] - q0[:7],
# precision=2,
# separator=", ",
# suppress_small=True,
# ),
# )

# Shift the trajectory
xs[:-1] = xs[1:]
Expand Down

0 comments on commit a67bf98

Please sign in to comment.