|
10 | 10 | import libodri_control_interface_pywrap as oci
|
11 | 11 |
|
12 | 12 | # Testbench
|
13 |
| -robot_if = mbs.MasterBoardInterface("ens3") |
| 13 | +robot_if = mbs.MasterBoardInterface("enx00e04c4500b9") |
14 | 14 | joints = oci.JointModules(
|
15 | 15 | robot_if,
|
16 | 16 | np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]),
|
|
72 | 72 |
|
73 | 73 | imu = oci.IMU(robot_if)
|
74 | 74 |
|
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 |
| - |
88 | 75 | # Setup the calibration method
|
89 | 76 | joint_offsets = np.array(
|
90 | 77 | [
|
|
100 | 87 | 0.0,
|
101 | 88 | 0.0,
|
102 | 89 | 0.0,
|
103 |
| - ] |
104 |
| -) |
| 90 | + ], |
| 91 | + dtype=np.float64, |
| 92 | +).reshape(-1, 1) |
| 93 | + |
105 | 94 | 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 | + |
106 | 99 | 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, |
110 | 109 | )
|
111 | 110 |
|
| 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 | + |
112 | 125 | c = 0
|
113 | 126 | dt = 0.001
|
114 | 127 | calibration_done = False
|
|
0 commit comments