Exemplo n.º 1
0
from Alpes.Specification import *
from Alpes.Prosthesis import AlpesProsthesis
import time

h = AlpesProsthesis()
h.initialise()

# Start flexing fingers
h.write_positions([5000, 19000, 40000, 40000, 40000, 40000])
# Reading while fingers are moving
print('Flexsion: reading motor positions and velocities ...')
for i in range(25):
    print('Pos.: %s, Vel.: %s' % (h.read_positions(), h.read_velocities()))
    time.sleep(0.1)

# Start extending fingers
h.write_positions([0, 0, 0, 0, 0, 0])
# Reading while fingers are moving
print('Extension: reading motor positions and velocities ...')
for i in range(25):
    print('Pos.: %s, Vel.: %s' % (h.read_positions(), h.read_velocities()))
    time.sleep(0.1)

# Positions are measured in encoder ticks.
# Velocities are measured in rpm of the motor shaft after reduction.
Exemplo n.º 2
0
from Alpes.Specification import *
from Alpes.Prosthesis import AlpesProsthesis
import time

h = AlpesProsthesis()
h.initialise()

# Set current limit to zero: this will forbid the motor from drawing any current:
h.set_current_limits([0], [VOIES.AURICULAIRE])

# Now try to move this finger with the current limited to 0:
h.write_positions([MAXIMAL_MOTOR_POSITIONS[VOIES.AURICULAIRE]],
                  [VOIES.AURICULAIRE])
print(
    'Position command is sent but current is limited to zero. No rotation ...')
time.sleep(5)

# Setup default current limit:
h.set_current_limits([CONTROLE_COURANT.LIMITE_COURANT_DEFAUT],
                     [VOIES.AURICULAIRE])
print('Setting up default current limit. Rotation is possible.')
time.sleep(5)

# Go back to initial position:
print('Getting back ...')
h.write_positions([0], [VOIES.AURICULAIRE])
time.sleep(5)
Exemplo n.º 3
0
from Alpes.Specification import *
from Alpes.Prosthesis import AlpesProsthesis
import time

h = AlpesProsthesis()
h.initialise()

# Can write to motors separately:
for motor in [2, 3, 4, 5]:
    h.write_positions([40000], [motor])
    time.sleep(3)

# Can write to all of them at once.
h.write_positions([0, 0, 0, 0, 0, 0])
time.sleep(3)
import time

h = AlpesProsthesis()
h.initialise()

# Apply increasing tension to the motors:
print('Positive tension to the motor ...')
N = 10
for i in range(1, N + 1):
    h.write_tensions([i / N * MOTORSPEC.MAXIMAL_ABSOLUTE_TENSION / 2],
                     [VOIES.AURICULAIRE])
    time.sleep(4 / N)
    print('Tension: %2.2f V' %
          (i / N * MOTORSPEC.MAXIMAL_ABSOLUTE_TENSION / 2))

# Apply decreasing negative tension to the motors:
print('Negative tension to the motor ...')
for i in range(N + 1):
    h.write_tensions([-i / N * MOTORSPEC.MAXIMAL_ABSOLUTE_TENSION / 2],
                     [VOIES.AURICULAIRE])
    time.sleep(2 / N)
    print('Tension: %2.2f V' %
          (-i / N * MOTORSPEC.MAXIMAL_ABSOLUTE_TENSION / 2))

print('Stopeed applying tension.')
time.sleep(2.5)

print('Getting back to initial position ...')
h.write_positions([0] * 6)
time.sleep(5)