@@ -23,6 +23,8 @@ def __init__(self, count: int, name: str, joint_names: List[str],
23
23
# Joint handles
24
24
self .joints = [Joint (jname + suffix )
25
25
for jname in joint_names ]
26
+ self ._joint_handles = [j .get_handle () for j in self .joints ]
27
+ self ._config_tree = self .get_configuration_tree ()
26
28
27
29
def copy (self ) -> 'RobotComponent' :
28
30
"""Copy and pastes the arm in the scene.
@@ -83,14 +85,11 @@ def set_joint_positions(self, positions: List[float]) -> None:
83
85
values depending on the joint type).
84
86
"""
85
87
self ._assert_len (positions )
86
-
87
- prev_mode = self .get_joint_modes ()
88
- self .set_joint_mode (JointMode .IK )
89
- [j .set_joint_position (p ) # type: ignore
90
- for j , p in zip (self .joints , positions )]
91
- [j .set_joint_target_position (p ) # type: ignore
88
+ sim .simSetConfigurationTree (self ._config_tree )
89
+ [sim .simSetJointPosition (jh , p ) # type: ignore
90
+ for jh , p in zip (self ._joint_handles , positions )]
91
+ [j .set_joint_target_position (p )
92
92
for j , p in zip (self .joints , positions )]
93
- self .set_joint_mode (prev_mode [0 ])
94
93
95
94
def get_joint_target_positions (self ) -> List [float ]:
96
95
"""Retrieves the target positions of the joints.
0 commit comments