This commit is contained in:
ketrptr 2025-03-28 17:11:49 +01:00
parent eee7137144
commit c22a740e13
5 changed files with 40 additions and 2 deletions

View File

@ -38,6 +38,7 @@ class meArm:
for cmd in self.moves[idx]:
print(f"sending: {cmd}")
self.sendCmd(cmd)
return len(self.moves[idx])
def getPos(self):

View File

@ -55,7 +55,7 @@ void movePos(CMD dir) {
int delta = servoPos[dir] - val;
int inc;
while (delta) {
if(dir!=T) inc = (abs(delta) > 20) ? constrain((abs(delta) / 10), 1, 10) : 1;
if(dir!=T) inc = (abs(delta) > 20) ? constrain((abs(delta) / 10), 1, 5) : 1;
else inc =1;
if (delta > 0) {
axis[dir]->write(val + inc);
@ -67,7 +67,7 @@ void movePos(CMD dir) {
val -= inc;
}
delay(30); // TODO no delay
delay(20); // TODO no delay
}
}
}

2
testSequence1 Normal file
View File

@ -0,0 +1,2 @@
from meController import meArm

35
testSequence1.py Normal file
View File

@ -0,0 +1,35 @@
import meControll
arm = meControll.meArm()
arm.getPos()
getCube1 = [b'S1', b'T50', b'R100', b'L50', b'R120', b'L30', b'R140', b'G180', b'R100']
getCube2 = [b'S1', b'T50', b'R100', b'L50', b'R120', b'L30', b'R140', b'L20', b'R160', b'G180', b'R100']
gotoDropoff = [b'S1', b'T140', b'R100', b'L40', b'R145', b'G90', b'R100', b'D1']
gotoDropoff2 = [b'S1', b'T140', b'R100', b'L50', b'R133', b'G90', b'R100', b'D1']
gotoCubePickup0 = getCube1[0:-2]
saveHome = [b'S0', b'R-30', b'D1', b'S1']
# getCube2 = [b'S1', b'T140', b'R100', b'L40', b'R145', b'G180', b'R100', b'D1']
arm.addMove(getCube1)
arm.addMove(gotoDropoff)
arm.addMove(getCube2)
arm.addMove(gotoDropoff2)
arm.addMove(gotoCubePickup0)
arm.addMove(saveHome)
print(f"Homing")
arm.execMove(5)
print(f"Move0: {arm.execMove(0)} moves")
print(f"Move1: {arm.execMove(1)} moves")
print(f"Move2: {arm.execMove(2)} moves")
print(f"Move3: {arm.execMove(3)} moves")
print(f"Move4: {arm.execMove(4)} moves")
# arm.execMove(2)