Example #1
0
 def __init__(self, device_path=None, baud_rate=57600):
     self.device_path = device_path
     self.baud_rate = baud_rate
     self.portHandler = PortHandler(self.device_path,
                                    baudrate=self.baud_rate)
     self.portHandler.openPort()
     self.packetHandler = PacketHandler(XM430W350.PROTOCOL_VERSION)
Example #2
0
from properties import properties
print(properties)

#Command line arguments
timestamp = False
verbose = False
for argument in sys.argv:
    if argument == '-v':
        verbose = True
    elif argument == '-t':
        timestamp = True

#Remember: launch pigpio daemon (sudo pigpiod)

#declare packetHandler
packetHandler = PacketHandler(verbose)

#declare pigpio
pi = pigpio.pi()

#create servos
pan = Servo(pi, properties['pan_pin'], properties['starting_position'],
            properties['min_position'], properties['max_position'],
            properties['invert_x'])

#allow servos a second to connect
sleep(1)


def moveServos(values):
    pan.moveTo(pi, values[0])
Example #3
0
## Initiate global variables

## Perhaps create a dictionary for all the attributes of a specific motor
# import modules
import os  # for key presses, reading and writing
from packet_handler import PacketHandler
from port_handler import PortHandler
import AX_constants as AX

# Initialize PortHandler instance
# Set the port path
portHandler = PortHandler(AX.DEVICE_PORT)

# Initialize PacketHandler instance
# Set the protocol version
packetHandler = PacketHandler(AX.DEVICE_PROTOCOL)


def getch():
    """Arguments:
        Return: ch
        Description: commands to get key presses
    """
    if os.name == 'nt':
        import msvcrt
        return msvcrt.getch().decode()
    else:
        import sys, tty, termios
        fd = sys.stdin.fileno()
        old_settings = termios.tcgetattr(fd)
        try: