Exemple #1
0
from __future__ import division, print_function
import sys
import time

from dovecot.ext.pydyn import MotorSet
import dotdot
import dovecot
from dovecot.stemsim import stemcfg

if len(sys.argv) >= 2:
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ms = MotorSet(serial_id=stem.serial_id, motor_range=stem.motorid_range, verbose=True)

for m in ms.motors:
    m.status_return_level = 1
    time.sleep(0.1)
ms.compliant = True
time.sleep(0.1)
Exemple #2
0
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ps = powerswitch.Eps4m(mac_address=stemcfg.stems[stem.uid].powerswitch_mac, load_config=True)
ps_port = stemcfg.stems[stem.uid].powerswitch
if ps.is_off(ps_port):
    ps.set_on(ps_port)
    time.sleep(1)
while ps.is_restarting(ps_port):
    time.sleep(1)

ms = MotorSet(serial_id=stem.serial_id, motor_range=stem.motorid_range, verbose=True)
#ms.zero_pose    = stem.zero_pose
#ms.angle_ranges = stem.angle_ranges

def observe_max_angles():
    max_angles = [[float('inf'), float('-inf')] for _ in ms.motors]
    start = time.time()
    while time.time()-start < 60.0:
        max_angles = [[min(lb, p), max(hb, p)] for (lb, hb), p in zip(max_angles, ms.pose)]

    print(', '.join(gfx.ppv(ma) for ma in max_angles))


ms.max_torque            = 100
ms.ccw_angle_limit       =  150
ms.cw_angle_limit        = -150
Exemple #3
0
from __future__ import division, print_function
import sys

from dovecot.ext.pydyn import MotorSet
import dotdot
import dovecot
from dovecot.stemsim import stemcfg

if len(sys.argv) >= 2:
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ms = MotorSet(serial_id=stem.serial_id,
              motor_range=stem.motorid_range,
              verbose=True)
for m in ms.motors:
    print(m.ram_desc())
Exemple #4
0
uid = dovecot.stem_uid()

pose = [float(sys.argv[i + 1]) for i in range(6)]

stem = stemcfg.stems[uid]
stem.cycle_usb()

ps = powerswitch.Eps4m(mac_address=stemcfg.stems[stem.uid].powerswitch_mac,
                       load_config=True)
ps_port = stemcfg.stems[stem.uid].powerswitch
if ps.is_off(ps_port):
    ps.set_on(ps_port)
    time.sleep(1)
while ps.is_restarting(ps_port):
    time.sleep(1)

ms = MotorSet(serial_id=stem.serial_id,
              motor_range=stem.motorid_range,
              timeout=10,
              verbose=True)
ms.zero_pose = stem.zero_pose

ms.moving_speed = 100
ms.max_torque = 100
ms.torque_limit = 100
ms.pose = pose

time.sleep(2.0)
print("pos: [{}]".format(', '.join('{:.1f}'.format(p) for p in ms.pose)))
Exemple #5
0
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ps = powerswitch.Eps4m(mac_address=stemcfg.stems[stem.uid].powerswitch_mac,
                       load_config=True)
ps_port = stemcfg.stems[stem.uid].powerswitch
if ps.is_off(ps_port):
    ps.set_on(ps_port)
    time.sleep(1)
while ps.is_restarting(ps_port):
    time.sleep(1)

ms = MotorSet(serial_id=stem.serial_id,
              motor_range=stem.motorid_range,
              verbose=True)
#ms.zero_pose    = stem.zero_pose
#ms.angle_ranges = stem.angle_ranges


def observe_max_angles():
    max_angles = [[float('inf'), float('-inf')] for _ in ms.motors]
    start = time.time()
    while time.time() - start < 60.0:
        max_angles = [[min(lb, p), max(hb, p)]
                      for (lb, hb), p in zip(max_angles, ms.pose)]

    print(', '.join(gfx.ppv(ma) for ma in max_angles))

Exemple #6
0
from __future__ import division, print_function
import sys
import time

from dovecot.ext.pydyn import MotorSet
import dotdot
import dovecot
from dovecot.stemsim import stemcfg

if len(sys.argv) >= 2:
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ms = MotorSet(serial_id=stem.serial_id,
              motor_range=stem.motorid_range,
              verbose=True)

ms.compliant = False
ms.pose = ms.pose
ms.torque_limit = 50
time.sleep(1.0)
Exemple #7
0
import dotdot
import dovecot
from dovecot.ext import powerswitch
from dovecot.stemsim import stemcfg

uid = dovecot.stem_uid()

pose = [float(sys.argv[i + 1]) for i in range(6)]

stem = stemcfg.stems[uid]
stem.cycle_usb()

ps = powerswitch.Eps4m(mac_address=stemcfg.stems[stem.uid].powerswitch_mac, load_config=True)
ps_port = stemcfg.stems[stem.uid].powerswitch
if ps.is_off(ps_port):
    ps.set_on(ps_port)
    time.sleep(1)
while ps.is_restarting(ps_port):
    time.sleep(1)

ms = MotorSet(serial_id=stem.serial_id, motor_range=stem.motorid_range, timeout=10, verbose=True)
ms.zero_pose = stem.zero_pose

ms.moving_speed = 100
ms.max_torque = 100
ms.torque_limit = 100
ms.pose = pose

time.sleep(2.0)
print("pos: [{}]".format(", ".join("{:.1f}".format(p) for p in ms.pose)))
Exemple #8
0
import dotdot
import dotdot
import dovecot
from dovecot.ext import powerswitch
from dovecot.stemsim import stemcfg

if len(sys.argv) >= 2:
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ms = MotorSet(serial_id=stem.serial_id,
              motor_range=stem.motorid_range,
              verbose=True)
ms.zero_pose = stem.zero_pose
ms.angle_limits = stem.angle_limits


def go_to(ms, pose, margin=10.0, timeout=5.0):
    start = time.time()
    ms.pose = pose

    while (time.time() - start < timeout and
           max(abs(p - tg)
               for p, tg in zip(ms.pose, pose) if tg is not None) > 10):
        time.sleep(0.1)

Exemple #9
0
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ps = powerswitch.Eps4m(mac_address=stemcfg.stems[stem.uid].powerswitch_mac, load_config=True)
ps_port = stemcfg.stems[stem.uid].powerswitch
if ps.is_off(ps_port):
    ps.set_on(ps_port)
    time.sleep(1)
while ps.is_restarting(ps_port):
    time.sleep(1)

ms = MotorSet(serial_id=stem.serial_id, motor_range=stem.motorid_range, verbose=True)
ms.zero_pose = stem.zero_pose
ms.angle_limits = stem.angle_limits


def go_to(ms, pose, margin=10.0, timeout=5.0):
    start = time.time()
    ms.pose = pose

    while (time.time() - start < timeout and
           max(abs(p - tg) for p, tg in zip(ms.pose, pose) if tg is not None) > 10):
        time.sleep(0.1)


if max(abs(p-0.0) for p in ms.pose[3:]) > 10.0:
Exemple #10
0
from dovecot.ext.pydyn import MotorSet
import dotdot
import dovecot
from dovecot.stemsim import stemcfg

if len(sys.argv) >= 2:
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ms = MotorSet(serial_id=stem.serial_id,
              motor_range=(0, 253),
              timeout=10,
              verbose=True)


def change(id_change):
    for m in ms.motors:
        if m.id == id_change[0]:
            print("changing id of motor {} to {}".format(*id_change))
            m.id = id_change[1]
            time.sleep(1.0)


#change((1, 13))
#change((52, 11))
Exemple #11
0
from __future__ import division, print_function
import sys
import time

from dovecot.ext.pydyn import MotorSet
import dotdot
import dovecot
from dovecot.stemsim import stemcfg

if len(sys.argv) >= 2:
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ms = MotorSet(serial_id=stem.serial_id, motor_range=stem.motorid_range, verbose=True)

ms.compliant = False
ms.pose = ms.pose
ms.torque_limit = 50
time.sleep(1.0)
Exemple #12
0
    uid = int(sys.argv[1])
else:
    uid = dovecot.stem_uid()

stem = stemcfg.stems[uid]
stem.cycle_usb()

ps = powerswitch.Eps4m(mac_address=stemcfg.stems[stem.uid].powerswitch_mac, load_config=True)
ps_port = stemcfg.stems[stem.uid].powerswitch
if ps.is_off(ps_port):
    ps.set_on(ps_port)
    time.sleep(1)
while ps.is_restarting(ps_port):
    time.sleep(1)

ms = MotorSet(serial_id=stem.serial_id, motor_range=stem.motorid_range, verbose=True)
ms.zero_pose = stem.zero_pose
ms.angle_limits = stem.angle_limits

ms.compliant = False
time.sleep(0.1)

ms.moving_speed    = 100
ms.torque_limit = 50

rest_pose = [5.3, 96.3, -97.8, 0.6, -46.5, -10]
ms.pose = rest_pose

while max(abs(p - tg) for p, tg in zip(ms.pose, rest_pose)) > 10:
    time.sleep(0.1)