Run, pause and stop job file
Create and delete job file
Create
When creating a job file, it is necessary to check whether the jobname exists. This can be done by calling the function NRC_JudgeJobIsExist (std::string jobname)
. The parameter "jobname" is the name of the job file to be checked, and the return value of the function is 0 if the job file does not exist, and 1 if the job file exists.
If the job file does not exist or if you want to create a job file with a non-existing name, you can call the function NRC_CreateJobfile(std::string job1.10name)
to create a job file. The parameter "jobname" is the name of the job file to be created.
Delete
To delete the entire job file, you can use the function NRC_DeleteJobfile(std::string jobname)
. The parameter "jobname" is the name of the job file to be deleted.
To delete a line of instruction in a job file, you can use the function NRC_JobfileEraseCmd(int line)
. The parameter "line" indicates the line number of the instruction to be deleted, and the parameter range is 0 < line <= NRC_GetJobfileLineSum().
Job file execution related
Run
After creating a job file, call the function NRC_OpenJobfile(std::string jobname)
to open the job file. The parameter "jobname" is the name of the job file to be opened. Once the job file is opened, write the relevant instructions into it.
To start or resume running a job file, you can use the function NRC_StartRunJobfile(std::string jobname)
. However, this function is only effective in run mode. The parameter "jobname" specifies the name of the job file to be started. Please note that the parameter is not valid when resuming a job. Once the function is successfully called, the robot will start moving. Please pay attention to safety.
The line number of the currently running instruction
Call the function NRC_GetJobfileLineSum()
to get the total number of lines in the currently opened job file. Please note that before calling this function, you need to call NRC_CreateJobfile(std::string jobname)
or NRC_OpenJobfile(std::string jobname)
to create or open a job file. This function returns the total number of lines in the currently opened job file. You can directly output the return value.
Call the function NRC_GetJobfileCurrentRunLine()
to get the line number of the currently executing instruction in the running job file. This function returns the line number of the currently executing instruction in the running job file. You can directly output the return value.
Times related
Call the function NRC_GetCycleIndex()
to get the total number of times the current job file is to be run. This function returns the total number of times the current job file is to be run.
Call the function NRC_GetCycleCount()
to get the number of times the current job file has been run. This function returns the number of times the current job file has been run.
Call the function NRC_GetCycleTimeSec()
to get the elapsed running time of the current job file. This function returns the elapsed running time of the current job file.
Call the function NRC_SetCycleIndex(int index)
to set the total number of times the current job file is to be run. Setting it will also reset the current run count to 1. The parameter range is: index >= 0. 0 means cycle running.
Step through a line of instruction in a job file
Call the function NRC_StepRunJobfile(std::string jobname, int line)
to step through a line of instruction in a job file. This function is only effective in teach mode. The parameter "jobname" specifies the job file to be stepped through, but it is ignored when resuming the execution. The parameter "line" specifies the line number of the instruction to be stepped through, but it is also ignored when resuming the execution. Once this function is successfully called, the robot will start moving. Please pay attention to safety.
Pause job file/stop job file
Pause
To pause the execution of a job file, you can call the function NRC_PauseRunJobfile()
. After pausing the job file, you can resume its execution by calling NRC_StartRunJobfile(std::string jobname)
.
Stop
To stop the execution of a job file, you can call the function NRC_StopRunJobfile()
. Unlike pausing the execution of a job file, when you stop the execution and then call NRC_StartRunJobfile(std::string jobname)
, the job file will start running from the beginning.
Stop without powering off
Call the function NRC_StopRunJobfileNotPoweroff()
to stop the execution of a job file without powering off. Afterward, if you call NRC_StartRunJobfile(std::string jobname)
, the job file will start running from the beginning.
For a demo program of the APIs for running, pausing, and stopping job files, please refer to chapter 3.12.