# uArm metal movement problem(running with arduino library)

Hello guys,

Finally, I achieved to run uArm metal with the last arduino library, but I realized that its movement is not as smoth as I expected. I dont’t know if this problem is only on my uArm, or it is a general problem?

In the following link you can see the problem that Im talking about.
http://sendvid.com/pg979eu5

The main loop code is the following:

`````` void loop()
{
run();

moveTo(x, y, 150, 2);
delay(2000);
if ((contx % 2) == 0) {
x -= 20;
}
else {
x += 20;
}

//-----------Lateral limit control

if (x <= -120) {
y -= 20;
contx++;
}
if (x >= 140) {
y -= 20;
contx++;
}

}
``````

Kind regards,
Sebastián

``````int x=100;
int y=200;// value of the y should always greater than 0
int contx=0;
void loop()
{
uArm.run();

if(uArm.isMoving()==false)//detect if the uarm is moving, if not then wait
{
uArm.moveTo(x, y, 150, 100);
delay(1000);
if ((contx % 2) == 0) {
x -= 20;
}
else {
x += 20;
}

//-----------Lateral limit control

if (x <= -120) {
y -= 70;
contx++;
}
if (x >= 140) {
y += 70;
contx++;
}
}
}
``````

There is one thing you have to pay attention to:
uArm.isMoving() : it’s a function which can be used to detect if the arm finish the former command. Technically, it should be always added in the loop() to make sure each command will be executed properly.

I’ve tried something like that and it is still moving abruptly. I think this movement is cause by this small oscillation on the base, as you can see in the following link:

http://sendvid.com/1dv02y2c

Is this oscillation normal?
Is it any way to fix this oscillation???

Kind regards,
Sebastian

The oscillation of the robot is normal and it’s called backlash. From the video, I think the backlash is normal. All the servos has the backlash. I think the main problem might still be the code. Did you tried the code above? I have tested the code I wrote above and everything seems well.
What’s more, if you tried the code and think it’s not still moving smoothly, you’d better disable the delay(1000); function in the code above.

I sent u a private message 3 days ago, anyway this function seems that isnt running on the last library?
When i did my code, I used functions from the move.ino in the Demos example library.

Hi there, I just found out that I was using the firmware 2.2.1 and Arduino IDE 1.6.12. It’s not the latest version of firmware. Sorry for that. Now I am using the firmware 2.2.3. Based on the move.ino, I improved your code.

``````int x=100,y=200,contx=0;
void loop()
{
run(); // Don't remove

moveTo(x, y, 150);

if ((contx % 2) == 0) {
x -= 20;
}
else {
x += 20;
}

//-----------Lateral limit control

if (x <= -120) {
y -= 20;
contx++;
}
if (x >= 140) {
y += 20;
contx++;
}

//	// TODO
//	moveTo(0, 150, 150);
//	moveTo(100, 150, 150);
//	pumpOn();
//	moveTo(-100, 200, 150);
//	pumpOff();

}
``````

In your original code, the value of y keeps reducing so it will be out of moving range easily. And also the delay(2000) function separates the each step for a long time and that should be the reason of unsmooth. My latest code might help you.
Thanks

1 Like