Universal Robots Forum

Syntax error subtracting two positions

Dear,

Following code:

Jp1 = [ set of 6 joint values ]
p1 = get_forward_kin(Jp1)
p2 = get_forward_kin()

def get_dif(a,b)
dv = [ b[0]-a[0],b[1]-a[1],b[2]-a[2] ] <- I get syntax error on this line. Why???
return dv
end

Then I call:

d = get_dif(p1,p2)

The result is a syntax error…

If I’m not allowd to take the difference, how should I do it then?

Thanks,

Max

A minor update:

I’ve cahnged get_dif() to:

det get_dv(a,b)
dvp = pose_sub(b,a)
dv = [ dvp[0], dvp[1], dvp[2] ]
return dv
end

Would this solve the problem?

Ok, case closed…

I’m really embarrased by this, but I forgot the ‘:’ after the line def get_dv() …whoops…

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.