Skip to content

Commit e74ca21

Browse files
committed
fix old description and type hints
1 parent 5dbccab commit e74ca21

File tree

1 file changed

+15
-11
lines changed
  • dynamic_payload_analysis_core/dynamic_payload_analysis_core

1 file changed

+15
-11
lines changed

dynamic_payload_analysis_core/dynamic_payload_analysis_core/core.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,10 @@ def get_normalized_torques(self, tau : np.ndarray, target_torque : np.ndarray =
767767
else:
768768
norm_tau.append(0.0)
769769

770-
return norm_tau
770+
return np.array(norm_tau, dtype=float)
771771

772772

773-
def get_normalized_payload(self, payload : np.ndarray, target_payload : float) -> np.ndarray:
773+
def get_normalized_payload(self, payload : float, target_payload : float) -> float:
774774
"""
775775
Normalize the torques vector to a unified scale.
776776
@@ -783,12 +783,11 @@ def get_normalized_payload(self, payload : np.ndarray, target_payload : float) -
783783
return norm_payload
784784

785785

786-
def get_unified_configurations_torque(self, valid_configs : np.ndarray) -> np.ndarray | np.ndarray:
786+
def get_unified_configurations_torque(self, valid_configs : np.ndarray) -> np.ndarray:
787787
"""
788788
Get a unified sum of torques for all possible configurations of the robot model.
789789
790-
:param q: Joint configuration vector.
791-
:param valid_configs: Array of
790+
:param valid_configs: Array of valid configurations
792791
"""
793792

794793
torques_sum = np.array([], dtype=float)
@@ -905,7 +904,8 @@ def get_analyzed_points(self) -> np.ndarray:
905904
def get_random_configuration(self) -> tuple[np.ndarray, np.ndarray]:
906905
"""
907906
Get a random configuration for configuration and velocity vectors.
908-
:return: Random configuration vectors.
907+
908+
:return: Random configuration vectors for joint positions and velocities.
909909
"""
910910
q_limits_lower = self.model.lowerPositionLimit
911911
q_limits_upper = self.model.upperPositionLimit
@@ -1019,6 +1019,8 @@ def set_position(self, pos_joints : list[float], name_positions : list[str] ) ->
10191019
10201020
:param pos_joints: List of joint positions provided by jointstate publisher.
10211021
:param name_positions: List of joint names in the order provided by jointstate publisher.
1022+
1023+
:return: Joint configuration vector in pinocchio format.
10221024
"""
10231025

10241026
q = np.zeros(self.model.nq)
@@ -1050,7 +1052,8 @@ def get_position_for_joint_states(self, q : np.ndarray) -> np.ndarray:
10501052
Example: continuous joints (wheels) are represented as two values in the configuration vector but
10511053
in the joint state publisher they are represented as one value (angle).
10521054
1053-
:param q : Joint configuration provided by pinocchio library
1055+
:param q: Joint configuration provided by pinocchio library
1056+
10541057
:return: Joint positions in the format of joint state publisher.
10551058
"""
10561059

@@ -1073,7 +1076,7 @@ def get_position_for_joint_states(self, q : np.ndarray) -> np.ndarray:
10731076

10741077
cont += self.model.joints[i].nq
10751078

1076-
return config
1079+
return np.array(config, dtype=object)
10771080

10781081

10791082
def get_joints_placements(self, q : np.ndarray) -> np.ndarray | float:
@@ -1097,15 +1100,15 @@ def get_joints_placements(self, q : np.ndarray) -> np.ndarray | float:
10971100
return placements, offset_z
10981101

10991102

1100-
def get_joint_name(self, id_joint: int) -> np.ndarray:
1103+
def get_joint_name(self, joint_id: int) -> str:
11011104
"""
11021105
Get the name of the joint by its ID.
11031106
1104-
:param id_joint: ID of the joint to get the name for.
1107+
:param joint_id: ID of the joint to get the name for.
11051108
:return: Name of the joint.
11061109
"""
11071110

1108-
return self.model.names[id_joint]
1111+
return self.model.names[joint_id]
11091112

11101113
def get_joint_placement(self, joint_id : int, q : np.ndarray) -> dict:
11111114
"""
@@ -1166,6 +1169,7 @@ def get_frames(self) -> np.ndarray:
11661169
def get_links(self,all_frames : bool = False) -> np.ndarray:
11671170
"""
11681171
Get the array of link names for payload menu.
1172+
11691173
:param all_frames: If True, return all frames, otherwise return only current tip frames.
11701174
:return: array of link names.
11711175
"""

0 commit comments

Comments
 (0)