I'm trying to utilize this to code a sequence, but it seems to only go to the last position. Is there any way to do this? Here's my attempt:
import time
MIN_S = 0
MIN_G = 0
CENTER_S = 6000
CENTER_G = 6000
MAX_S = 12000
MAX_G = 12000
class RubikSolve:
# Pass the maestro controller object and the maestro channel numbers being used
# for the left and right motor controllers. See maestro.py on how to instantiate maestro.
def __init__(self, maestro, rightSlider, rightGripper):
self.maestro = maestro
self.rightSlider = rightSlider
self.rightGripper = rightGripper
# Init motor accel/speed params
self.maestro.setAccel(rightSlider,0)
self.maestro.setAccel(rightGripper,0)
self.maestro.setSpeed(rightSlider, 0)
self.maestro.setSpeed(rightGripper, 110)
# Motor min/center/max values
self.minS = MIN_S
self.minG = MIN_G
self.centerS = CENTER_S
self.centerG = CENTER_G
self.maxS = MAX_S
self.maxG = MAX_G
def servoMove(self, servo, position):
self.maestro.setTarget(servo, position)
# Right
def R_clock(self):
self.servoMove(self.rightSlider, self.minS)
print('rightSlider')
time.sleep(1)
self.servoMove(self.rightGripper, self.minG)
print('rightGripper')
time.sleep(1)
self.servoMove(self.rightSlider, self.maxS)
print('rightSlider')
time.sleep(1)
self.servoMove(self.rightGripper, self.maxG)
print('rightGripper')
Then once that's defined I run this:
import maestro
m = maestro.Controller()
rs = RubikSolve(m, 0, 1) #maestro channels 0 and 1 for left and right motors
for i in range(1):
rs.R_clock()
m.close()
I'm trying to utilize this to code a sequence, but it seems to only go to the last position. Is there any way to do this? Here's my attempt:
Then once that's defined I run this:
Am I missing something simple here?