File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ servo.ListServos()
5858---
5959
6060### ` ReadLoad(sts_id) `
61- Get the motor load in % . Return ` None ` in case of error.
61+ Get the motor load (duty cycle) as signed integer between 1023 to -1024 . Return ` None ` in case of error.
6262
6363- ** Parameters** : ` sts_id ` (int)
64- - ** Returns** : ` float ` or ` None `
64+ - ** Returns** : ` int ` or ` None `
6565- ** Example** :
6666``` python
6767servo.ReadLoad(1 )
Original file line number Diff line number Diff line change @@ -57,16 +57,18 @@ def ListServos(self):
5757
5858 def ReadLoad (self , sts_id ):
5959 """
60- Load of the servo.
61- Load value is determined by: The voltage duty cycle of the current control output driving motor
60+ Load of the servo.
61+ Load value is the 10 bit duty cycle of the motor controller
6262
6363 :param sts_id: Servo ID
6464
65- :return: Load value in percentage . None in case of error.
65+ :return: motor duty cycle +1023 to -1024 . None in case of error.
6666 """
67- load , comm , error = self .read1ByteTxRx (sts_id , STS_PRESENT_LOAD_L )
67+ load , comm , error = self .read2ByteTxRx (sts_id , STS_PRESENT_LOAD_L )
6868 if comm == 0 and error == 0 :
69- return load * 0.1
69+ if load >= 1 << 10 :
70+ load = (1 << 10 ) - load
71+ return load
7072 else :
7173 return None
7274
You can’t perform that action at this time.
0 commit comments