@@ -242,18 +242,19 @@ def set_goal(self, action):
242242
243243 # Parse action based on the impedance mode, and update kp / kd as necessary
244244 if self .impedance_mode == "variable" :
245- damping_ratio , kp , delta = action [:6 ], action [6 :12 ], action [12 :]
245+ damping_ratio , kp , goal_update = action [:6 ], action [6 :12 ], action [12 :]
246246 self .kp = np .clip (kp , self .kp_min , self .kp_max )
247247 self .kd = 2 * np .sqrt (self .kp ) * np .clip (damping_ratio , self .damping_ratio_min , self .damping_ratio_max )
248248 elif self .impedance_mode == "variable_kp" :
249- kp , delta = action [:6 ], action [6 :]
249+ kp , goal_update = action [:6 ], action [6 :]
250250 self .kp = np .clip (kp , self .kp_min , self .kp_max )
251251 self .kd = 2 * np .sqrt (self .kp ) # critically damped
252252 else : # This is case "fixed"
253- delta = action
253+ goal_update = action
254254
255255 # If we're using deltas, interpret actions as such
256256 if self .input_type == "delta" :
257+ delta = goal_update
257258 scaled_delta = self .scale_action (delta )
258259 self .goal_pos = self .compute_goal_pos (scaled_delta [0 :3 ])
259260 if self .use_ori is True :
@@ -262,9 +263,10 @@ def set_goal(self, action):
262263 self .goal_ori = self .compute_goal_ori (np .zeros (3 ))
263264 # Else, interpret actions as absolute values
264265 elif self .input_type == "absolute" :
265- self .goal_pos = action [0 :3 ]
266+ abs_action = goal_update
267+ self .goal_pos = abs_action [0 :3 ]
266268 if self .use_ori is True :
267- self .goal_ori = Rotation .from_rotvec (action [3 :6 ]).as_matrix ()
269+ self .goal_ori = Rotation .from_rotvec (abs_action [3 :6 ]).as_matrix ()
268270 else :
269271 self .goal_ori = self .compute_goal_ori (np .zeros (3 ))
270272 else :
0 commit comments