Control Servo Speed with Ethernet problems
hello all,
my goal: control 2 servos on ethernet , slow down movement speed
where i:
i working on getting 2 servos work on ethernet controlled labview. i've gotten communications between arduino , labview working fine. got servo control working without load @ end of servos. put load on servos, start see oscillating motion on load. went check servo pulse widths thinking pulse width must changing gives me oscillating effect. @ servo pulse widths via serial communications , constant. notice when move slowly, less oscillation when abrupt movement them. rework move servo code to
side note: command() sent labview arduino , contains info want arduino do.
when @ error code labview,
i looked labview code , saw have 20 ms delay between send data , receive confirmation okay arduino.
my thoughts: @ best, if code can off ~10 micro seconds or time out. if changed delay mills(); things move faster in arduino code? using loop faster while loop? think should make delay servo movement larger, if that, make rest of labview code slower. however, can make copy of send/receive labview code servo only give servo delay ~150 or miliseconds.
thank in advance.
matt
my goal: control 2 servos on ethernet , slow down movement speed
where i:
i working on getting 2 servos work on ethernet controlled labview. i've gotten communications between arduino , labview working fine. got servo control working without load @ end of servos. put load on servos, start see oscillating motion on load. went check servo pulse widths thinking pulse width must changing gives me oscillating effect. @ servo pulse widths via serial communications , constant. notice when move slowly, less oscillation when abrupt movement them. rework move servo code to
side note: command() sent labview arduino , contains info want arduino do.
code: [select]
tempvar1 = servos[command[2]].readmicroseconds();
tempvar2 = (command[3] + (command[4]<<8));
if (tempvar1 >= tempvar2 + 3)
{
while (tempvar1 >tempvar2)
{
tempvar1--;
servos[comannd[2]].writemicroseconds(tempvar1);
delay(2);
}
}
else if (tempvar1 <= tempvar2 - 3)
{
while (tempvar1 < tempvar2)
{
tempvar1++;
servos[comannd[2]].writemicroseconds(tempvar1);
delay(2);
}
}
client.write('0');
when @ error code labview,
quote
timeout expired before operation completed.
i looked labview code , saw have 20 ms delay between send data , receive confirmation okay arduino.
my thoughts: @ best, if code can off ~10 micro seconds or time out. if changed delay mills(); things move faster in arduino code? using loop faster while loop? think should make delay servo movement larger, if that, make rest of labview code slower. however, can make copy of send/receive labview code servo only give servo delay ~150 or miliseconds.
thank in advance.
matt
making servo move slower reasonable thing do, although if it's prevent servo glitching might find behaviour still problematic under wrong conditions of load, speed, heat, humidity or whatever else effects mechanical characteristics of servo.
the code posted adjusts servo position in blocking manner - sketch stops , waits change completed before else.
a minimal change send acknowledgement , run delay loop update servo. note mean arduino didn't respond other events until change had completed.
a better approach make change asynchronously. approach be:
when receive command move servo, update variable holds desired position of servo. have other code runs @ regular intervals - code achieve similar 'blink without delay' example. when runs, compare current , desired position of servo , move servo towards required position. servo speed determined interval run code at, , size of step. approach easy add embellishments such controlling acceleration @ start , end of travel, , nothing here slows down arduino's response commands or prevents doing other things @ same time.
the code posted adjusts servo position in blocking manner - sketch stops , waits change completed before else.
a minimal change send acknowledgement , run delay loop update servo. note mean arduino didn't respond other events until change had completed.
a better approach make change asynchronously. approach be:
when receive command move servo, update variable holds desired position of servo. have other code runs @ regular intervals - code achieve similar 'blink without delay' example. when runs, compare current , desired position of servo , move servo towards required position. servo speed determined interval run code at, , size of step. approach easy add embellishments such controlling acceleration @ start , end of travel, , nothing here slows down arduino's response commands or prevents doing other things @ same time.
Arduino Forum > Using Arduino > Project Guidance > Control Servo Speed with Ethernet problems
arduino
Comments
Post a Comment