12-24-2014 12:12 AM
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);
}
12-24-2014 08:09 AM
@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.
12-24-2014 08:19 AM - edited 12-24-2014 08:20 AM
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
12-24-2014 08:41 AM
@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.
12-26-2014 07:50 AM
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
12-26-2014 09:44 AM
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,
12-26-2014 12:52 PM
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
12-26-2014 12:59 PM
Hi David,
So how do I troubleshoot using breakpoints and monitor intermediate variable to check the math?
Thanks,
Blesson
12-26-2014 01:02 PM
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,