@@ -127,7 +127,7 @@ def test_action_mode_abs_joint_velocity(self):
127127 task = self .get_task (
128128 ReachTarget , ArmActionMode .ABS_JOINT_VELOCITY )
129129 task .reset ()
130- action = [0.1 ] * 8
130+ action = [0.1 ] * 7 + [ 1 ]
131131 obs , reward , term = task .step (action )
132132 [self .assertAlmostEqual (0.1 , a , delta = 0.05 )
133133 for a in obs .joint_velocities ]
@@ -136,7 +136,7 @@ def test_action_mode_delta_joint_velocity(self):
136136 task = self .get_task (
137137 ReachTarget , ArmActionMode .DELTA_JOINT_VELOCITY )
138138 task .reset ()
139- action = [- 0.1 ] * 8
139+ action = [- 0.1 ] * 7 + [ 1 ]
140140 [task .step (action ) for _ in range (2 )]
141141 obs , reward , term = task .step (action )
142142 [self .assertAlmostEqual (- 0.3 , a , delta = 0.1 )
@@ -146,7 +146,7 @@ def test_action_mode_abs_joint_position(self):
146146 task = self .get_task (
147147 ReachTarget , ArmActionMode .ABS_JOINT_POSITION )
148148 _ , obs = task .reset ()
149- init_angles = np .append (obs .joint_positions , 0 . ) # for gripper
149+ init_angles = np .append (obs .joint_positions , 1 . ) # for gripper
150150 target_angles = np .array (init_angles ) + 0.05
151151 [task .step (target_angles ) for _ in range (5 )]
152152 obs , reward , term = task .step (target_angles )
@@ -159,7 +159,7 @@ def test_action_mode_delta_joint_position(self):
159159 _ , obs = task .reset ()
160160 init_angles = obs .joint_positions
161161 target_angles = np .array (init_angles ) + 0.06
162- [task .step ([0.01 ] * 8 ) for _ in range (5 )]
162+ [task .step ([0.01 ] * 7 + [ 1 ] ) for _ in range (5 )]
163163 obs , reward , term = task .step ([0.01 ] * 8 )
164164 [self .assertAlmostEqual (a , actual , delta = 0.05 )
165165 for a , actual in zip (target_angles , obs .joint_positions )]
@@ -169,30 +169,30 @@ def test_action_mode_abs_ee_position(self):
169169 ReachTarget , ArmActionMode .ABS_EE_POSE )
170170 _ , obs = task .reset ()
171171 init_pose = obs .gripper_pose
172- new_pose = np .append (init_pose , 0 .0 ) # for gripper
172+ new_pose = np .append (init_pose , 1 .0 ) # for gripper
173173 new_pose [2 ] -= 0.1 # 10cm down
174174 obs , reward , term = task .step (new_pose )
175- [self .assertAlmostEqual (a , p , delta = 0.001 )
175+ [self .assertAlmostEqual (a , p , delta = 0.01 )
176176 for a , p in zip (new_pose , obs .gripper_pose )]
177177
178178 def test_action_mode_delta_ee_position (self ):
179179 task = self .get_task (
180180 ReachTarget , ArmActionMode .DELTA_EE_POSE )
181181 _ , obs = task .reset ()
182182 init_pose = obs .gripper_pose
183- new_pose = [0 , 0 , - 0.1 , 0 , 0 , 0 , 1.0 , 0 .0 ] # 10cm down
183+ new_pose = [0 , 0 , - 0.1 , 0 , 0 , 0 , 1.0 , 1 .0 ] # 10cm down
184184 expected_pose = list (init_pose )
185185 expected_pose [2 ] -= 0.1
186186 obs , reward , term = task .step (new_pose )
187- [self .assertAlmostEqual (a , p , delta = 0.001 )
187+ [self .assertAlmostEqual (a , p , delta = 0.01 )
188188 for a , p in zip (expected_pose , obs .gripper_pose )]
189189
190190 def test_action_mode_abs_ee_position_plan (self ):
191191 task = self .get_task (
192192 ReachTarget , ArmActionMode .ABS_EE_POSE_PLAN )
193193 _ , obs = task .reset ()
194194 init_pose = obs .gripper_pose
195- new_pose = np .append (init_pose , 0 .0 ) # for gripper
195+ new_pose = np .append (init_pose , 1 .0 ) # for gripper
196196 new_pose [2 ] -= 0.1 # 10cm down
197197 obs , reward , term = task .step (new_pose )
198198 [self .assertAlmostEqual (a , p , delta = 0.001 )
@@ -203,7 +203,7 @@ def test_action_mode_delta_ee_position_plan(self):
203203 ReachTarget , ArmActionMode .DELTA_EE_POSE_PLAN )
204204 _ , obs = task .reset ()
205205 init_pose = obs .gripper_pose
206- new_pose = [0 , 0 , - 0.1 , 0 , 0 , 0 , 1.0 , 0 .0 ] # 10cm down
206+ new_pose = [0 , 0 , - 0.1 , 0 , 0 , 0 , 1.0 , 1 .0 ] # 10cm down
207207 expected_pose = list (init_pose )
208208 expected_pose [2 ] -= 0.1
209209 obs , reward , term = task .step (new_pose )
@@ -217,7 +217,7 @@ def test_action_mode_abs_ee_velocity(self):
217217 _ , obs = task .reset ()
218218 expected_pose = obs .gripper_pose
219219 expected_pose [2 ] += (VEL * 0.05 )
220- vels = np . zeros (( 8 ,))
220+ vels = [ 0. ] * 7 + [ 1 ]
221221 vels [2 ] += VEL
222222 obs , reward , term = task .step (vels )
223223 [self .assertAlmostEqual (a , p , delta = 0.001 )
@@ -232,7 +232,7 @@ def test_action_mode_delta_velocity(self):
232232 expected_pose [2 ] += (VEL * 0.05 )
233233 expected_pose [2 ] += ((VEL * 2 ) * 0.05 )
234234 expected_pose [2 ] += ((VEL * 3 ) * 0.05 )
235- vels = np . zeros (( 8 ,))
235+ vels = [ 0. ] * 7 + [ 1 ]
236236 vels [2 ] += VEL
237237 [task .step (vels ) for _ in range (2 )]
238238 obs , reward , term = task .step (vels )
@@ -243,7 +243,7 @@ def test_action_mode_abs_joint_torque(self):
243243 task = self .get_task (
244244 ReachTarget , ArmActionMode .ABS_JOINT_TORQUE )
245245 task .reset ()
246- action = [0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , 0 .0 ]
246+ action = [0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , 1 .0 ]
247247 obs , reward , term = task .step (action )
248248 # Difficult to test given gravity, so just check for exceptions.
249249
@@ -252,7 +252,7 @@ def test_action_mode_delta_joint_torque(self):
252252 ReachTarget , ArmActionMode .DELTA_JOINT_TORQUE )
253253 _ , obs = task .reset ()
254254 init_forces = np .array (obs .joint_forces )
255- action = [0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , 0 ]
255+ action = [0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , - 0.1 , 0.1 , 1 ]
256256 expected = np .array ([0.3 , - 0.3 , 0.3 , - 0.3 , 0.3 , - 0.3 , 0.3 ])
257257 expected += init_forces
258258 [task .step (action ) for _ in range (2 )]
0 commit comments