Executing multiple robot motions during a function call- Printable Version +- RoboDK Forum (//m.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//m.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//m.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: Executing multiple robot motions during a function call (/Thread-Executing-multiple-robot-motions-during-a-function-call) |
Executing multiple robot motions during a function call-Hofbauec-10-23-2021 Hello Everyone, 我目前工作在床上找平系统for a robotic 3D-printing station during the course of my master degree. I have already implemented every function necessary to level the actual print bed (creating probe points on irregular print surface, creating a mesh, interpolation of mesh, applying new z-values to G-Code). Therefore I used a button which calls a function with specific parameters declared above the button in the UI. The last thing i need to implement seems to be quite a problem for my understanding of RoboDK. I need to move the robot down to the print bed (no problem) and as soon as a sensor sends a signal (via serial, input already works), the movement of the robot should stop and the next point should be probed. 我规律eady tried to move the robot only a little bit at a time and check if the sensor is actve afterwards, but the main problem that prevents this implementation is, that the function which is called from the button only applies the motion, when the function is complete / ended. But i need to do a lot of probe points in this function inside a loop. I can't find a solution to move the robot without ending the function itself. I am using ->runProgram(); where a lot of MoveL commands are implemented. But as I said, the actual "runProgram" only occurs at the end of the button call. Is there a possibility to force the Robot to move inside of a button-function before the function reaches its end? I hope someone can help me with my problem. I am using the PluginExample as a base for my plugin (C++). RE: Executing multiple robot motions during a function call-Hofbauec-10-25-2021 I forgot to add: A solution to my problem would be a script, which can run all the time in a constant loop even if the robot is performing a task. Is something like that possible? RE: Executing multiple robot motions during a function call-Albert-10-25-2021 I assume your sensor works like a touch probe. I recommend you to run the search algorithm on a script, even if your goal is to create a plugin. You can trigger a Python scripts behind the scenes and collect the result. A script is better as you'll have less function callbacks and you can execute your robot program linearly (which is not so easy to do on a plugin as you can't execute blocking robot movements). I attached some code that shows how to run a binary search algorithm using Python code. The search is done by steps of 1 mm and when a contact is found it starts splitting the search by half until you meet a certain tolerance. We also have a search function (SearchL) in the RoboDK API which you can run from a Python script. On the other hand, this search algorithm requires additional configuration steps on the robot controller.
Code:
def PoseTowards(pose1, pose2, dist1_mm):
RE: Executing multiple robot motions during a function call-Hofbauec-10-25-2021 我规律eady imlemented this method in my program. Thank you very much you saved my day it works perfectly. Is there a method to jump to the next instruction in a already running program in RoboDK via python? That would make my application failsafe proof. (I have put a picture of what I want to achive in the attachement) RE: Executing multiple robot motions during a function call-Albert-10-26-2021 It is great to hear you were able to implement this with your project. Currently there is no API to start a program at a specific instruction but we'll implement it so you can start at an instruction given its id. Example:
Code:
program.setParam("Start", id)
RE: Executing multiple robot motions during a function call-Hofbauec-10-26-2021 Thank you very much, that would be a great addition! But will it be possible to jump directly to a new line with this addition during the active program, or do I need to stop the program, set the start ID and then restart it? RE: Executing multiple robot motions during a function call-Albert-10-27-2021 Yes, you should be able to start the program on a new instruction even if it already running. However, the robot may complete running the current instruction before jumping to the new one. RE: Executing multiple robot motions during a function call-Hofbauec-10-30-2021 Thank you again for the update. 我规律eady tried it and works as expected. The robot now moves to the next probe point as soon as the probing sensor activates. |