RobotStudio event

PCSDK Sending rapid to the robot with C#


Hi,

I'm a beginner in developing robot software. I'm trying to use C# to send some coordinates to the robot and tell the robot to move to these coordinates. 

I have looked into the PCSDK references and also some posts in this forum discussing the same topic. I believe in order to achieve what I'm trying to do, I have to write all the coordinates and motion commands in a Rapid file, and use the Rapid class to execute the Rapid code, am I right?

Is there an available example? I will learn quicker from examples :).

Any help is appreciated.

Regards,
Anthony

John Wiberg2012-10-22 09:40:00

Comments



  • Its easier to just update the RAPID data directly.
     
    First get it like so
    RapidData myRD= task.GetRapidData("module", "name");
    then RapidData has a read and a write method.
     
    So you declare a Move in a RAPID routine which uses a specific RobTarget with a name, then you get+edit the data and tell the controller to run the routine.
    If I have time I will see if I didn't have an example of that somewhere...
     

  • [QUOTE=John Wiberg]

    Its easier to just update the RAPID data directly.
     
    First get it like so
    RapidData myRD= task.GetRapidData("module", "name");
    then RapidData has a read and a write method.
     
    So you declare a Move in a RAPID routine which uses a specific RobTarget with a name, then you get+edit the data and tell the controller to run the routine.
    If I have time I will see if I didn't have an example of that somewhere...
     
    [/QUOTE]
    Hi John

    Thank you, I see what I can do now.
    My task involves defining lots of robot targets. It can be easier to update the RAPID data in the way you taught me with a for loop.

    Anthony



  • Hi Anthony,
     
    Just remember, the motion handler in the controller is always at least one RAPID line ahead. This to calculate the next motion in line.
    So if you are doing a loop use a minimum of three Move instructions with three targets, preferably more. With some logic which you will be writing to next etc. And a queue, you definately need a queue if you have "lots of robtargets". Ohterwise you'll be doing the common mistake of overwriting the robtargets before they are finished executing.
    Clown

    John Wiberg2012-10-22 10:19:28
  • Hi John,

    Maybe I have misunderstood your words, but did you mean sending a series of robot targets to the controller when the robot is executing the previous ones? That is by pressing a button, the C# program will be executed and create a queue; shortly after the program calculates the first several coordinates, it sends them to the queue and the robot is started; while the robot is moving to these coordinates, the next several coordinates are calculated and added to the queue, on and on. 

    If this is true and if there are thousands of robot targets, will the process use up the PC's memory?

    Thanks,
    Anthony


  • Pretty much yes.
     
    You just put them in the queue as strings, so thousands of robtargets is not that much. Its just some k's worth of memory.
    Then you write the string to the RAPID data object from the queue.
     
     

  • [QUOTE=John Wiberg]

    Pretty much yes.
     
    You just put them in the queue as strings, so thousands of robtargets is not that much. Its just some k's worth of memory.
    Then you write the string to the RAPID data object from the queue.
     
     
    [/QUOTE]

    That's brilliant! Thanks for your help :)