kuavo-humanoid-sdk 1.1.3a1252__py3-none-any.whl → 1.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of kuavo-humanoid-sdk might be problematic. Click here for more details.

Files changed (43) hide show
  1. kuavo_humanoid_sdk/interfaces/data_types.py +0 -46
  2. kuavo_humanoid_sdk/kuavo/__init__.py +0 -3
  3. kuavo_humanoid_sdk/kuavo/core/core.py +6 -18
  4. kuavo_humanoid_sdk/kuavo/core/ros/control.py +19 -645
  5. kuavo_humanoid_sdk/kuavo/core/ros/param.py +4 -142
  6. kuavo_humanoid_sdk/kuavo/core/ros/state.py +15 -329
  7. kuavo_humanoid_sdk/kuavo/core/ros_env.py +1 -229
  8. kuavo_humanoid_sdk/kuavo/dexterous_hand.py +2 -6
  9. kuavo_humanoid_sdk/kuavo/leju_claw.py +2 -6
  10. kuavo_humanoid_sdk/kuavo/robot.py +22 -43
  11. kuavo_humanoid_sdk/kuavo/robot_info.py +2 -7
  12. kuavo_humanoid_sdk/kuavo/robot_state.py +2 -6
  13. kuavo_humanoid_sdk/msg/kuavo_msgs/msg/__init__.py +0 -7
  14. kuavo_humanoid_sdk/msg/kuavo_msgs/srv/__init__.py +0 -4
  15. kuavo_humanoid_sdk/msg/kuavo_msgs/srv/_playmusic.py +20 -26
  16. kuavo_humanoid_sdk/msg/motion_capture_ik/msg/__init__.py +9 -0
  17. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_armHandPose.py +2 -2
  18. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_handPose.py +2 -2
  19. kuavo_humanoid_sdk/msg/motion_capture_ik/msg/_headBodyPose.py +145 -0
  20. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_ikSolveError.py +13 -13
  21. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_ikSolveParam.py +2 -2
  22. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_robotArmQVVD.py +2 -2
  23. kuavo_humanoid_sdk/msg/motion_capture_ik/msg/_robotHandPosition.py +225 -0
  24. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_twoArmHandPose.py +13 -13
  25. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/msg/_twoArmHandPoseCmd.py +15 -15
  26. kuavo_humanoid_sdk/msg/motion_capture_ik/srv/__init__.py +4 -0
  27. kuavo_humanoid_sdk/msg/{kuavo_msgs/srv/_SpeechSynthesis.py → motion_capture_ik/srv/_changeArmCtrlMode.py} +98 -93
  28. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/srv/_changeArmCtrlModeKuavo.py +5 -5
  29. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/srv/_fkSrv.py +13 -13
  30. kuavo_humanoid_sdk/msg/{kuavo_msgs → motion_capture_ik}/srv/_twoArmHandPoseCmdSrv.py +23 -23
  31. {kuavo_humanoid_sdk-1.1.3a1252.dist-info → kuavo_humanoid_sdk-1.1.6.dist-info}/METADATA +1 -2
  32. {kuavo_humanoid_sdk-1.1.3a1252.dist-info → kuavo_humanoid_sdk-1.1.6.dist-info}/RECORD +34 -39
  33. kuavo_humanoid_sdk/common/global_config.py +0 -16
  34. kuavo_humanoid_sdk/common/websocket_kuavo_sdk.py +0 -23
  35. kuavo_humanoid_sdk/kuavo/core/audio.py +0 -36
  36. kuavo_humanoid_sdk/kuavo/core/ros/audio.py +0 -176
  37. kuavo_humanoid_sdk/kuavo/core/ros/tools.py +0 -158
  38. kuavo_humanoid_sdk/kuavo/core/ros/vision.py +0 -522
  39. kuavo_humanoid_sdk/kuavo/robot_audio.py +0 -39
  40. kuavo_humanoid_sdk/kuavo/robot_tool.py +0 -62
  41. kuavo_humanoid_sdk/kuavo/robot_vision.py +0 -90
  42. {kuavo_humanoid_sdk-1.1.3a1252.dist-info → kuavo_humanoid_sdk-1.1.6.dist-info}/WHEEL +0 -0
  43. {kuavo_humanoid_sdk-1.1.3a1252.dist-info → kuavo_humanoid_sdk-1.1.6.dist-info}/top_level.txt +0 -0
@@ -2,15 +2,10 @@
2
2
  # coding: utf-8
3
3
 
4
4
  import os
5
- try:
6
- import rospy
7
- except ImportError:
8
- pass
5
+ import rospy
9
6
  import subprocess
10
7
  import atexit
11
8
  from kuavo_humanoid_sdk.common.logger import SDKLogger
12
- from kuavo_humanoid_sdk.common.websocket_kuavo_sdk import WebSocketKuavoSDK
13
- import roslibpy
14
9
 
15
10
  class KuavoROSEnv:
16
11
  _instance = None
@@ -237,226 +232,3 @@ class KuavoROSEnv:
237
232
  except Exception as e:
238
233
  SDKLogger.error(f"Error checking if node {node_name} exists: {e}")
239
234
  return False
240
-
241
- class KuavoROSEnvWebsocket:
242
- _instance = None
243
- _processes = [] # Store all subprocess instances
244
-
245
- def __new__(cls):
246
- if cls._instance is None:
247
- cls._instance = super(KuavoROSEnvWebsocket, cls).__new__(cls)
248
- cls._instance._initialized = False
249
- cls._instance._init_success = False # Add flag to track successful Init() call
250
- # Register cleanup handler
251
- atexit.register(cls._cleanup_processes)
252
- return cls._instance
253
-
254
- def __init__(self):
255
- if not self._initialized:
256
- self._initialized = True
257
- self.websocket = None
258
-
259
- @classmethod
260
- def _cleanup_processes(cls):
261
- """Cleanup all registered processes on exit"""
262
- for process in cls._processes:
263
- if process.poll() is None: # Process is still running
264
- process.terminate()
265
- try:
266
- process.wait(timeout=3) # Wait for process to terminate
267
- except subprocess.TimeoutExpired:
268
- process.kill() # Force kill if not terminated
269
- cls._processes.clear()
270
-
271
- def _get_kuavo_ws_root(self) -> str:
272
- # For WebSocket version, we'll use environment variable instead of ROS param
273
- model_path = os.environ.get('KUAVO_MODEL_PATH')
274
- if not model_path:
275
- raise Exception("KUAVO_MODEL_PATH environment variable not found")
276
-
277
- if not os.path.exists(model_path):
278
- raise Exception(f"Model path {model_path} not found")
279
-
280
- # ws
281
- return model_path.replace('/src/kuavo_assets/models', '')
282
-
283
- def Init(self) -> bool:
284
- """
285
- Initialize the WebSocket environment.
286
- Raises:
287
- Exception: If the KUAVO_MODEL_PATH environment variable is not found or the path is not valid.
288
- """
289
- # if generate docs, skip init.
290
- if 'GEN_KUAVO_HUMANOID_SDK_DOCS' in os.environ:
291
- return True
292
-
293
- # Return directly if already initialized successfully
294
- if self._init_success:
295
- return True
296
-
297
- # Check if WebSocket server is running
298
- try:
299
-
300
- self.websocket = WebSocketKuavoSDK()
301
- if not self.websocket.client.is_connected:
302
- print(f"\033[31m\nError: Can't connect to WebSocket server. Please ensure the server is running.\033[0m"
303
- "\nMaybe manually launch the app first?"
304
- "\n - for example(sim): roslaunch humanoid_controller load_kuavo_mujoco_sim.launch, "
305
- "\n - for example(real): roslaunch humanoid_controller load_kuavo_real.launch\n")
306
- exit(1)
307
- except Exception as e:
308
- print(f"\033[31m\nError: Failed to connect to WebSocket server: {e}\033[0m")
309
- exit(1)
310
-
311
- # Only check nodes exist when Init SDK, if not, tips user manually launch nodes.
312
- deps_nodes = ['/humanoid_gait_switch_by_name']
313
- for node in deps_nodes:
314
- if not self.check_rosnode_exists(node):
315
- print(f"\033[31m\nError: Node {node} not found. Please launch it manually.\033[0m")
316
- exit(1)
317
-
318
- self._init_success = True # Set flag after successful initialization
319
-
320
- return True
321
-
322
- def _launch_ros_node(self, node_name, launch_cmd, log_name):
323
- """Launch a ROS node with the given command and log the output.
324
-
325
- Args:
326
- node_name (str): Name of the node to launch
327
- launch_cmd (str): Full launch command including source and roslaunch
328
- log_name (str): Name for the log file
329
-
330
- Raises:
331
- Exception: If node launch fails
332
- """
333
- # Launch in background and check if successful
334
- try:
335
- os.makedirs('/var/log/kuavo_humanoid_sdk', exist_ok=True)
336
- log_path = f'/var/log/kuavo_humanoid_sdk/{log_name}.log'
337
- except PermissionError:
338
- os.makedirs('log/kuavo_humanoid_sdk', exist_ok=True)
339
- log_path = f'log/kuavo_humanoid_sdk/{log_name}.log'
340
-
341
- with open(log_path, 'w') as log_file:
342
- process = subprocess.Popen(launch_cmd, shell=True, executable='/bin/bash', stdout=log_file, stderr=log_file)
343
- self._processes.append(process) # Add process to tracking list
344
-
345
- if process.returncode is not None and process.returncode != 0:
346
- raise Exception(f"Failed to launch {node_name}, return code: {process.returncode}")
347
-
348
- SDKLogger.info(f"{node_name} launched successfully")
349
-
350
- def _get_setup_file(self, ws_root=None):
351
- """Get the appropriate ROS setup file path based on shell type.
352
-
353
- Args:
354
- ws_root (str, optional): ROS workspace root path. If None, uses ROS_WORKSPACE.
355
-
356
- Returns:
357
- str: Path to the setup file
358
-
359
- Raises:
360
- Exception: If setup file not found
361
- """
362
- is_zsh = 'zsh' in os.environ.get('SHELL', '')
363
-
364
- if ws_root is None:
365
- ws_root = os.environ['ROS_WORKSPACE']
366
-
367
- setup_files = {
368
- 'zsh': os.path.join(ws_root, 'devel/setup.zsh'),
369
- 'bash': os.path.join(ws_root, 'devel/setup.bash')
370
- }
371
-
372
- setup_file = setup_files['zsh'] if is_zsh else setup_files['bash']
373
- if not os.path.exists(setup_file):
374
- setup_file = setup_file.replace('devel', 'install')
375
- if not os.path.exists(setup_file):
376
- raise Exception(f"Setup file not found in either devel or install: {setup_file}")
377
-
378
- return setup_file
379
-
380
- def launch_ik_node(self):
381
- # nodes: /arms_ik_node
382
- # services: /ik/two_arm_hand_pose_cmd_srv, /ik/fk_srv
383
- try:
384
- if not self.websocket or not self.websocket.client.is_connected:
385
- raise Exception("WebSocket server is not running")
386
- except Exception as e:
387
- raise Exception(f"WebSocket server is not running: {e}")
388
-
389
- # Check if IK node and services exist
390
- try:
391
- # Check if arms_ik_node is running using roslibpy
392
- service = roslibpy.Service(self.websocket.client, '/rosnode/list', 'rosapi/Nodes')
393
- response = service.call({})
394
- nodes = response.get('nodes', [])
395
-
396
- if '/arms_ik_node' not in nodes:
397
- # Launch IK node if not running
398
- kuavo_ws_root = self._get_kuavo_ws_root()
399
- setup_file = self._get_setup_file(kuavo_ws_root)
400
- source_cmd = f"source {setup_file}"
401
-
402
- # Get robot version from environment variable
403
- robot_version = os.environ.get('ROBOT_VERSION')
404
- if robot_version is None:
405
- raise Exception("Failed to get ROBOT_VERSION from environment variables")
406
-
407
- # Launch IK node
408
- launch_cmd = f"roslaunch motion_capture_ik ik_node.launch robot_version:={robot_version}"
409
- full_cmd = f"{source_cmd} && {launch_cmd}"
410
-
411
- self._launch_ros_node('IK node', full_cmd, 'launch_ik')
412
-
413
- return True
414
-
415
- except Exception as e:
416
- raise Exception(f"Failed to verify IK node and services: {e}")
417
-
418
-
419
- def launch_gait_switch_node(self)-> bool:
420
- """Verify that the gait switch node is running, launch if not."""
421
- try:
422
- # Check if node exists using roslibpy
423
- service = roslibpy.Service(self.websocket.client, '/rosnode/list', 'rosapi/Nodes')
424
- response = service.call({})
425
- nodes = response.get('nodes', [])
426
-
427
- if '/humanoid_gait_switch_by_name' not in nodes:
428
- kuavo_ws_root = self._get_kuavo_ws_root()
429
- setup_file = self._get_setup_file(kuavo_ws_root)
430
- source_cmd = f"source {setup_file}"
431
-
432
- # Launch gait switch node
433
- launch_cmd = "roslaunch humanoid_interface_ros humanoid_switch_gait.launch"
434
- full_cmd = f"{source_cmd} && {launch_cmd}"
435
-
436
- self._launch_ros_node('Gait switch node', full_cmd, 'launch_gait_switch')
437
-
438
- except Exception as e:
439
- raise Exception(f"Failed to launch gait_switch node: {e}")
440
-
441
- @staticmethod
442
- def check_rosnode_exists(node_name):
443
- """Check if a ROS node is running using roslibpy.
444
-
445
- Args:
446
- node_name (str): Name of the node to check
447
-
448
- Returns:
449
- bool: True if node is running, False otherwise
450
- """
451
- websocket = WebSocketKuavoSDK()
452
- try:
453
- if not websocket or not websocket.client.is_connected:
454
- return False
455
-
456
- service = roslibpy.Service(websocket.client, '/rosapi/nodes', 'rosapi/Nodes')
457
- response = service.call({})
458
- nodes = response.get('nodes', [])
459
- return node_name in nodes
460
- except Exception as e:
461
- SDKLogger.error(f"Error checking if node {node_name} exists: {e}")
462
- return False
@@ -4,8 +4,7 @@ from typing import Tuple
4
4
  from kuavo_humanoid_sdk.interfaces.end_effector import EndEffector
5
5
  from kuavo_humanoid_sdk.interfaces.data_types import EndEffectorSide, EndEffectorState, KuavoDexHandTouchState
6
6
  from kuavo_humanoid_sdk.kuavo.core.dex_hand_control import DexHandControl
7
- from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore, KuavoRobotStateCoreWebsocket
8
- from kuavo_humanoid_sdk.common.global_config import GlobalConfig
7
+ from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore
9
8
 
10
9
  class DexterousHand(EndEffector):
11
10
  def __init__(self):
@@ -13,10 +12,7 @@ class DexterousHand(EndEffector):
13
12
  'r_thumb', 'r_thumb_aux', 'r_index', 'r_middle', 'r_ring', 'r_pinky',]
14
13
  super().__init__(joint_names=joint_names)
15
14
  self.dex_hand_control = DexHandControl()
16
- if GlobalConfig.use_websocket:
17
- self._rb_state = KuavoRobotStateCoreWebsocket()
18
- else:
19
- self._rb_state = KuavoRobotStateCore()
15
+ self._rb_state = KuavoRobotStateCore()
20
16
 
21
17
  def control(self, target_positions:list, target_velocities:list=None, target_torques:list=None)->bool:
22
18
  """Set the position of the hand.
@@ -5,17 +5,13 @@ from typing import Tuple
5
5
  from kuavo_humanoid_sdk.interfaces.end_effector import EndEffector
6
6
  from kuavo_humanoid_sdk.interfaces.data_types import EndEffectorSide, EndEffectorState
7
7
  from kuavo_humanoid_sdk.kuavo.core.leju_claw_control import LejuClawControl
8
- from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore, KuavoRobotStateCoreWebsocket
9
- from kuavo_humanoid_sdk.common.global_config import GlobalConfig
8
+ from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore
10
9
 
11
10
  class LejuClaw(EndEffector):
12
11
  def __init__(self):
13
12
  super().__init__(joint_names=['left_claw', 'right_claw'])
14
13
  self.leju_claw_control = LejuClawControl()
15
- if GlobalConfig.use_websocket:
16
- self._rb_state = KuavoRobotStateCoreWebsocket()
17
- else:
18
- self._rb_state = KuavoRobotStateCore()
14
+ self._rb_state = KuavoRobotStateCore()
19
15
 
20
16
  def control(self, target_positions: list, target_velocities:list=None, target_torques: list=None)->bool:
21
17
  """Control the claws to grip.
@@ -1,17 +1,18 @@
1
1
  #!/usr/bin/env python3
2
2
  # coding: utf-8
3
- from kuavo_humanoid_sdk.common.global_config import GlobalConfig
4
-
5
- from kuavo_humanoid_sdk.kuavo.core.ros_env import KuavoROSEnv, KuavoROSEnvWebsocket
6
- from kuavo_humanoid_sdk.interfaces.robot import RobotBase
7
- from kuavo_humanoid_sdk.common.logger import SDKLogger, disable_sdk_logging
8
- from kuavo_humanoid_sdk.interfaces.data_types import KuavoPose, KuavoIKParams
9
- from kuavo_humanoid_sdk.kuavo.core.core import KuavoRobotCore
10
-
11
- from typing import Tuple
12
- from kuavo_humanoid_sdk.kuavo.robot_info import KuavoRobotInfo
13
- from kuavo_humanoid_sdk.kuavo.robot_arm import KuavoRobotArm
14
- from kuavo_humanoid_sdk.kuavo.robot_head import KuavoRobotHead
3
+ from kuavo_humanoid_sdk.kuavo.core.ros_env import KuavoROSEnv
4
+ kuavo_ros_env = KuavoROSEnv()
5
+ if not kuavo_ros_env.Init():
6
+ raise RuntimeError("Failed to initialize ROS environment")
7
+ else:
8
+ from typing import Tuple
9
+ from kuavo_humanoid_sdk.kuavo.robot_info import KuavoRobotInfo
10
+ from kuavo_humanoid_sdk.kuavo.robot_arm import KuavoRobotArm
11
+ from kuavo_humanoid_sdk.kuavo.robot_head import KuavoRobotHead
12
+ from kuavo_humanoid_sdk.kuavo.core.core import KuavoRobotCore
13
+ from kuavo_humanoid_sdk.interfaces.robot import RobotBase
14
+ from kuavo_humanoid_sdk.interfaces.data_types import KuavoPose, KuavoIKParams
15
+ from kuavo_humanoid_sdk.common.logger import SDKLogger, disable_sdk_logging
15
16
 
16
17
  """
17
18
  Kuavo SDK - Python Interface for Kuavo Robot Control
@@ -44,30 +45,19 @@ class KuavoSDK:
44
45
  pass
45
46
 
46
47
  @staticmethod
47
- def Init(options:int=Options.Normal, log_level: str = "INFO",
48
- websocket_mode: bool = False, websocket_host='127.0.0.1', websocket_port=9090, websocket_timeout=5)-> bool:
48
+ def Init(options:int=Options.Normal, log_level: str = "INFO")-> bool:
49
49
  """Initialize the SDK.
50
+
50
51
  Args:
51
52
  log_level (str): The logging level to use. Can be "ERROR", "WARN", "INFO", "DEBUG".
52
53
  Defaults to "INFO".
53
- websocket_mode (bool): Whether to use websocket mode for ROS communication. If True,
54
- the SDK will connect to ROS through websocket instead of direct ROS connection.
55
- Defaults to False.
56
- websocket_host (str): The host address of the rosbridge websocket server when using
57
- websocket mode. Defaults to "127.0.0.1".
58
- websocket_port (int): The port number of the rosbridge websocket server when using
59
- websocket mode. Defaults to 9090.
60
- websocket_timeout (int): The timeout for the websocket connection. Defaults to 5.
54
+
61
55
  Returns:
62
56
  bool: True if initialization is successful, False otherwise.
63
57
 
64
58
  Raises:
65
59
  RuntimeError: If the initialization fails.
66
60
  """
67
- GlobalConfig.use_websocket = websocket_mode
68
- GlobalConfig.websocket_host = websocket_host
69
- GlobalConfig.websocket_port = websocket_port
70
- GlobalConfig.websocket_timeout = websocket_timeout
71
61
  SDKLogger.setLevel(log_level.upper())
72
62
  # Initialize core components, connect ROS Topics...
73
63
  kuavo_core = KuavoRobotCore()
@@ -75,18 +65,12 @@ class KuavoSDK:
75
65
  debug = True
76
66
  else:
77
67
  debug = False
78
- # Check if IK option is enabled
79
- if GlobalConfig.use_websocket:
80
- if options & KuavoSDK.Options.WithIK:
81
- if not KuavoROSEnvWebsocket.check_rosnode_exists('/arms_ik_node'):
82
- print("\033[31m\nError:WithIK option is enabled but ik_node is not running, please run `roslaunch motion_capture_ik ik_node.launch`\033[0m")
83
- exit(1)
84
- else:
85
- if options & KuavoSDK.Options.WithIK:
86
- if not KuavoROSEnv.check_rosnode_exists('/arms_ik_node'):
87
- print("\033[31m\nError:WithIK option is enabled but ik_node is not running, please run `roslaunch motion_capture_ik ik_node.launch`\033[0m")
88
- exit(1)
89
68
 
69
+ # Check if IK option is enabled
70
+ if options & KuavoSDK.Options.WithIK:
71
+ if not KuavoROSEnv.check_rosnode_exists('/arms_ik_node'):
72
+ print("\033[31m\nError:WithIK option is enabled but ik_node is not running, please run `roslaunch motion_capture_ik ik_node.launch`\033[0m")
73
+ exit(1)
90
74
 
91
75
  if not kuavo_core.initialize(debug=debug):
92
76
  SDKLogger.error("[SDK] Failed to initialize core components.")
@@ -102,16 +86,11 @@ class KuavoSDK:
102
86
  class KuavoRobot(RobotBase):
103
87
  def __init__(self):
104
88
  super().__init__(robot_type="kuavo")
105
-
106
- if not GlobalConfig.use_websocket:
107
- kuavo_ros_env = KuavoROSEnv()
108
- if not kuavo_ros_env.Init():
109
- raise RuntimeError("Failed to initialize ROS environment")
110
-
111
89
  self._robot_info = KuavoRobotInfo()
112
90
  self._robot_arm = KuavoRobotArm()
113
91
  self._robot_head = KuavoRobotHead()
114
92
  self._kuavo_core = KuavoRobotCore()
93
+
115
94
  def stance(self)->bool:
116
95
  """Put the robot into 'stance' mode.
117
96
 
@@ -2,8 +2,7 @@
2
2
  # coding: utf-8
3
3
  from typing import Tuple
4
4
  from kuavo_humanoid_sdk.interfaces.robot_info import RobotInfoBase
5
- from kuavo_humanoid_sdk.kuavo.core.ros.param import RosParameter, RosParamWebsocket, make_robot_param
6
- from kuavo_humanoid_sdk.common.global_config import GlobalConfig
5
+ from kuavo_humanoid_sdk.kuavo.core.ros.param import RosParameter, make_robot_param
7
6
 
8
7
  class KuavoRobotInfo(RobotInfoBase):
9
8
  def __init__(self, robot_type: str = "kuavo"):
@@ -11,11 +10,7 @@ class KuavoRobotInfo(RobotInfoBase):
11
10
 
12
11
  # Load robot parameters from ROS parameter server
13
12
  kuavo_ros_param = make_robot_param()
14
- if GlobalConfig.use_websocket:
15
- self._ros_param = RosParamWebsocket()
16
- else:
17
- self._ros_param = RosParameter()
18
-
13
+ self._ros_param = RosParameter()
19
14
  self._robot_version = kuavo_ros_param['robot_version']
20
15
  self._end_effector_type = kuavo_ros_param['end_effector_type']
21
16
  self._arm_joint_dof = kuavo_ros_param['arm_dof']
@@ -4,15 +4,11 @@ import time
4
4
  from typing import Tuple
5
5
  from kuavo_humanoid_sdk.interfaces.data_types import (
6
6
  KuavoImuData, KuavoJointData, KuavoOdometry, KuavoArmCtrlMode,EndEffectorState)
7
- from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore, KuavoRobotStateCoreWebsocket
8
- from kuavo_humanoid_sdk.common.global_config import GlobalConfig
7
+ from kuavo_humanoid_sdk.kuavo.core.ros.state import KuavoRobotStateCore
9
8
 
10
9
  class KuavoRobotState:
11
10
  def __init__(self, robot_type: str = "kuavo"):
12
- if GlobalConfig.use_websocket:
13
- self._rs_core = KuavoRobotStateCoreWebsocket()
14
- else:
15
- self._rs_core = KuavoRobotStateCore()
11
+ self._rs_core = KuavoRobotStateCore()
16
12
 
17
13
  @property
18
14
  def imu_data(self) -> KuavoImuData:
@@ -1,7 +1,6 @@
1
1
  from ._AprilTagDetection import *
2
2
  from ._AprilTagDetectionArray import *
3
3
  from ._Metadata import *
4
- from ._armHandPose import *
5
4
  from ._armPoseWithTimeStamp import *
6
5
  from ._armTargetPoses import *
7
6
  from ._dexhandCommand import *
@@ -12,24 +11,18 @@ from ._footPoseTargetTrajectories import *
12
11
  from ._gaitTimeName import *
13
12
  from ._gestureInfo import *
14
13
  from ._gestureTask import *
15
- from ._handPose import *
16
14
  from ._headBodyPose import *
17
- from ._ikSolveError import *
18
- from ._ikSolveParam import *
19
15
  from ._imuData import *
20
16
  from ._jointCmd import *
21
17
  from ._jointData import *
22
18
  from ._lejuClawCommand import *
23
19
  from ._lejuClawState import *
24
20
  from ._questJoySticks import *
25
- from ._robotArmQVVD import *
26
21
  from ._robotHandPosition import *
27
22
  from ._robotHeadMotionData import *
28
23
  from ._robotState import *
29
24
  from ._sensorsData import *
30
25
  from ._switchGaitByName import *
31
26
  from ._touchSensorStatus import *
32
- from ._twoArmHandPose import *
33
- from ._twoArmHandPoseCmd import *
34
27
  from ._yoloDetection import *
35
28
  from ._yoloOutputData import *
@@ -1,10 +1,7 @@
1
- from ._SpeechSynthesis import *
2
1
  from ._changeArmCtrlMode import *
3
- from ._changeArmCtrlModeKuavo import *
4
2
  from ._changeTorsoCtrlMode import *
5
3
  from ._controlLejuClaw import *
6
4
  from ._enableHandTouchSensor import *
7
- from ._fkSrv import *
8
5
  from ._footPoseTargetTrajectoriesSrv import *
9
6
  from ._gestureExecute import *
10
7
  from ._gestureExecuteState import *
@@ -17,4 +14,3 @@ from ._setHwIntialState import *
17
14
  from ._setMotorEncoderRoundService import *
18
15
  from ._setTagId import *
19
16
  from ._singleStepControl import *
20
- from ._twoArmHandPoseCmdSrv import *
@@ -8,15 +8,14 @@ import struct
8
8
 
9
9
 
10
10
  class playmusicRequest(genpy.Message):
11
- _md5sum = "24067736323ff98005697d24ca92721f"
11
+ _md5sum = "b4bd61c49344d06e17224a3598f23d8e"
12
12
  _type = "kuavo_msgs/playmusicRequest"
13
13
  _has_header = False # flag to mark the presence of a Header object
14
14
  _full_text = """string music_number
15
- float32 volume
16
- float32 speed
15
+ int64 volume
17
16
  """
18
- __slots__ = ['music_number','volume','speed']
19
- _slot_types = ['string','float32','float32']
17
+ __slots__ = ['music_number','volume']
18
+ _slot_types = ['string','int64']
20
19
 
21
20
  def __init__(self, *args, **kwds):
22
21
  """
@@ -26,7 +25,7 @@ float32 speed
26
25
  changes. You cannot mix in-order arguments and keyword arguments.
27
26
 
28
27
  The available fields are:
29
- music_number,volume,speed
28
+ music_number,volume
30
29
 
31
30
  :param args: complete set of field values, in .msg order
32
31
  :param kwds: use keyword arguments corresponding to message field names
@@ -38,13 +37,10 @@ float32 speed
38
37
  if self.music_number is None:
39
38
  self.music_number = ''
40
39
  if self.volume is None:
41
- self.volume = 0.
42
- if self.speed is None:
43
- self.speed = 0.
40
+ self.volume = 0
44
41
  else:
45
42
  self.music_number = ''
46
- self.volume = 0.
47
- self.speed = 0.
43
+ self.volume = 0
48
44
 
49
45
  def _get_types(self):
50
46
  """
@@ -64,8 +60,8 @@ float32 speed
64
60
  _x = _x.encode('utf-8')
65
61
  length = len(_x)
66
62
  buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
67
- _x = self
68
- buff.write(_get_struct_2f().pack(_x.volume, _x.speed))
63
+ _x = self.volume
64
+ buff.write(_get_struct_q().pack(_x))
69
65
  except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
70
66
  except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
71
67
 
@@ -87,10 +83,9 @@ float32 speed
87
83
  self.music_number = str[start:end].decode('utf-8', 'rosmsg')
88
84
  else:
89
85
  self.music_number = str[start:end]
90
- _x = self
91
86
  start = end
92
87
  end += 8
93
- (_x.volume, _x.speed,) = _get_struct_2f().unpack(str[start:end])
88
+ (self.volume,) = _get_struct_q().unpack(str[start:end])
94
89
  return self
95
90
  except struct.error as e:
96
91
  raise genpy.DeserializationError(e) # most likely buffer underfill
@@ -109,8 +104,8 @@ float32 speed
109
104
  _x = _x.encode('utf-8')
110
105
  length = len(_x)
111
106
  buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
112
- _x = self
113
- buff.write(_get_struct_2f().pack(_x.volume, _x.speed))
107
+ _x = self.volume
108
+ buff.write(_get_struct_q().pack(_x))
114
109
  except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
115
110
  except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
116
111
 
@@ -133,10 +128,9 @@ float32 speed
133
128
  self.music_number = str[start:end].decode('utf-8', 'rosmsg')
134
129
  else:
135
130
  self.music_number = str[start:end]
136
- _x = self
137
131
  start = end
138
132
  end += 8
139
- (_x.volume, _x.speed,) = _get_struct_2f().unpack(str[start:end])
133
+ (self.volume,) = _get_struct_q().unpack(str[start:end])
140
134
  return self
141
135
  except struct.error as e:
142
136
  raise genpy.DeserializationError(e) # most likely buffer underfill
@@ -145,12 +139,12 @@ _struct_I = genpy.struct_I
145
139
  def _get_struct_I():
146
140
  global _struct_I
147
141
  return _struct_I
148
- _struct_2f = None
149
- def _get_struct_2f():
150
- global _struct_2f
151
- if _struct_2f is None:
152
- _struct_2f = struct.Struct("<2f")
153
- return _struct_2f
142
+ _struct_q = None
143
+ def _get_struct_q():
144
+ global _struct_q
145
+ if _struct_q is None:
146
+ _struct_q = struct.Struct("<q")
147
+ return _struct_q
154
148
  # This Python file uses the following encoding: utf-8
155
149
  """autogenerated by genpy from kuavo_msgs/playmusicResponse.msg. Do not edit."""
156
150
  import codecs
@@ -269,6 +263,6 @@ def _get_struct_B():
269
263
  return _struct_B
270
264
  class playmusic(object):
271
265
  _type = 'kuavo_msgs/playmusic'
272
- _md5sum = '348f2445d1e569f5dc4e72a19fb11934'
266
+ _md5sum = '3d99283888736c5e18f20ac685e5f8bf'
273
267
  _request_class = playmusicRequest
274
268
  _response_class = playmusicResponse
@@ -0,0 +1,9 @@
1
+ from ._armHandPose import *
2
+ from ._handPose import *
3
+ from ._headBodyPose import *
4
+ from ._ikSolveError import *
5
+ from ._ikSolveParam import *
6
+ from ._robotArmQVVD import *
7
+ from ._robotHandPosition import *
8
+ from ._twoArmHandPose import *
9
+ from ._twoArmHandPoseCmd import *
@@ -1,5 +1,5 @@
1
1
  # This Python file uses the following encoding: utf-8
2
- """autogenerated by genpy from kuavo_msgs/armHandPose.msg. Do not edit."""
2
+ """autogenerated by genpy from motion_capture_ik/armHandPose.msg. Do not edit."""
3
3
  import codecs
4
4
  import sys
5
5
  python3 = True if sys.hexversion > 0x03000000 else False
@@ -9,7 +9,7 @@ import struct
9
9
 
10
10
  class armHandPose(genpy.Message):
11
11
  _md5sum = "4f28a253cb60d59c6491569369f38f4d"
12
- _type = "kuavo_msgs/armHandPose"
12
+ _type = "motion_capture_ik/armHandPose"
13
13
  _has_header = False # flag to mark the presence of a Header object
14
14
  _full_text = """float64[3] pos_xyz
15
15
  float64[4] quat_xyzw
@@ -1,5 +1,5 @@
1
1
  # This Python file uses the following encoding: utf-8
2
- """autogenerated by genpy from kuavo_msgs/handPose.msg. Do not edit."""
2
+ """autogenerated by genpy from motion_capture_ik/handPose.msg. Do not edit."""
3
3
  import codecs
4
4
  import sys
5
5
  python3 = True if sys.hexversion > 0x03000000 else False
@@ -9,7 +9,7 @@ import struct
9
9
 
10
10
  class handPose(genpy.Message):
11
11
  _md5sum = "1a83f0bdabe750ce0cfb45a14ec63457"
12
- _type = "kuavo_msgs/handPose"
12
+ _type = "motion_capture_ik/handPose"
13
13
  _has_header = False # flag to mark the presence of a Header object
14
14
  _full_text = """# pos
15
15
  float64 x