Skip to content

Controller Secondary Development

Introduction

Controller secondary development is based on the interfaces provided by the controller. The program runs inside the controller, making it suitable for developing dedicated processes.

Document Structure

Controller
├── Quick Start                    # Environment setup, project build, program deployment
├── Secondary Development API (Robot Basic Parameters)   # Core interfaces: system/servo/coordinate system/IO/variables
├── Secondary Development API (Job Files, Instructions)   # Job file management, instruction insertion, queue execution
├── Secondary Development API (Palletizing Process)            # Palletizing process parameter settings and control
└── Examples
    ├── Custom Instructions
    │   ├── Controller Implementation                  # Controller-side custom instruction development
    │   └── Teach Pendant Implementation                  # Teach pendant-side custom UI development
    └── Custom Instruction Demo.md              # Example download instructions

Function Index

System and Initialization

FunctionDescription
NRC_StartControllerStart controller
NRC_GetControlInitCompleteWait for initialization to complete
NRC_SetOperationModeSet operation mode (Teach 0 / Remote 1 / Run 2)
NRC_RebootControllerReboot controller
NRC_RestoreFactorySettingsRestore factory settings
NRC_ModifyControllerIPModify controller IP
NRC_ShieldedTeachingPendantDisable teach pendant connection detection (must be called before startup)
NRC_GetRobotSumGet robot count
NRC_SetRobotModeSet multi-robot mode
NRC_DelaymsDelay (milliseconds)
NRC_LogInfoPrint log
NRC_GetNexMotionLibVersionGet library version
NRC_GetSyncVersionGet sync version number

Servo Control

FunctionDescription
NRC_PowerOn / NRC_PowerOffServo power on/off
NRC_ServoEnable / NRC_ServoDisableTeach mode power on/off (requires deadman switch)
NRC_SetServoReadyStatusSwitch servo ready status
NRC_GetServoStatusGet servo status (0-disabled 1-ready 2-alarm 3-enabled)
NRC_GetPowerOffSaveSignalGet power status
NRC_ClearServoError / NRC_ClearAllErrorClear servo/all errors

Motion Control

FunctionDescription
NRC_RobotMoveJointRobot point-to-point motion
NRC_RobotMoveJointSyncRobot external axis point-to-point motion
NRC_RobotMoveLineSyncRobot linear motion (body + external axis)
NRC_JogMove / NRC_JogMoveStop / NRC_JogMoveStopAllJog control
NRC_StartResetPointReturn to reset point
NRC_SetTargetVelocitySet target velocity (PV mode)
NRC_PosReachableCheck if point is reachable

Speed Control

FunctionDescription
NRC_SetTeachRunSpeedPer / NRC_GetTeachRunSpeedPerTeach speed percentage
NRC_SetAutoRunSpeedPer / NRC_GetAutoRunSpeedPerAuto speed percentage
NRC_SetTeachMaxStepSpeed / NRC_GetTeachMaxStepSpeedTeach max single-step speed
NRC_GetAngularVelGet joint angular velocity (rad/s)
NRC_GetLinerVelGet linear velocity (mm/s)
NRC_GetAxisVelSyncGet external axis velocity

Jog Configuration

FunctionDescription
NRC_SetJogJointSpeedConfig / NRC_GetJogJointSpeedConfigJog joint speed
NRC_SetJogRectangularSpeedConfig / NRC_GetJogRectangularSpeedConfigJog Cartesian speed
NRC_SetJogSensitivitySpeedConfigJog sensitivity
NRC_SetJogMoveCalculateNumJog interpolation point count

Coordinate System and Calibration

FunctionDescription
NRC_SetCurrentCoord / NRC_GetCurrentCoordSwitch/get current coordinate system
NRC_PositionACStoMCS / NRC_PositionMCStoACSJoint <-> Cartesian coordinate conversion
NRC_TcpCalculateTCP fixed distance offset calculation

Tool:

FunctionDescription
NRC_SetToolCoordParm / NRC_GetToolCoordParmSet/get tool parameters
NRC_CalibrationToolCoord_7Pos7-point/6-point calibration
NRC_CalibrationToolCoord_2Pos_SetPos / _Cacl / _Save2-point calibration (three steps)
NRC_SwitchToolCoord / NRC_GetCurrentToolCoordSwitch/get current tool

User Coordinate:

FunctionDescription
NRC_SetUserCoordParm / NRC_GetUserCoordParmSet/get user coordinate parameters
NRC_CalibrationUserCoordUser coordinate calibration (3-point method)
NRC_SwitchUserCoord / NRC_GetCurrentUserCoordSwitch/get current user coordinate

Position and Zero Point

FunctionDescription
NRC_GetCurrentPos / NRC_Rbt_GetCurrentPosGet current position
NRC_GetOtherToolPosGet position under other tool coordinate system
NRC_GetEncoderPositionGet encoder position
NRC_SetCurrentPosToZeroPos / NRC_Rbt_SetCurrentPosToZeroPosSet zero point/clear multi-turn value
NRC_Rbt_SetSingleCircleValue / NRC_Rbt_GetSingleCircleValueSet/get single-turn value

External Axis

FunctionDescription
NRC_SetSyncJointNumSet external axis count
NRC_SetSyncJointPara / NRC_GetSyncJointParaSet/get external axis parameters
NRC_SetSyncGroupCarbinarion / NRC_CalSyncCalibrationResultExternal axis calibration
NRC_SetCurrentSyncPosToZeroPosExternal axis zero point setting
NRC_SingleSyncAxisMoveJConstVel_For_CustomInstructionCBExternal axis constant velocity motion
NRC_GetCurrentSyncPos / NRC_Rbt_GetCurrentSyncPosGet external axis position

Torque and Dynamics

FunctionDescription
NRC_SetTargetTorque / NRC_GetActualTorqueSet/get torque
NRC_GetActualCurrent / NRC_GetMaxCurrentCurrent control
NRC_GetRatedTorque / NRC_GetTorqRated torque
NRC_SetIdentityParamSet dynamics identification parameters
NRC_RunSafeCheckProgram / NRC_RunIdentifyProgramSafety check/dynamics identification
NRC_SetCollisionParam / NRC_SetCollisionSwitchCollision detection

Job File Operations

FunctionDescription
NRC_CreateJobfile / NRC_OpenJobfile / NRC_DeleteJobfileJob file CRUD
NRC_JudgeJobIsExistCheck if job file exists
NRC_GetJobfileLineSumGet job file total line count
NRC_StartRunJobfile / NRC_PauseRunJobfile / NRC_StopRunJobfileRun/pause/stop
NRC_StepRunJobfileSingle-step run
NRC_StopRunJobfileNotPoweroffStop (without power off)

Job File Insert Instructions:

FunctionDescription
NRC_JobfileInsertMOVJ / MOVL / MOVS / MOVC / IMOVInsert motion instructions
NRC_JobfileInsertMOVJEXT / MOVLEXT / MOVCEXTInsert motion instructions with external axis
NRC_JobfileInsertDOUT / WAIT / TIMER / UNTILInsert IO/wait instructions
NRC_JobfileInsertIF / VarIF / ELSE / ENDIFInsert conditional statements
NRC_JobfileInsertWHILE / VarWHILE / ENDWHILEInsert loops
NRC_JobfileInsertSETVAR / OPCmdInsert variable operations
NRC_JobfileInsertPALON / PALOFF / PALGRIPPER ...Insert palletizing instructions
NRC_JobfileInsertARCON / ARCOFFInsert welding instructions
NRC_JobfileInsertCustomInstructionInsert custom instruction
NRC_JobfileInsertPOSCALALLInsert position bulk modify instruction

File-less Run Queue

FunctionDescription
NRC_CreateNoFlieRunqueueCreate file-less queue
NRC_InsertNoFlieRunqueueInsert a set of instructions
NRC_StartRunNoFlieRunqueue / Pause / StopRun/pause/stop
NRC_RunqueueInsertMOVJ / MOVL / ...Insert various instructions (same as job file)

Append Run Mode

FunctionDescription
NRC_OpenInstrAppendRunMode / NRC_CloseInstrAppendRunModeEnable/disable append mode
NRC_AppendRunInstrAppend run instruction
NRC_PauseInstrAppendRun / NRC_RestartInstrAppendRunPause/restart
NRC_StopInstrAppendRun / NRC_StopInstrAppendRunNotPoweroffStop (with/without power off)
NRC_GetIsInstrAppendRunModeWhether in append mode
NRC_GetRestAppendInstrNumRemaining instruction count

Local Background Program

FunctionDescription
NRC_CreatePthreadJobfile / NRC_OpenPthreadJobfileCreate/open background program
NRC_DeletePthreadJobfile / NRC_JudgePthreadJobIsExistDelete/check existence
NRC_JobfileInsertPthreadStart / PthreadEndInsert start/end instruction

Callback Functions

FunctionDescription
NRC_SetCompleteOneInstrCallBackSet instruction completion callback
NRC_SetJobFileCustomInstructionCBSet custom instruction callback
NRC_SetMsgHappenCallbackSet message callback
NRC_SetSocketCustomProtocalCBSet TCP protocol callback
NRC_SetFaultResetCBSet error clear button callback
NRC_robotRunCycle_CallbackSet communication cycle callback (1ms)

IO Control

FunctionDescription
NRC_DigOut / NRC_DigOutByBoardDigital output
NRC_ReadDigOut / NRC_ReadDigOutByBoardRead digital output
NRC_ReadDigIn / NRC_ReadDigInByBoardRead digital input
NRC_AnaOut / NRC_ReadAnaOut / NRC_ReadAnaInAnalog IO

Communication Interface

FunctionDescription
NRC_SetCANBaudRate / NRC_SendCANDataCAN communication
NRC_SetCommunicationParam / NRC_SetCommunicationStatusTCP communication parameters
NRC_SetTcpMessageCallbackTCP message callback
NRC_CommSendMessageSend TCP message
NRC_GetModbusSlaveConnectStatus / NRC_GetModbusMasterConnectStatusModbus status
NRC_SetSocketCustomProtocalCB / NRC_SendSocketCustomProtocalCustom Socket protocol

Messages and Errors

FunctionDescription
NRC_SetMsgHappenCallbackMessage occurrence callback
NRC_FirstMessagePop / NRC_LastMessagePopPop first/last message
NRC_GetMessage / NRC_GetMessageSizeGet message
NRC_ClearMessageClear message queue
NRC_TriggerErrorReportActively trigger error report

Variable Management

FunctionDescription
NRC_SetBoolVar / NRC_ReadBoolVarBOOL variable
NRC_SetIntVar / NRC_ReadIntVarINT variable
NRC_SetDoubleVar / NRC_ReadDoubleVarDOUBLE variable
NRC_SetGlobalPositionVariable / NRC_GetGlobalPositionVariableGlobal position variable
NRC_SetGlobalPositionVariableNote / NRC_GetGlobalPositionVariableNoteGlobal position variable comment
NRC_GetCurrentTimeGet current time

Palletizing Process

FunctionDescription
NRC_Pallet_SetUsePalletType / NRC_Pallet_GetUsePalletTypeSimple/full palletizing
NRC_Pallet_SetGripperParm / NRC_Pallet_GetGripperParmGripper parameters
NRC_Pallet_SetSimplePosParm / NRC_Pallet_GetSimplePosParmPosition parameters
NRC_Pallet_SetSimpleNumParm / NRC_Pallet_GetSimpleNumParmQuantity parameters
NRC_Pallet_ClearCurrentStatusClear palletizing status
NRC_Pallet_SetPalletedWpNum / NRC_Pallet_GetPalletedWpNumPalletized workpiece count

Motion Status Query

FunctionDescription
NRC_GetProgramRunStatusProgram run status (0-stopped 1-paused 2-running)
NRC_GetRobotRunStatusRobot motion status (0-stopped 1-moving)
NRC_GetTeachBoxConnectStatusTeach pendant connection status
NRC_GetCurrentOrderRunsProgram execution direction (forward/reverse)
NRC_GetCycleIndex / NRC_GetCycleCount / NRC_GetCycleTimeSecCycle count/time
NRC_GetDistanceToOldTrackDistance to original trajectory stop point
NRC_GetRunqueueCurrentRunLine / NRC_GetJobfileCurrentRunLineCurrent running line number

Motion Auxiliary

FunctionDescription
NRC_SetTargetPositionSet robot target position
NRC_GetPlanningPositionGet first point in planning queue
NRC_PV_SetTargetVelocity / NRC_PV_SetTargetAccAndDecPV mode velocity/acceleration
NRC_SetInterpolationMethodSet interpolation method (S-curve/trapezoidal)
NRC_SetAbsolutePosResolutionAbsolute position resolution

Robot Parameters

FunctionDescription
NRC_SetRobotTypeConfig / NRC_GetRobotTypeConfigRobot type
NRC_SetRobotDHConfig / NRC_GetRobotDHConfigDH parameters
NRC_SetRobotJointConfigJoint parameters
NRC_SetRobotDecareConfig / NRC_GetRobotDecareConfigCartesian parameters
NRC_CalcConfigurationCalculate robot configuration
NRC_GetRobotAxisSumGet robot axis count
NRC_GetSyncAxisSumGet external axis count
NRC_SetRobotRangeLimit / NRC_GetRobotRangeLimitRange limits

Prerequisites

  • C++ language fundamentals
  • Linux system (Ubuntu) basic usage
  • Industrial robot basic knowledge
  • Eclipse / VS Code / Vim or other editors