I am setting up robot 3d printing, but my extruder is controlled over telnet as opposed to analog or digital outputs of the Kuka KR10 R1100 Agilus sixx that I am working with.
Basically, if the 3d printing project calls Extrude(5) I need to send some G-Code to my extruder via telnet that contains the E step amount being requested.
How should I start writing code to do this? Should it be in the postprocessor, or as a separate program in the project? Is there any Python function or library you recommend? Thank you so much!
Just to make sure, your Telnet communication will take place between your robot controller and your extruder controller?
If it's the case, my best guest would be to modify your post processor.
Modify it so that it generates a line of code in your robot program that sends the message via Telnet at a specific moment.
Have a good day.
My original workflow was to have the computer running RoboDK send the telnet commands to the extruder controller when Extrude() is being called. It does seem like it would be more straightforward to have the robot controller send the telnet commands, so I will look into that option. Thanks!
You would also reduce your risk of failure. For example, lost communication between your RDK PC and the rest of your setup during your print.
And I believe that your hand shake will be easier to put in place just between your robot controller and your extruder controller compared to having a third player (RDK PC) the deal with.
No, I simply meant modifying the Kuka post processor in a way that it will add a line to your SRC file that will trigger the telnet communication directly from your robot controller, if that is possible.
The "Run on robot" feature is very nice, but for that kind of application I would recommend keeping it all on the robot controller if that is possible.
But what you are suggesting, triggering a python script from RoboDK to activate your extruder is also a valid option, maybe just not the one that I, personally, would try to achieve first.
I'm thinking really quick here and I already see a few pros keep it all on the robot controller: You have access to modifying the speed of the robot in real time through your teach pendant if needed, you can create a "safety function" that will shut down the extruder if you ever encounter an error on the robot (let's say an E-Stop). I feel like the last one is needed and I don't see how you could implement that if everything is run from the PC. But keep in mind that those are just my quick thoughts.
Have a great day.
thank you for replying so quickly. The main problem I have with your approach is that our robot is connected to a braiding machine for carbon fibers which is it's main purpose. I'm using it to try and prove an idea, so a lot of the outputs are already taken and I would like to keep the changes to the control minimal. Also I'm pretty new to both robots and python, so the solutions I have found so far are mostly the result of extensive google searches and lots of trial and error.
Regarding the E-Stop wouldn't the only run on robot also stop if the robot stops? I had assumed that it would wait for feedback that the move is completed before sending the next command line. Then the extruder would also stop after its last move which for the first trials is probably fast enough, though I agree that for the long term I will need to find a different solution.
I also made a different post on the forum before I posted on this one, I'm still struggling a bit with the Python scripts. If in the generated robot program a function "SetRPM" is added as line but I have corresponding function call in the instructions list before, is a python script still called? For the MCode and Extruder calls the instructions were automatically generated by the software, for the RPMs I had to modify the postprocessor.
Thanks and best regards
Yes the robot will stop, but not the extruder (if only connected to the PC).
That is not a big deal safety wise, but it will make a mess as the extruder will continue outputting material. (I think, if I understand well what you are trying to do.)
I continued on with the approach I originally had in mind for two reasons: First the memory on the kuka is rather limited and the file size for some 3D print projects can be rather large so I need to use online programming anyway. Second this way it can be easily transferred to any other robot compatible with RoboDK and any other board that supports telnet communication like Smoothie or Duet. Since I work at a University and am think of maybe have students try this as part of their studies later on if i manage to get it working it seems the easier to replicate approach. Also the robot won't run unsupervised so the mess of the extruder continuing to run will probably be minimal as we have a kill-switch for that as well.
So I have set up everything I need. I have a Python Script in RoboDK that inserts Function Calls to set the speed or SetRPM after every Robot speed change, which works fine.
I have 3 small python scripts that send the Gcode in the right format to the extruder by telnet for the extruder feed, speed & mcodes. They all run fine and fast in PyCharm, I just can't get them to work in RoboDK.
My Question is, where do I integrate the scripts that send out the Gcode? In the GUI as "Function Calls" in for the "Program Events" or in the Post Processor? I need them to be exectuted during the "Run on Robot" when instruction in the list is reached and the list to continue on to the next instruction as soon as the "return" is reached in the script.
Implementing them as "Function Calls" is proving difficult as if the function call is i.e. extruder(754.5565) it looks for a function call with that specific name rather than calling function extruder with the value 754.5565 as input. It then just prompts the error in the status bar "Program extruder(754.5565) does not exist. Skipping function call.". Copying the python file in the RoboDK folder and importing it at the beginning of the robot program also make the functions available.