Coverage for src/robotics_numpy/models/__init__.py: 26%

35 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2025-07-14 16:02 +0200

1""" 

2Models module for robotics-numpy 

3 

4This module provides robot model functionality including: 

5- DH parameter robot definitions 

6- Common robot models (Stanford Arm, 6-DOF arms, etc.) 

7- Robot model validation and manipulation 

8- Forward kinematics computation 

9 

10The module is designed to be lightweight and fast, using only NumPy. 

11""" 

12 

13from .dh_link import ( 

14 DHLink, 

15 RevoluteDH, 

16 PrismaticDH, 

17 dh_check_parameters, 

18 create_6dof_revolute_arm, 

19) 

20 

21from .dh_robot import ( 

22 DHRobot, 

23 create_simple_arm, 

24 create_planar_arm, 

25) 

26 

27from .stanford import ( 

28 Stanford, 

29 create_stanford_arm, 

30) 

31 

32from .generic import ( 

33 Generic, 

34 create_generic_robot, 

35) 

36 

37__all__ = [ 

38 # DH Link classes 

39 "DHLink", 

40 "RevoluteDH", 

41 "PrismaticDH", 

42 "dh_check_parameters", 

43 "create_6dof_revolute_arm", 

44 

45 # Robot classes 

46 "DHRobot", 

47 "create_simple_arm", 

48 "create_planar_arm", 

49 

50 # Specific robot models 

51 "Stanford", 

52 "create_stanford_arm", 

53 

54 # Generic robot models 

55 "Generic", 

56 "create_generic_robot", 

57] 

58 

59# Version for Phase 2 

60_MODELS_VERSION = "0.2.0-dev" 

61 

62# Available robot models 

63AVAILABLE_MODELS = { 

64 "stanford": "Stanford Arm (6-DOF with prismatic joint)", 

65 "simple_arm": "Simple n-DOF revolute arm for testing", 

66 "planar_arm": "Planar n-DOF arm (all joints parallel)", 

67 "generic": "Generic robot with configurable DH parameters", 

68} 

69 

70def list_models() -> None: 

71 """Print available robot models.""" 

72 print("Available Robot Models in robotics-numpy:") 

73 print("=" * 50) 

74 for name, description in AVAILABLE_MODELS.items(): 

75 print(f" {name:15s}: {description}") 

76 print() 

77 print("Usage examples:") 

78 print(" >>> from robotics_numpy.models import Stanford, Generic") 

79 print(" >>> robot = Stanford()") 

80 print(" >>> T = robot.fkine([0, 0, 0, 0, 0, 0])") 

81 print(" >>> generic_robot = Generic(dofs=4)") 

82 

83def about_models() -> None: 

84 """Print information about models module.""" 

85 print("Robotics NumPy - Models Module") 

86 print("=============================") 

87 print() 

88 print("Features implemented:") 

89 print(" ✅ DH parameter robot definitions") 

90 print(" ✅ Forward kinematics computation") 

91 print(" ✅ Stanford Arm robot model") 

92 print(" ✅ Simple and planar arm generators") 

93 print(" ✅ Robot model validation") 

94 print() 

95 print("Coming soon:") 

96 print(" 🚧 URDF parsing support") 

97 print(" 🚧 More industrial robot models") 

98 print(" 🚧 Robot visualization") 

99 print() 

100 list_models()