Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Unable to send custom code to online robot

#6
Can you provide a sample project that can reproduce this connection this issue? We can better help you fix it. It is important to understand the difference between the following:

Run Mode (API)
当你连接到机器人通过API (call Connect) you are automatically changing the "run mode" (setRunMode) to move the real robot, not the simulated robot. This applies to the RoboDK API and moving the robots from your code. This is useful if you want to move the robot directly using the API (using MoveJ or MoveL commands from Python or C# code for example).

You can change the run mode to just simulate the robot program, validate it or generate the program using the same code.

Important: Run mode applies to all the commands of the API.

Run type (Program)
Run type (setRunType) is different and only applicable to programs generated using the GUI and you can only set it to Run on Robot or simulate. This is exactly the same as if you checked/unchecked theRun on Robotoption of a program.


Generate a program through the API
MakeProgramapplies to programs created using the GUI or python macros that include robot movements. This call is the same as right clicking a program and selecting "Generate Program":

You can pass a flag to upload the program to the robot controller. For example:

Code:
program.MakeProgram(path_file, RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD)

Include customized code in a program
You should useRunInstructionwhen you want to include a program call, customized code, comment in another program (program visible in the GUI). For example, if you want to add a new line of code in your program you can use:

Code:
program.RunInstruction('Output any code you want;', INSTRUCTION_INSERT_CODE)


Important regarding file transfer with UR robot (SFTP):
You can automatically transfer URP or script files to the robot when you right click a program and select "Send program to robot". This behavior can be customized in the post processor (set the variable UPLOAD_SFTP = True). I recommend you to use theUniversal Robotsor theUniversal Robots URPpost processor. By default, the RoboDK post processor for UR will run the program automatically when you select the option to send the program to the robot (this is an exception for UR since it is a collaborative robot and easier to run programs on the fly from a PC). Changing the UPLOAD_SFTP flag to true will upload the URP program via SFTP. This requires installing the pysftp package.


Messages In This Thread
RE: Unable to send custom code to online robot - byAlbert- 05-14-2019, 03:59 PM



Users browsing this thread:
1 Guest(s)