from time import sleep
import sys

a = nanpyConnect()

M1En = 6
M1A = 7
M1B = 8
M2En = 11
M2A = 12
M2B = 13

motorK = 2
maxPWM = 255

M1 = Motor("LEFT", M1En, M1A, M1B)
M2 = Motor("RIGHT", M2En, M2A, M2B)

M1.pinSet(a)
M2.pinSet(a)

# Initiate the classes needed for this file
nav = Navigation()
nav.position()  # line that calls the position of the beacon
trig = Trig()

# coordinates of each waypoint in the room, starting from door side clockwise.
xArr = [5.1, 8.0, 6.0, 2.4, 0]  # x-coordinates of the waypoints
yArr = [2.5, -1.5, -3.5, 0.3, 0]  # y-coorindates of the waypoints
x1 = 0
y1 = 0
from MotorClass import Motor
from Trig import Trig
from math import fabs
from time import sleep
import sys

a = nanpyConnect()

M1En = 3
M1A = 4
M1B = 5
M2En = 11
M2A = 9
M2B = 10

motorK = 2
maxPWM = 255

AUTO = True
MANUAL = True

M1 = Motor("LEFT", M1En, M1A, M1B)
M2 = Motor("RIGHT", M2En, M2A, M2B)

M1.pinSet(a)
M2.pinSet(a)

AUTO = manualControl(a, M1, M2, MANUAL)
M1.stopAll(a)
M2.stopAll(a)
print(AUTO)
Exemple #3
0
#!/usr/bin/env python3.4


#### IMPORTS ####
import socket, select, string, sys, time
from epics import PV
import epics
import PVNames
from MotorClass import Motor
#import subprocess


#### DEFINITIONS ####
pvSampleY = PV(PVNames.sampleStageMotorY)
pvSampleX = Motor(PVNames.sampleStageMotorX)
pvMTS1 = Motor(PVNames.sampleMTS1MotorPVName)
pvMTS2 =  Motor(PVNames.sampleMTS2MotorPVName)
hutchStatus = PV(PVNames.hutchStatusPVName)

global 	OFFSET


##############################################################################################################################

#### PUT SAMPLE ON ROTATION STAGE FUNCTION ####
def SampleON(s, SampleNumber):
	
	# Update positions based on SampleY Offset
	P2='1;1;VAL=P2=(+160.55,-158.73,+' + str(OFFSET+641.88) + ',+94.73,+44.69,+48.81)(7,0)'
	P3='1;1;VAL=P3=(+294.59,-290.53,+' + str(OFFSET+630.84) + ',+94.73,+44.69,+48.81)(7,0)'
	P4='1;1;VAL=P4=(+294.59,-290.53,+' + str(OFFSET+613.04) + ',+94.73,+44.69,+48.81)(7,0)'
		with self._lock:
			return self.Sunrise
	def getPickTime(self):
		with self._lock:
			return self.PickTime
	def getUpTime(self):
		with self._lock:
			return self.UpTime
	def getDownTime(self):
		with self._lock:
			return self.DownTime


datat = Data()

motor = Motor()

def ListenToPort():
	UDP_IP = "192.168.0.38"
	UDP_PORT = 5005
	sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
	sock.bind((UDP_IP, UDP_PORT))
	SENDIP = "192.168.9.39"
	SENDPORT = 5005
	sock2 = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

	while True:
		data, addr = sock.recvfrom(1024)
		#print(data.decode())
		if "." in data.decode():
			SENDIP = data.decode()
Exemple #5
0
import sys

# CONNECT CONTROL AND ARDUINO
ps = psControl()
a = nanpyConnect()

# PIN SETUP
M1En = 5
M1A = 6
M1B = 7
M2En = 8
M2A = 9
M2B = 10

# MOTOR SETUP
M1 = Motor("LEFT", M1En, M1A, M1B)
M2 = Motor("RIGHT", M2En, M2A, M2B)
M1.pinSet(a)
M2.pinSet(a)

print 'IF AT ANY POINT THE MOTORS GO WILD, TRY HITTING X'
sleep(3)

while True:
    try:
        sleep(0.005)
        leftJoy = ps.joyStick(1)
        rightJoy = ps.joyStick(4)
        if leftJoy < 0:
            M1.directionSet("S", a)
            M1.pwmSet(leftJoy * -1, a)
from NanpyConnect import nanpyConnect
from time import sleep
from MotorClass import Motor

a = nanpyConnect()

M1EnPin = 5
M1APin = 6
M1BPin = 7
M2EnPin = 8
M2APin = 9
M2BPin = 10

# Enable and set each motor
M1 = Motor("LEFT", M1EnPin, M1APin, M1BPin)
M1.pinSet(a)

M2 = Motor("RIGHT", M2EnPin, M2APin, M2BPin)
M2.pinSet(a)
from NanpyConnect import nanpyConnect
from time import sleep
from MotorClass import Motor

a = nanpyConnect()

M1EnPin = 5
M1APin = 6
M1BPin = 7
M2EnPin = 8
M2APin = 9
M2BPin = 10

# Enable and set each motor
M1 = Motor("LEFT", M1EnPin, M1APin, M1BPin)
M1.pinSet(a)

M2 = Motor("RIGHT", M2EnPin, M2APin, M2BPin)
M2.pinSet(a)

# Now let's test some movements
try:
    print 'Moving FORWARD'  # forward turns the motor clockwise
    M1.directionSet(
        "W", a)  # Change these values here to change direction of motors
    M2.directionSet(
        "W", a)  # Change these values here to change direction of motors
    sleep(1)

    print 'Speeding Up'
    for x in range(0, 255):