@@ -324,56 +324,26 @@ def _from_keyboard_to_base_action(self, pressed_keys: np.ndarray):
324324 if self .teleop_keys ["rotate_right" ] in pressed_keys :
325325 theta_cmd -= theta_speed
326326
327-
328- return {
329- "x.vel" : x_cmd ,
330- "y.vel" : y_cmd ,
331- "theta.vel" : theta_cmd ,
332- }
333-
334- # lift_axis.vel
335- # def _from_keyboard_to_lift_action(self, pressed_keys: np.ndarray):
336- # LIFT_VEL = 1000 # 觉得慢/快就改
337- # up_pressed = self.teleop_keys.get("lift_up", "u") in pressed_keys
338- # dn_pressed = self.teleop_keys.get("lift_down", "j") in pressed_keys
339-
340- # if up_pressed and not dn_pressed:
341- # v = +LIFT_VEL
342- # elif dn_pressed and not up_pressed:
343- # v = -LIFT_VEL
344- # else:
345- # v = 0.0
346- # return {"lift_axis.vel": int(v)}
347-
348-
349- # lift_axis.height_mm
350- def _from_keyboard_to_lift_action (self , pressed_keys : np .ndarray ):
327+ # Lift Control
351328 up_pressed = self .teleop_keys .get ("lift_up" , "u" ) in pressed_keys
352329 dn_pressed = self .teleop_keys .get ("lift_down" , "j" ) in pressed_keys
353330
354331 # Read the last height (mm) reported by the Host
355332 h_now = float (self .last_remote_state .get ("lift_axis.height_mm" , 0.0 ))
356- #print(f"h_now:{h_now}")
357333
358- if not (up_pressed or dn_pressed ):
359- # If neither 'u' nor 'j' is pressed, reuse the previous value to avoid empty input
360- #return {"lift_axis.height_mm": h_now}
361- return {"lift_axis.height_mm" : h_now }
362-
363- # Increment on each key press
364334 if up_pressed and not dn_pressed :
365335 h_target = h_now + LiftAxisConfig .step_mm
366336 elif dn_pressed and not up_pressed :
367337 h_target = h_now - LiftAxisConfig .step_mm
368338 else :
369339 h_target = h_now
370- #print(f"h_target:{h_target}")
371-
372- # Send "target height (mm)" directly
373- return {"lift_axis.height_mm" : h_target }
374-
375-
376340
341+ return {
342+ "x.vel" : x_cmd ,
343+ "y.vel" : y_cmd ,
344+ "theta.vel" : theta_cmd ,
345+ "lift_axis.height_mm" : h_target ,
346+ }
377347
378348 def configure (self ):
379349 pass
0 commit comments