@@ -746,7 +746,7 @@ def get_digital_in(self, pin_number):
746
746
Returns:
747
747
int: State of the pin (0 or 1).
748
748
"""
749
- command = "get_digital_in(" + str (pin_number ) + ")\n "
749
+ command = "get_digital_in(" + str (int ( pin_number ) ) + ")\n "
750
750
res = self .send_command (command )
751
751
return self .string_to_int (res )
752
752
@@ -759,7 +759,7 @@ def get_digital_out(self, pin_number):
759
759
Returns:
760
760
int: State of the pin (0 or 1).
761
761
"""
762
- command = "get_digital_out(" + str (pin_number ) + ")\n "
762
+ command = "get_digital_out(" + str (int ( pin_number ) ) + ")\n "
763
763
print (command )
764
764
res = self .send_command (command )
765
765
return self .string_to_int (res )
@@ -771,7 +771,13 @@ def set_digital_out(self, pin_number, pin_signal):
771
771
pin_number (int): Pin number (0-63).
772
772
pin_signal (int): Signal to set (0 or 1).
773
773
"""
774
- command = "set_digital_out(" + str (pin_number ) + "," + str (pin_signal ) + ")\n "
774
+ command = (
775
+ "set_digital_out("
776
+ + str (int (pin_number ))
777
+ + ","
778
+ + str (int (pin_signal ))
779
+ + ")\n "
780
+ )
775
781
self .send_command (command )
776
782
777
783
def get_analog_in (self , pin_number ):
@@ -783,7 +789,7 @@ def get_analog_in(self, pin_number):
783
789
Returns:
784
790
float: pin value
785
791
"""
786
- command = "get_analog_in(" + str (pin_number ) + ")\n "
792
+ command = "get_analog_in(" + str (int ( pin_number ) ) + ")\n "
787
793
res = self .send_command (command )
788
794
return self .string_to_double (res )
789
795
@@ -796,7 +802,7 @@ def get_analog_out(self, pin_number):
796
802
Returns:
797
803
float: pin value
798
804
"""
799
- command = "get_analog_out(" + str (pin_number ) + ")\n "
805
+ command = "get_analog_out(" + str (int ( pin_number ) ) + ")\n "
800
806
res = self .send_command (command )
801
807
return self .string_to_double (res )
802
808
@@ -807,7 +813,9 @@ def set_analog_out(self, pin_number, pin_value):
807
813
pin_number (int): pin number (0~63).
808
814
pin_value (float): pin value
809
815
"""
810
- command = "set_analog_out(" + str (pin_number ) + "," + str (pin_value ) + ")\n "
816
+ command = (
817
+ "set_analog_out(" + str (int (pin_number )) + "," + str (int (pin_value )) + ")\n "
818
+ )
811
819
self .send_command (command )
812
820
813
821
def get_joint_current (self , joint_number ):
@@ -918,7 +926,7 @@ def enable_manual_brake_control(self, enable=True):
918
926
enable (bool, optional): enable (True) or disable (False) manual
919
927
brake control. Defaults to True.
920
928
"""
921
- self .set_digital_out (DO .BRAKE_MANUAL_MODE_ENABLE , enable )
929
+ self .set_digital_out (DO .BRAKE_MANUAL_MODE_ENABLE . value , enable )
922
930
time .sleep (0.05 )
923
931
for joint in Joint :
924
932
self .release_joint_brake (joint , False )
@@ -930,15 +938,15 @@ def release_joint_brake(self, joint, release=True):
930
938
joint (Joint): joint Joint.J1 ~ Joint.J6
931
939
release (bool): True to release, False to enable brake. Defaults to True.
932
940
"""
933
- self .set_digital_out (DO (joint .value + DO .J1_BRAKE_RELEASE .value ), release )
941
+ self .set_digital_out (DO (joint .value + DO .J1_BRAKE_RELEASE .value ). value , release )
934
942
935
943
def is_collision_detected (self ):
936
944
"""Checks if collision is detected.
937
945
938
946
Returns:
939
947
bool: True if collision is detected, False otherwise.
940
948
"""
941
- return self .get_digital_in (DI .COLLISION_DETECTED ) == 1
949
+ return self .get_digital_in (DI .COLLISION_DETECTED . value ) == 1
942
950
943
951
def set_gripper_state (self , state , speed ):
944
952
"""Sets gripper state.
0 commit comments