Skip to content

Commit 195bdb0

Browse files
update figure eight example
1 parent 03ccb1b commit 195bdb0

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

examples/01_figure_eight.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
from crisp_py.robot import make_robot
88

9-
left_arm = make_robot("fr3")
10-
left_arm.wait_until_ready()
9+
robot = make_robot("fr3")
10+
robot.wait_until_ready()
1111

1212
# %%
13-
print(left_arm.end_effector_pose)
14-
print(left_arm.joint_values)
13+
print(robot.end_effector_pose)
14+
print(robot.joint_values)
1515

1616
# %%
1717
print("Going to home position...")
18-
left_arm.home()
19-
homing_pose = left_arm.end_effector_pose.copy()
18+
robot.home()
19+
homing_pose = robot.end_effector_pose.copy()
2020

2121

2222
# %%
@@ -29,8 +29,8 @@
2929
max_time = 8.0
3030

3131
# %%
32-
left_arm.controller_switcher_client.switch_controller("cartesian_impedance_controller")
33-
left_arm.cartesian_controller_parameters_client.load_param_config(
32+
robot.controller_switcher_client.switch_controller("cartesian_impedance_controller")
33+
robot.cartesian_controller_parameters_client.load_param_config(
3434
# file_path="config/control/gravity_compensation.yaml"
3535
# file_path="config/control/default_operational_space_controller.yaml"
3636
# file_path="config/control/clipped_cartesian_impedance.yaml"
@@ -39,7 +39,7 @@
3939

4040
# %%
4141
# The move_to function will publish a pose to /target_pose while interpolation linearly
42-
left_arm.move_to(position=center, speed=0.15)
42+
robot.move_to(position=center, speed=0.15)
4343

4444
# %%
4545
# The set_target will directly publish the pose to /target_pose
@@ -49,21 +49,21 @@
4949

5050
print("Starting to draw a circle...")
5151
t = 0.0
52-
target_pose = left_arm.end_effector_pose.copy()
53-
rate = left_arm.node.create_rate(ctrl_freq)
52+
target_pose = robot.end_effector_pose.copy()
53+
rate = robot.node.create_rate(ctrl_freq)
5454

5555
while t < max_time:
5656
x = center[0]
5757
y = radius * np.sin(2 * np.pi * sin_freq_y * t) + center[1]
5858
z = radius * np.sin(2 * np.pi * sin_freq_z * t) + center[2]
5959
target_pose.position = np.array([x, y, z])
6060

61-
left_arm.set_target(pose=target_pose)
61+
robot.set_target(pose=target_pose)
6262

6363
rate.sleep()
6464

65-
ee_poses.append(left_arm.end_effector_pose.copy())
66-
target_poses.append(left_arm._target_pose.copy())
65+
ee_poses.append(robot.end_effector_pose.copy())
66+
target_poses.append(robot._target_pose.copy())
6767
ts.append(t)
6868

6969
t += 1.0 / ctrl_freq
@@ -73,8 +73,8 @@
7373

7474
rate.sleep()
7575

76-
ee_poses.append(left_arm.end_effector_pose.copy())
77-
target_poses.append(left_arm._target_pose.copy())
76+
ee_poses.append(robot.end_effector_pose.copy())
77+
target_poses.append(robot._target_pose.copy())
7878
ts.append(t)
7979

8080
t += 1.0 / ctrl_freq
@@ -114,7 +114,7 @@
114114
# %%
115115

116116
print("Going back home.")
117-
left_arm.home()
117+
robot.home()
118118

119119
# %%
120-
left_arm.shutdown()
120+
robot.shutdown()

0 commit comments

Comments
 (0)