@@ -297,15 +297,15 @@ def home(
297
297
also load the encoder map if it exists. The encoder map is a polynomial that maps the encoder counts
298
298
to joint position in radians. This is useful for more accurate joint position estimation.
299
299
Args:
300
- homing_voltage (int) : Voltage in mV to use for homing. Default is 2000 mV.
301
- homing_frequency (int) : Frequency in Hz to use for homing. Default is the actuator's frequency.
302
- homing_direction (int) : Direction to move the actuator during homing. Default is -1.
303
- joint_direction (int) : Direction to move the joint during homing. Default is -1.
304
- joint_position_offset (float) : Offset in radians to add to the joint position. Default is 0.0.
305
- motor_position_offset (float) : Offset in radians to add to the motor position. Default is 0.0.
306
- current_threshold (int) : Current threshold in mA to stop homing the joint or actuator.
300
+ homing_voltage: Voltage in mV to use for homing. Default is 2000 mV.
301
+ homing_frequency: Frequency in Hz to use for homing. Default is the actuator's frequency.
302
+ homing_direction: Direction to move the actuator during homing. Default is -1.
303
+ joint_direction: Direction to move the joint during homing. Default is -1.
304
+ joint_position_offset: Offset in radians to add to the joint position. Default is 0.0.
305
+ motor_position_offset: Offset in radians to add to the motor position. Default is 0.0.
306
+ current_threshold: Current threshold in mA to stop homing the joint or actuator.
307
307
This is used to detect if the actuator or joint has hit a hard stop. Default is 5000 mA.
308
- velocity_threshold (float) : Velocity threshold in rad/s to stop homing the joint or actuator.
308
+ velocity_threshold: Velocity threshold in rad/s to stop homing the joint or actuator.
309
309
This is also used to detect if the actuator or joint has hit a hard stop. Default is 0.001 rad/s.
310
310
Examples:
311
311
>>> actuator = DephyActuator(port='/dev/ttyACM0')
@@ -457,7 +457,7 @@ def set_motor_torque(self, value: float) -> None:
457
457
"""
458
458
Sets the motor torque in Nm. This is the torque that is applied to the motor rotor, not the joint or output.
459
459
Args:
460
- value (float) : The torque to set in Nm.
460
+ value: The torque to set in Nm.
461
461
Returns:
462
462
None
463
463
Examples:
@@ -475,7 +475,7 @@ def set_joint_torque(self, value: float) -> None:
475
475
This is the torque that is applied to the joint, not the motor.
476
476
477
477
Args:
478
- value (float) : torque in N_m
478
+ value: torque in N_m
479
479
480
480
Returns:
481
481
None
@@ -494,7 +494,7 @@ def set_output_torque(self, value: float) -> None:
494
494
This is the torque that is applied to the joint, not the motor.
495
495
496
496
Args:
497
- value (float) : torque in N_m
497
+ value: torque in N_m
498
498
499
499
Returns:
500
500
None
@@ -514,7 +514,7 @@ def set_motor_current(
514
514
Sets the motor current in mA.
515
515
516
516
Args:
517
- value (float) : The current to set in mA.
517
+ value: The current to set in mA.
518
518
Returns:
519
519
None
520
520
@@ -534,15 +534,15 @@ def set_motor_voltage(self, value: float) -> None:
534
534
Sets the motor voltage in mV.
535
535
536
536
Args:
537
- value (float) : The voltage to set in mV.
537
+ value: The voltage to set in mV.
538
538
539
539
Returns:
540
540
None
541
541
542
542
Examples:
543
543
>>> actuator = DephyActuator(port='/dev/ttyACM0')
544
544
>>> actuator.start()
545
- >>> actuator.set_motor_voltage(100) TODO: Validate number
545
+ >>> actuator.set_motor_voltage(100)
546
546
"""
547
547
self .command_motor_voltage (value = int (value ))
548
548
@@ -556,7 +556,7 @@ def set_motor_position(self, value: float) -> None:
556
556
If in impedance mode, this sets the equilibrium angle in radians.
557
557
558
558
Args:
559
- value (float) : The position to set
559
+ value: The position to set
560
560
561
561
Returns:
562
562
None
@@ -593,10 +593,10 @@ def set_position_gains(
593
593
Sets the position gains in arbitrary Dephy units.
594
594
595
595
Args:
596
- kp (float) : The proportional gain
597
- ki (float) : The integral gain
598
- kd (float) : The derivative gain
599
- ff (float) : The feedforward gain
596
+ kp: The proportional gain
597
+ ki: The integral gain
598
+ kd: The derivative gain
599
+ ff: The feedforward gain
600
600
601
601
Returns:
602
602
None
@@ -626,10 +626,10 @@ def set_current_gains(
626
626
Sets the current gains in arbitrary Dephy units.
627
627
628
628
Args:
629
- kp (float) : The proportional gain
630
- ki (float) : The integral gain
631
- kd (float) : The derivative gain
632
- ff (float) : The feedforward gain
629
+ kp: The proportional gain
630
+ ki: The integral gain
631
+ kd: The derivative gain
632
+ ff: The feedforward gain
633
633
634
634
Returns:
635
635
None
@@ -666,12 +666,12 @@ def set_output_impedance(
666
666
B_motor = B_joint / (gear_ratio ** 2)
667
667
668
668
Args:
669
- kp (float) : Proportional gain. Defaults to 40.
670
- ki (float) : Integral gain. Defaults to 400.
671
- kd (float) : Derivative gain. Defaults to 0.
672
- k (float) : Spring constant. Defaults to 100 Nm/rad.
673
- b (float) : Damping constant. Defaults to 3.0 Nm/rad/s.
674
- ff (float) : Feedforward gain. Defaults to 128.
669
+ kp: Proportional gain. Defaults to 40.
670
+ ki: Integral gain. Defaults to 400.
671
+ kd: Derivative gain. Defaults to 0.
672
+ k: Spring constant. Defaults to 100 Nm/rad.
673
+ b: Damping constant. Defaults to 3.0 Nm/rad/s.
674
+ ff: Feedforward gain. Defaults to 128.
675
675
676
676
Returns:
677
677
None
@@ -704,12 +704,12 @@ def set_impedance_gains(
704
704
See Dephy's webpage for conversions or use other library methods that handle conversion for you.
705
705
706
706
Args:
707
- kp (float) : The proportional gain
708
- ki (float) : The integral gain
709
- kd (float) : The derivative gain
710
- k (float) : The spring constant
711
- b (float) : The damping constant
712
- ff (float) : The feedforward gain
707
+ kp: The proportional gain
708
+ ki: The integral gain
709
+ kd: The derivative gain
710
+ k: The spring constant
711
+ b: The damping constant
712
+ ff: The feedforward gain
713
713
714
714
Returns:
715
715
None
@@ -741,20 +741,20 @@ def set_motor_impedance(
741
741
Set the impedance gains of the motor in real units: Nm/rad and Nm/rad/s.
742
742
743
743
Args:
744
- kp (float) : Proportional gain. Defaults to 40.
745
- ki (float) : Integral gain. Defaults to 400.
746
- kd (float) : Derivative gain. Defaults to 0.
747
- k (float) : Spring constant. Defaults to 0.08922 Nm/rad.
748
- b (float) : Damping constant. Defaults to 0.0038070 Nm/rad/s.
749
- ff (float) : Feedforward gain. Defaults to 128.
744
+ kp: Proportional gain. Defaults to 40.
745
+ ki: Integral gain. Defaults to 400.
746
+ kd: Derivative gain. Defaults to 0.
747
+ k: Spring constant. Defaults to 0.08922 Nm/rad.
748
+ b: Damping constant. Defaults to 0.0038070 Nm/rad/s.
749
+ ff: Feedforward gain. Defaults to 128.
750
750
751
751
Returns:
752
752
None
753
753
754
754
Examples:
755
755
>>> actuator = DephyActuator(port='/dev/ttyACM0')
756
756
>>> actuator.start()
757
- >>> actuator.set_motor_impedance(kp=40, ki=400, kd=0, k=0.08922, b=0.0038070, ff=128) TODO: Validate numbers
757
+ >>> actuator.set_motor_impedance(kp=40, ki=400, kd=0, k=0.08922, b=0.0038070, ff=128)
758
758
"""
759
759
self .set_impedance_gains (
760
760
kp = kp ,
@@ -770,7 +770,7 @@ def set_encoder_map(self, encoder_map: np.polynomial.polynomial.Polynomial) -> N
770
770
Sets the joint encoder map
771
771
772
772
Args:
773
- encoder_map (np.polynomial.polynomial.Polynomial) : The encoder map to set
773
+ encoder_map: The encoder map to set
774
774
775
775
Returns:
776
776
None
@@ -1478,7 +1478,7 @@ def set_motor_current(
1478
1478
Sets the motor current in mA.
1479
1479
1480
1480
Args:
1481
- value (float) : The current to set in mA.
1481
+ value: The current to set in mA.
1482
1482
"""
1483
1483
self .send_motor_command (ctrl_mode = c_int (self .mode .value ), value = int (value ))
1484
1484
@@ -1491,7 +1491,15 @@ def set_motor_voltage(self, value: float) -> None:
1491
1491
Sets the motor voltage in mV.
1492
1492
1493
1493
Args:
1494
- value (float): The voltage to set in mV.
1494
+ value: The voltage to set in mV.
1495
+
1496
+ Returns:
1497
+ None
1498
+
1499
+ Examples:
1500
+ >>> actuator = DephyActuator(port='/dev/ttyACM0')
1501
+ >>> actuator.start()
1502
+ >>> actuator.set_motor_voltage(100)
1495
1503
"""
1496
1504
self .send_motor_command (ctrl_mode = c_int (self .mode .value ), value = int (value ))
1497
1505
@@ -1505,7 +1513,15 @@ def set_motor_position(self, value: float) -> None:
1505
1513
If in impedance mode, this sets the equilibrium angle in radians.
1506
1514
1507
1515
Args:
1508
- value (float): The position to set
1516
+ value: The position to set
1517
+
1518
+ Returns:
1519
+ None
1520
+
1521
+ Examples:
1522
+ >>> actuator = DephyActuator(port='/dev/ttyACM0')
1523
+ >>> actuator.start()
1524
+ >>> actuator.set_motor_position(0.1)
1509
1525
"""
1510
1526
self .send_motor_command (
1511
1527
ctrl_mode = c_int (self .mode .value ),
0 commit comments