123
I have two question:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
1. In the RobotStudio API Help it is written that "position.x", "position.y" or "position.z" properties are of type "Long". However, I think they must be defined as type "Double". Am I right?
2. In my API code I'd like to shift the target points to other locations in the space. To be able to restore the original coordinates location, I save x, y, and z coordinates of targets in arrays of type "Double" first. However, after shifting and then restoring the original coordinate some inaccuracy are formed in x, y, or z of position properties. e.g. position.x=1699.999 instead of 1700.000. Although this inaccuracy is small, it is enough to influence my result and sometimes leads to wrong result especially if this error accumulates. The same problem can occur in "orientation.Rx, Ry, Rz" even if I do not change these properties in the code. This means sometimes Rx,Ry, or Rz change after changing the position.x, y, or z properties after doing many shifting. (If my question is not clear, please run the attached code and notice to the coordinates of targets before and after shifting)
Is this error because of "position.x", "position.y" or "position.z" properties are defined of type "single" and not "double"? How we can eliminate this inaccuracy?
Thanks in advance,
BR, /Behnam
Administrator37896,5281018519
Comments
-
1. You are correct, they are double. The API online manual will be changed to the next version. When in doubt about types, you can use the VBE, View>Object Browser (F2), then type in the object you are interested in and it will give you the type directly from the code. If you find any other inconsistencies in the manual please report them to the forum as well.
2. Will come back to you on this one.
John
Developer Center0 -
Thanks for your commentS. I'm curiusly waiting for an answer.
/Behnam
/Behnam0 -
The problem occurs when you read information from the graphics (which calculates with Float). A way to eliminate the problem is to use the "Round" function every time you read positions and transforms from the graphics.
E.g:
oriTargets_x(jCount, iCount) = Round(trfTargetRef.Target.Transform.Position.x, 3)
oriTargets_y(jCount, iCount) = Round(trfTargetRef.Target.Transform.Position.y, 3)
oriTargets_z(jCount, iCount) = Round(trfTargetRef.Target.Transform.Position.z, 3)Best Regards
Fredrik
Fredrik Syr?n
Program Manager
ABB Automation Technologies0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 312 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 793 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings