External Rail programmation with the Python API- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: External Rail programmation with the Python API (/Thread-External-Rail-programmation-with-the-Python-API) |
External Rail programmation with the Python API-MarcGondran-09-11-2019 Hi, I experience issue while programming a path with robodk. My station looks like instation png. My code looks like this :
Code:
"""
I overcome this by remplacing htm[i] by KUKA_2_Pose(Pose_2_KUKA(htm[i+1])). But it doesn`t seems to be the proper way. When running the corrected program, i get an error that the target is out of reach. as shown in the picture enclosed. Do you have an idea of where it can come from ? I tried another solution. Indeed, I added the following : target.setAsJointTarget() The rail finally move to reach the target but it doens't reach the proper target. Thank you RE: External Rail programmation with the Python API-Albert-09-12-2019 I believe you are providing numpy matrices to the RoboDK API. RoboDK expects 4x4 matrices to be Mat objects. This Matrix object is defined in the robodk module: //www.sinclairbody.com/doc/en/PythonAPI/robodk.html#robodk.Mat You could do something like: reference = KUKA_2_Pose(list(xyzabc)) Where xyzabc is a 1D numpy array given X,Y,Z,A,B,C values. The list function will convert it to a list of 6 values and the KUKA_2_Pose will create a Mat pose that you can provide to RoboDK as a pose. RE: External Rail programmation with the Python API-MarcGondran-09-13-2019 Hi, Thank you for your answer. Unfortunately, it doesn't solve the "target out of reach" issue. What about it ? I should precise that I acheive placing the targets. It just says that they are out of reach while obviously they are not. RE: External Rail programmation with the Python API-Albert-09-15-2019 Can you share the RoboDK project (RDK file)? You may need to set a value for the external axis so targets can be reached. RE: External Rail programmation with the Python API-MarcGondran-09-17-2019 Actually, I answered my question by myself. I solved it this way :
Code:
target_name = 'Target %i' % (i + 1)
Thank you Marc RE: External Rail programmation with the Python API-MarcGondran-12-02-2019 Hi, I will reply to this subject again. Indeed I did kind of solve the issue using the previous code however. I have a lot of point and it takes very long to generate using this mean. I use the MacOS version of RoboDK and the straight forward method to create target using the API works. However when back to the windows version, it still doesn't work. The straight forward code I use is this one :
Code:
RDK = Robolink()
It generates me the following file. When launching the program it says that the target is not reachable. Here is the file RE: External Rail programmation with the Python API-Albert-12-02-2019 Hi Marc, When you use external axes you need to provide the position of the external axes in your target (using setJoints). If the target is Cartesian you don't need to worry about the robot axes. Alternatively, you can load a robot machining file such as Gcode or APT and use a curve follow project or robot machining project. You'll then be able to optimization tools for external axes. I was unable to test your file as it requires additional input data but this small script will allow you to update the position of the external axes to all targets in a station (for example, 5000 mm):
Code:
from robolink import * # RoboDK API
If you are looking for faster speed (I noticed you already disabled Render) I would recommend you to use the C++ API (slightly faster) or the plugin interface to create a plugin (much faster). The API's are almost the same in both cases. Albert RE: External Rail programmation with the Python API-MarcGondran-12-03-2019 Thank you for your answer Albert. Actually, I don't know the external rail position, I want robodk to optimize this parameter. How can I manage it ? Plus what's weird is that it totally works on MacOS this way. RE: External Rail programmation with the Python API-Albert-12-03-2019 Hi Marc, You can wrap the update of the external axis inside another loop to test different positions for the rail (programmatically). The command program.Update will quickly tell you if the program is feasible so you can keep searching until you find a valid solution. I updated your sample project to do so. Albert
Code:
from robolink import * # RoboDK API
RE: External Rail programmation with the Python API-MarcGondran-12-03-2019 Thank you very much for your help. It works fine ! |