from os import path sys.path.append(path.dirname(__file__) + 'lib/') #for generic functionality sys.path.append(path.dirname(__file__) + 'modules/') #specific to various hardware import random import struct from utilities import Utility from serial_manager import SerialManager utils = Utility() manager = SerialManager() print('\nSelect a port to connect to or a menu option below') manager.list_ports() from threads import AutoTimer, EventWrapper from data_structures import v2_drivetrain as v2dt from data_structures import mini_arm as marm marm.status = ord('k') v2dt.speed1 = 1 v2dt.speed2 = 255 v2dt.status = ord('k') def e0(): manager.write(marm.get_outgoing_struct())
from __future__ import unicode_literals import sys from os import path sys.path.append(path.dirname(__file__) + 'lib/') #for generic functionality sys.path.append(path.dirname(__file__) + 'modules/') #specific to various hardware import random import struct from utilities import Utility from serial_manager import SerialManager utils = Utility() manager = SerialManager() print('\nSelect a port to connect to or a menu option below') manager.list_ports() from threads import AutoTimer, EventWrapper from data_structures import v2_drivetrain as v2dt from data_structures import mini_arm as marm marm.status = ord('k') v2dt.speed1 = 1 v2dt.speed2 = 255 v2dt.status = ord('k') def e0(): manager.write(marm.get_outgoing_struct()) dataflag = False
print("Select a baudrate:") for baudrate in baudrates : print(str(baudrate) + ' bps') current_baudrate = raw_input() print (str(current_baudrate)) if int(current_baudrate) not in baudrates: print('incorrect baudrate selected') quit() ser.list_ports() for i, port in enumerate(ser.ports): if ser.open_port(i, current_baudrate): print('Scanning at ' + str(current_baudrate)) for i in range(0, 10): print('scanning servo at id ' + str(i)) try: r = Robotis_Servo(ser, i); ang = r.read_angle() print('Servo found at id ' + str(i) + ' at angle %.3f' % ang) except RuntimeError, e: pass ser.serial_io.close() time.sleep(1)
from utilities import Utility from serial_manager import SerialManager from pololu_controller import PololuController from Servo import * from data_structures import mini_arm as marm utils = Utility() alive = True def quit(): global alive alive = False manager1 = SerialManager() print 'Ports available' manager1.list_ports() print 'Select Dynamixel port' user_input = utils.getch() if manager1.open_port(user_input, 57600): serv_2 = Robotis_Servo(manager1, 1) print 'Setting up Dynamixel 2' print 'Dynamixel 2 at ' + str(serv_2.read_angle()) while(alive): serv_2.move_angle(1, 1.5, blocking=False) time.sleep(1) serv_2.move_angle(2, 1.5, blocking=False) time.sleep(1)
from utilities import Utility from serial_manager import SerialManager from pololu_controller import PololuController from Servo import * from data_structures import mini_arm as marm utils = Utility() alive = True def quit(): global alive alive = False manager1 = SerialManager() print('Ports available') manager1.list_ports() print('Select Dynamixel port') user_input = utils.getch() if manager1.open_port(user_input, 115200): serv2 = Robotis_Servo(manager1,2) print('Setting up Dynamixel') print('Dynamixel angle at ' + str(serv2.read_angle())) print('Dynamixel encoder at ' + str(serv2.read_encoder())) serv5 = Robotis_Servo(manager1,5) print('Setting up Dynamixel') print('Dynamixel angle at ' + str(serv5.read_angle())) print('Dynamixel encoder at ' + str(serv5.read_encoder()))