Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Using a button to perform specific amount of MoveL commands

#1
Hello Everyone,

I am new to programming for RoboDK so maybe this question isn't too difficult.

I'm trying to perform a set amount of MoveL commands for an ABB IRB 2400 when I'm pressing a button on the plugin interface (just offline programming for now). The plugin is based on the formrobotpilot.cpp example.

When I'm trying to perform two consecutive MoveL commands, only the last one is performed. I assume this is because the MoveL command only triggers when the button-function is completed. But according to the API description, the MoveL call should block until the movement is complete.

Is there a possible way to perform multiple robot movements inside of a button called function? (see picture in attachement)


Attached Files Thumbnail(s)
   
#2
This is a good question. The MoveJ/MoveL/MoveC descriptions were wrong. Contrary to the RoboDK API, when you move a robot using the plugin interface the behavior is not blocking. 

Your plugin actually runs on the main thread of RoboDK so you should not make anything blocking inside your plugin, otherwise RoboDK will crash.

Instead, you should create a program, add the movements to a program and run the program. In other words, your Robot item should be a program item. You can create a new program using:

Code:
Item program = RDK->AddProgram();
Program->setPoseFrame(...);
Program->setPoseTool(...);
Program->MoveJ(...);
Program->MoveL(...);
Program->...
Program->RunProgram();

Another tip: Busy() will return if a robot or a program are busy. You should not place this in an infinite loop waiting for the robot or program to stop being busy.

We just updated our RoboDK Plugin documentation to reflect this clarification:
https://robodk.com/doc/en/PlugIns/class_...a8784b7bc2
#3
Thank you very much that works perfectly.

If I may ask another question, is there a possibility to move the robot to a specific target (e.g. with MoveL) and stop the movement on a specific event (e.g. with a sensor input that occurs) before the robot hits the target point?

Thank you in advance.
  




Users browsing this thread:
1 Guest(s)