02-21-2023, 08:06 AM
Hi,
I still haven't figured out the best way to code in RoboDK to avoid redundancy in my workflow when creating programs for simulation and at the same time for generating offline programs for the real robot.
My latest state is that I am generating programs in the station with a Python script. This way I can call the programs to simulate the behavior and also generate offline programs for the robot. But this way my station gets messy really fast. The generated programs become huge and unflexible.
For example: I have a workpiece storage with 24 parts in it which I want to be able to grip. Now I want to create programs for approaching to grip the workpiece and I also need programs to retract with the workpiece so I can wrap them around with some logic and error behavior outside of RoboDK. This means there will be 48 programs alone for a single workpiece type. In the end there will be 5 workpiece types, so this means 240 programs alone for this station. This also means 240 generated subprograms in my robot module with mostly the same stuff in it.
Right now I am thinking about how to avoid this mess. My goal is to have one Python script "approachToWorkpiece(tray_number, workpiece_number)" and one "retractFromWorkpiece(tray_number, workpiece_number)". From RoboDK I would call this as subprograms with the respective workpiece and tray numbers for simulation purposes. This works fine in the simulation, but I also want to be able to generate a robot program which only has this two procedures in it without generating 48 procedures for each part.
Maybe anyone has a smart idea how to best achieve this?
Anyway, right now I want to call the python scripts program a program in the station tree and generate the program with the programs from the python scripts as subprograms, but this doesn't work. The generated program includes the call to the subprogram but does not generate the subprogramm itself. When I generate the program from the python script it gets generated without problems. See the attached station.
I still haven't figured out the best way to code in RoboDK to avoid redundancy in my workflow when creating programs for simulation and at the same time for generating offline programs for the real robot.
My latest state is that I am generating programs in the station with a Python script. This way I can call the programs to simulate the behavior and also generate offline programs for the robot. But this way my station gets messy really fast. The generated programs become huge and unflexible.
For example: I have a workpiece storage with 24 parts in it which I want to be able to grip. Now I want to create programs for approaching to grip the workpiece and I also need programs to retract with the workpiece so I can wrap them around with some logic and error behavior outside of RoboDK. This means there will be 48 programs alone for a single workpiece type. In the end there will be 5 workpiece types, so this means 240 programs alone for this station. This also means 240 generated subprograms in my robot module with mostly the same stuff in it.
Right now I am thinking about how to avoid this mess. My goal is to have one Python script "approachToWorkpiece(tray_number, workpiece_number)" and one "retractFromWorkpiece(tray_number, workpiece_number)". From RoboDK I would call this as subprograms with the respective workpiece and tray numbers for simulation purposes. This works fine in the simulation, but I also want to be able to generate a robot program which only has this two procedures in it without generating 48 procedures for each part.
Maybe anyone has a smart idea how to best achieve this?
Anyway, right now I want to call the python scripts program a program in the station tree and generate the program with the programs from the python scripts as subprograms, but this doesn't work. The generated program includes the call to the subprogram but does not generate the subprogramm itself. When I generate the program from the python script it gets generated without problems. See the attached station.