Interesting.. i was facing similar problems with a simulation i’m trying to run right now, and Oscar i think i can help you a little towards your goal to specify an angle on which the mechanism will stop moving.
First of all i declared the velocity as a Double
Dim velocity As Double
This will allow for velocities that aren’t round numbers (like 0.5 or 1.3). I use lower values. I did this because i noticed that the movement of the mechanism doesn’t stop exactly at the Upper/LowerLimit when using higher velocities. I have a turntable that (with velocities above 0.5) will only reach 358 degrees in stead of 360.
I also noticed that RS uses Radiants. And I as well want to use Degrees. So i use a helper value to convert radiants into degrees (found in RS API help)
Dim Rad2Deg As Double
Rad2Deg = 1 / 360 * 2 * 4 * Atn(1)
Then when specifieing a new angle use something like this:
jointValues(1) = 90 * Rad2Deg
But this is where i am stuck too. I only got this working on a robot, and it jumps from one angle to another, so no smooth movement..
The three things i’m eager to know are first, how to declare a specific rotation in degrees on which the mechanism stops moving. The mechanism I use is a turning table which can rotate from +360 to -360 degrees. I’d like to stop the movement when the turning table has turned 90 degrees (or any other angle). And i know this is possible without having to configure the turning table as an external axis.
The second question is about how to abort the macro when the desired rotation is reached. Right now i use a separate macro to stop the controller, but this doubles the amount of IO i need to use..
The third question would be about how to reach the exact angle, even when using higher velocities. Like i said before i need to drop the velocity to 0.5 or below in order to really reach the Upper/LowerLimit. And in some cases this causes long waits…
Oh and even a fourth question comes to mind… How to set an input on the robot from within the macro.. In this case i can remove the WaitTime-instructions and establish a handshake between the robot and the macro.
I know i’m asking pretty damn much.. but any efforts towards any of this goals are much appreciated.. (hmm.. deja vu.. i’ve said this before…)