LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

robotics

I am using the following Formula Node in LabVIEW myRIO for 2 dof robotic arms. The inverse kinematics part works good. But I am trying to draw a straight line as well. But I fail. Please suggest me to rectify error.

 

float g=atan2(Y,X);
float d=abs(sqrt(X**2+Y**2));
int t;
for (t=0; t<=4; ++t)
{
float q[5]={0.2,0.4,0.6,0.8,1.0};
float X1=q[t]*cos(g)*d;
float Y1=q[t]*sin(g)*d;
float c2=(X1**2+Y1**2-l1**2-l2**2)/(2.0*l1*l2);
float s2=-sqrt(1-c2*c2);
float Theta2=atan2(s2,c2);
float k1=l1+l2*c2;
float k2=l2*s2;
float Theta1=atan2(Y1,X1)-atan2(k2,k1);
}

0 Kudos
Message 1 of 9
(4,060 Views)

@Blesson wrote:

I am using the following Formula Node in LabVIEW myRIO for 2 dof robotic arms. The inverse kinematics part works good. But I am trying to draw a straight line as well. But I fail. Please suggest me to rectify error.

 

float g=atan2(Y,X);
float d=abs(sqrt(X**2+Y**2));
int t;
for (t=0; t<=4; ++t)
{
float q[5]={0.2,0.4,0.6,0.8,1.0};
float X1=q[t]*cos(g)*d;
float Y1=q[t]*sin(g)*d;
float c2=(X1**2+Y1**2-l1**2-l2**2)/(2.0*l1*l2);
float s2=-sqrt(1-c2*c2);
float Theta2=atan2(s2,c2);
float k1=l1+l2*c2;
float k2=l2*s2;
float Theta1=atan2(Y1,X1)-atan2(k2,k1);
}


Isn't this a math issue? 

 

What does it have to do with LabVIEW?  The formula node only does what YOU tell it to do.

 

0 Kudos
Message 2 of 9
(4,027 Views)

I am giving the circumstances and context here. So you might get a whole picture of what I am doing.

 

I was able to move the two limbs to the desired X and Y coordinate. But when I am trying to generate a straight line trajectory, it shows error.

 

Thanks,

Blesson

0 Kudos
Message 3 of 9
(4,020 Views)

@Blesson wrote:

I am giving the circumstances and context here. So you might get a whole picture of what I am doing.

 

I was able to move the two limbs to the desired X and Y coordinate. But when I am trying to generate a straight line trajectory, it shows error.

 

Thanks,

Blesson


Again this is a math issue.

 

If you don't the right equations to use, LabVIEW isn't going to be able to help you.

 

 

 

0 Kudos
Message 4 of 9
(4,006 Views)

Thanks for the reply.

 

I understand that this is a math issue. Could you point out the issue?

 

I am using point-slope method here to draw a straight line.

 

Should you have any question on the above Formula Node, please feel free to ask.

 

Thanks,

Blesson

0 Kudos
Message 5 of 9
(3,965 Views)

Hi Blesson,

 

You mentioned "when I am trying to generate a straight line trajectory, it shows error."  Are you actually receiving a LabVIEW error, or is the arm just not moving in a straight line?  If you're getting a LabVIEW error, please post the error so that we can address it.  Similarly, if the results are actually wrong (i.e. 1+2 does not result in 3), then that may be a bug.  Give us the specific function that is returning an incorrect value, and we can address it.  If the math is all giving the correct values per your inputs and the arm is just not moving in a straight line, then it is an issue with your formula, in which case I would recommend simulating/graphing your solution to validate it before attempting to use it to control your robot.  You can also try monitoring the intermediate variables to see if/where there is a problem in your math.  

 

These forums are aimed at debugging LabVIEW code, not reviewing particular algorithms.  We could offer you troubleshooting steps like using breakpoints or monitoring intermediate variables to check your math, but unless someone had all of the details of your physical setup and geometries and was willing/able, it's not likely that someone here would address the particulars of your algorithm.

 

Regards,

David R
Systems Engineer
National Instruments
0 Kudos
Message 6 of 9
(3,953 Views)

Hi David,

 

Thanks for the reply.

 

The following part alone works perfect. It shows the inverse kinematics.

 

float c2=(X1**2+Y1**2-l1**2-l2**2)/(2.0*l1*l2);
float s2=-sqrt(1-c2*c2);
float Theta2=atan2(s2,c2);
float k1=l1+l2*c2;
float k2=l2*s2;
float Theta1=atan2(Y1,X1)-atan2(k2,k1);

 

But in the following codes is the issue. Please see the explanation after each code. When I use the following codes, the run button( arrow) in labview is brocken. This indicates there is an error. 

 

float g=atan2(Y,X);  /*Here a constant slope is addressed*/
float d=abs(sqrt(X**2+Y**2)); /* Here the distance is specified*/
int t;

/* In the following for loop five points are created before the end point (X,Y) is reached. The end point of limb passes through these five points to reach (X,Y)   */

for (t=0; t<=4; ++t)  
{
float q[5]={0.2,0.4,0.6,0.8,1.0};
float X1=q[t]*cos(g)*d;
float Y1=q[t]*sin(g)*d;

}

 

Regards,

Blesson Isaac

Graduate Student

UT Arlington, TX

0 Kudos
Message 7 of 9
(3,941 Views)

Hi David,

 

So how do I troubleshoot using breakpoints and monitor intermediate variable to check the math?

 

 

Thanks,

Blesson

0 Kudos
Message 8 of 9
(3,937 Views)

Hi Blesson,

 

A broken error only indicates an error in syntax.  If you click on the broken run arrow, it should list precisely where and what the error is.  For example, it might tell you there is a missing semicolon or that you are missing an input.  Follow the directions listed in the error window, and you should be able to solve the error.  For reference, this article covers the syntax of LabVIEW formula nodes.  It may be helpful if the described error is unclear:

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/formula_node_syntax/

 

Regards,

David R
Systems Engineer
National Instruments
0 Kudos
Message 9 of 9
(3,929 Views)