Skip to content

Commit 62c6a81

Browse files
chore: fix style to match yapf (#83)
1 parent 3c6255b commit 62c6a81

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

scripts/viser_utils.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ def setup_viser_with_robot(robot_dir, robot_urdf_name):
1111
robot = ViserUrdf(
1212
server,
1313
urdf,
14-
load_meshes=True,
15-
load_collision_meshes=False,
16-
root_node_name="/robot",
17-
)
14+
load_meshes = True,
15+
load_collision_meshes = False,
16+
root_node_name = "/robot",
17+
)
1818

1919
return server, robot
2020

@@ -25,7 +25,7 @@ def add_spheres(
2525
sphere_radii: Sequence,
2626
colors: Union[Sequence[int], Sequence[Sequence[int]]] = [],
2727
prefix: str = "my_sphere",
28-
):
28+
):
2929
"""
3030
Add spheres to the env/
3131
Sphere positions are (N,3) and sphere radii are (N)
@@ -39,11 +39,11 @@ def add_spheres(
3939
assert len(colors) == len(sphere_positions)
4040
for i, (sphere_pos, sphere_rad) in enumerate(zip(sphere_positions, sphere_radii)):
4141
sphere_handles[i] = server.scene.add_icosphere(
42-
name=f"{prefix}_{i}",
43-
radius=sphere_rad,
44-
position=tuple(sphere_pos[:3]),
45-
color=tuple(colors[i]),
46-
)
42+
name = f"{prefix}_{i}",
43+
radius = sphere_rad,
44+
position = tuple(sphere_pos[:3]),
45+
color = tuple(colors[i]),
46+
)
4747
return sphere_handles
4848

4949

@@ -67,8 +67,8 @@ def add_trajectory(server, waypoints, robot, attachment_handles, attachment_posi
6767
return
6868
assert len(attachment_handles) == len(attachment_positions[0])
6969
traj_slider = server.gui.add_slider(
70-
"Current Waypoint", min=0, max=len(waypoints) - 1, step=1, initial_value=0
71-
)
70+
"Current Waypoint", min = 0, max = len(waypoints) - 1, step = 1, initial_value = 0
71+
)
7272

7373
@traj_slider.on_update
7474
def update_robot_pose(event):

scripts/visualize_viser.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
import vamp
88
from fire import Fire
99

10-
1110
# Starting configuration
1211
a = [0.0, -0.785, 0.0, -2.356, 0.0, 1.571, 0.785]
1312

1413
# Goal configuration
1514
b = [2.35, 1.0, 0.0, -0.8, 0, 2.5, 0.785]
1615

17-
1816
# Problem specification: a list of sphere centers
1917
problem = [
2018
[0.55, 0, 0.25],
@@ -31,7 +29,7 @@
3129
[-0.35, -0.35, 0.8],
3230
[0, -0.55, 0.8],
3331
[0.35, -0.35, 0.8],
34-
]
32+
]
3533

3634

3735
def main(
@@ -40,11 +38,10 @@ def main(
4038
attachment_offset: float = 0.02,
4139
planner: str = "rrtc",
4240
**kwargs,
43-
):
41+
):
4442

45-
(vamp_module, planner_func, plan_settings, simp_settings) = (
46-
vamp.configure_robot_and_planner_with_kwargs("panda", planner, **kwargs)
47-
)
43+
(vamp_module, planner_func, plan_settings,
44+
simp_settings) = (vamp.configure_robot_and_planner_with_kwargs("panda", planner, **kwargs))
4845

4946
# Create an attachment offset on the Z-axis from the end-effector frame
5047
tf = np.identity(4)
@@ -64,14 +61,14 @@ def main(
6461

6562
_problem_sphere_handles = add_spheres(
6663
server, np.array(problem), np.array([obstacle_radius] * len(problem))
67-
)
64+
)
6865

6966
# Add the attchment to the VAMP environment
7067
e.attach(attachment)
7168
# Add attachment sphere to visualization
7269
attachment_sph = add_spheres(
73-
server, np.zeros((1, 3)), np.array([attachment_radius]), colors=[[0, 255, 0]]
74-
)
70+
server, np.zeros((1, 3)), np.array([attachment_radius]), colors = [[0, 255, 0]]
71+
)
7572

7673
# Update attachment sphere positions corresponding to the waypoints.
7774
# this could also be made into a callable that can be called during trajectory viz
@@ -87,9 +84,7 @@ def get_attachment_pos(configuration):
8784

8885
attachment_positions = [get_attachment_pos(pos) for pos in simple.path.numpy()]
8986

90-
add_trajectory(
91-
server, simple.path.numpy(), robot, attachment_sph, attachment_positions
92-
)
87+
add_trajectory(server, simple.path.numpy(), robot, attachment_sph, attachment_positions)
9388

9489
# display
9590
while True:

0 commit comments

Comments
 (0)