08-21-2020, 03:53 PM (This post was last modified: 08-21-2020, 03:57 PM by Camille.)
Hi !
I want to generate my programs with the API and I keep getting a program generation LOG saying a robot has not been defined yet, even if I set my robot before making the program.
08-21-2020, 09:09 PM (This post was last modified: 08-21-2020, 09:10 PM by Albert.)
Hi Camille,
To avoid confusion I recommend you to wrap the section of the code you want to use for program generation with ProgramStart and PorgramFinish.
Code:
# robot = the robot you want to use for program generation
post_processor = "ABB_RAPID_IRC5" # Enter the name of the file in the RoboDK/Posts folder (no PY extension)
RDK.ProgramStart('Prog1','C:/MyProgramFolder/', post_processor, robot) # specify the program name for program generation
# RDK.setRunMode(RUNMODE_MAKE_ROBOTPROG) # redundant, ProgramStart changes the mode to program generation
...
robot.MoveJ(target) # execute your simulation/program
...
RDK.Finish() # This triggers program generation
You can try setting the run mode to "RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD" right after you call ProgramStart. Example:
Code:
# specify the program name and post processor for program generation
RDK.ProgramStart('Prog1','C:/MyProgramFolder/', post_processor, robot)
# upload the file to the robot (it usually sends the program via FTP but it depends on the robot and dedicated configuration)
RDK.setRunMode(RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD)
12-01-2020, 01:36 PM (This post was last modified: 12-01-2020, 02:03 PM by Camille.)
Hi Albert,
Sorry for not following on your suggestion, I have been busy on another side of this job.
The solution you provided did not work, but I now think this is not related to the API but to my project and/or maybe my computer. I opened a cell made by someone else, right-clicked on a program and selected "Generate robot program" and it worked without the error.
But if I create a new cell and a program, the error is back if I try to generate the program.
I linked a cell I just created with said error :
After talking with Jeremy my error is fixed.
It probably came from Roboguide when the post processor tried to make the TP program but could not for some reason. So we just changed the PATH_MAKE_TP to None and it now works.