Figuring out Angle from X and Y values?


  • If it only moves in X and Y, there would be no angle to calculate, only an X and Y offset.


    Maybe I am not understanding your question.


    You're understanding right. I'm not.


    What I should have said is, if I have 2 values for Y and 2 values for X, how can I come up with an angle calculation.

  • So you are talking about drawing a line from one X,Y position and calculating the angle of that line? Maybe a picture would help me understand.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!


  • So you are talking about drawing a line from one X,Y position and calculating the angle of that line? Maybe a picture would help me understand.


    Yes, A way to explain would be, we have 2 cameras. One on each corner of a rectangle feeding back X and Y. If X is -1 and X on the other is +1, that should give me an angle somehow. I'm trying to figure out the correct way to tell the robot the Angle cordinates for the new pick position.

  • I am still not following fully. A diagram would really help. If you have multiple cameras with overlapping views, I would recommend you calibrate the cameras together first so they are dialed into the same grid.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!


  • From a math standpoint, the angle is arctan((y2-y1)/(x2-x1)). I think that to implement that on the robot, you'll need either the math option or to use Karel.


    I've had some success using Taylor expansion to get around the math limitations on base fanucs. You have to scale the function though, to account for the fact that a real in the registers is cut off after 6 decimal places.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • Einstein would be interesting with this challenge


    They way we (Einstein and I) see it , it's that the cameras are in parallel worlds. The coordinates are totally independent from another
    I don't believe the robot knows exactly where the corners are related to each other, it know for example, one is at -1 and the other +1, but + or - from what ?


    I think you have to put an object where you think, it's at zero degree (this is the big deal) .Then take the pictures and then yes, whatever result you get, it is your zero and you can follow any line equation to find the angle such as y-y1=m(x-x1)+n


    I can tell you right now is not going to be perfect, but you can adjust it the best you can

    Retired but still helping

  • If (x10,y10) is your zero point of camera 1, (x20,y20) is your zero point of camera 2, (x11,y11) is your recorded point of camera 1, and (x21,y21) is your recorded point of camera 2, the difference in angle will be arctan((y20-y10)/(x20-x10) - arctan((y21-y11)/(x21-x11)


  • If (x10,y10) is your zero point of camera 1, (x20,y20) is your zero point of camera 2, (x11,y11) is your recorded point of camera 1, and (x21,y21) is your recorded point of camera 2, the difference in angle will be arctan((y20-y10)/(x20-x10) - arctan((y21-y11)/(x21-x11)


    Don't you need to know the distance from one camera to the other?

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • I'm not too sure how vision works and is set up, since I've never used it. As long as all points are relative to the same origin, this will work. If each camera's points are relative to that camera and the camera doesn't know where it is relative to the origin, then yes, you'd have a add each camera's location to its offset in order to get coordinates to work from.


  • Maybe I'm missing the point, but isn't this one of the functions of a multiview/camera setup in iRVision?


    Yea, I'm sure they already have a function built for this, but I want to be able to do this without having to purchase IRVision. Plus this is on a Rj3 robot ( not IRVision).



    Thanks for all the replies though guys! great info.

  • I tried to think hard an figure out some ratio of how the x direction changes relative to the y direction. I wanted to use this to take a percentage of the known angle, but it comes down to approximating the trig functions. That Taylor Expansion sum with the squared and cubes of the position appears to be the way to go.

Advertising from our partners