Skip to content

Commit a8ab48b

Browse files
committed
maybe fix demo testbench
Signed-off-by: Gwenn Le Bihan <[email protected]>
1 parent 884d94c commit a8ab48b

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

demos/demo_testbech_joint_calibrator.py

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import libodri_control_interface_pywrap as oci
1111

1212
# Testbench
13-
robot_if = mbs.MasterBoardInterface("ens3")
13+
robot_if = mbs.MasterBoardInterface("enx00e04c4500b9")
1414
joints = oci.JointModules(
1515
robot_if,
1616
np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]),
@@ -72,19 +72,6 @@
7272

7373
imu = oci.IMU(robot_if)
7474

75-
robot = oci.Robot(robot_if, joints, imu)
76-
robot.start()
77-
robot.wait_until_ready()
78-
79-
# As the data is returned by reference, it's enough
80-
# to get hold of the data one. It will update after
81-
# each call to `robot.parse_sensor_data`.
82-
imu_attitude = imu.attitude_euler
83-
positions = joints.positions
84-
velocities = joints.velocities
85-
86-
des_pos = np.zeros(12)
87-
8875
# Setup the calibration method
8976
joint_offsets = np.array(
9077
[
@@ -100,15 +87,41 @@
10087
0.0,
10188
0.0,
10289
0.0,
103-
]
104-
)
90+
],
91+
dtype=np.float64,
92+
).reshape(-1, 1)
93+
10594
sdir = oci.CalibrationMethod.positive
95+
96+
zero_offsets = np.zeros(12, dtype=np.int32).reshape(-1, 1)
97+
some_other_array = np.zeros(12, dtype=np.float64).reshape(-1, 1)
98+
10699
joint_calibrator = oci.JointCalibrator(
107-
joints, 12 * [sdir], joint_offsets,
108-
np.zeros(12, dtype=int), np.zeros(12),
109-
5.0 / 20.0, 0.05 / 20.0, 2.0, 0.001
100+
joints,
101+
12 * [sdir],
102+
joint_offsets,
103+
zero_offsets,
104+
some_other_array,
105+
5.0 / 20.0,
106+
0.05 / 20.0,
107+
2.0,
108+
0.001,
110109
)
111110

111+
robot = oci.Robot(robot_if, joints, imu, joint_calibrator)
112+
robot.start()
113+
robot.wait_until_ready()
114+
115+
# As the data is returned by reference, it's enough
116+
# to get hold of the data one. It will update after
117+
# each call to `robot.parse_sensor_data`.
118+
imu_attitude = imu.attitude_euler
119+
positions = joints.positions
120+
velocities = joints.velocities
121+
122+
des_pos = np.zeros(12)
123+
124+
112125
c = 0
113126
dt = 0.001
114127
calibration_done = False

0 commit comments

Comments
 (0)