Skip to content

API Introduction

The following interfaces can be found in the SDK header files of the controller.

cpp
/**
 * @brief Set job file custom instruction callback function
 * @param cb Callback function pointer, type std::function<bool(int, const std::string&, const std::string&)>
 * @param (*fun)(int,std::string,std::string) Function pointer, i.e., the function to be called by the custom instruction
 * @note The parameters in the callback function pointer are respectively: the number of the custom instruction, the string parameter of the custom instruction, the name of the point called by the custom instruction (empty if not called)
 */
int NRC_SetJobFileCustomInstructionCB(bool (*fun)(int,const std::string &,const std::string &));
/**
 * @brief MOVJ instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param pos  Robot motion target position, see NRC_Position
 * @param vel Robot motion speed, as a percentage of the robot's maximum speed, range: 0 < vel <= 100
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 */
void NRC_Jobrun_MoveDirect(int robotNum, const NRC_Position & pos, double vel,  double acc, double dec, int pl, bool moveToNextLine = false);


/**
 * @brief MOVL instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param pos  Robot motion target position, see NRC_Position
 * @param vel Robot motion speed, absolute speed of the robot end point position, in millimeters per second (mm/s), range: vel > 1
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 */
void NRC_Jobrun_MoveLinear(int robotNum, const NRC_Position & pos, double vel, double acc, double dec, int pl, bool moveToNextLine = false);


/**
 * @brief MOVC instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param mid_pos,end_pos  Robot motion target positions, see NRC_Position
 * @param vel Robot motion speed, absolute speed of the robot end point position, in millimeters per second (mm/s), range: vel > 1
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 * @note Note: MOVC cannot be run as the first instruction, and must be preceded by a MOVJ or MOVL instruction on the first call
 */
void NRC_Jobrun_MoveC(int robotNum, const NRC_Position& mid_pos,const NRC_Position& end_pos, double vel, double acc, double dec, int pl, bool moveToNextLine = false);


/**
 * @brief MOVS instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param pos Robot motion target position container, size must not be less than 4 (i.e., pos.size() >= 4), see NRC_Position for position settings
 * @param vel Robot motion speed, absolute speed of the robot end point position, in millimeters per second (mm/s), range: vel > 1
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 * @note Note: MOVS cannot be run as the first instruction, and must be preceded by a MOVJ or MOVL instruction on the first call
 */
void NRC_Jobrun_MoveS(int robotNum, int pointNum, const std::vector< NRC_Position>& pos, double vel, double acc, double dec, int pl, bool moveToNextLine = false);


/**
 * @brief IMOV instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param pos Robot motion target position container, size must not be less than 4 (i.e., pos.size() >= 4), see NRC_Position for position settings
 * @param vel Robot motion speed, absolute speed of the robot end point position, in millimeters per second (mm/s), range: vel > 1
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 * @param tm Pre-execution time, range: [0,999999], can be omitted, defaults to 0
 * @note Note: IMOV cannot be run as the first instruction, it must be preceded by a motion instruction
 */
int NRC_Jobrun_IMOV(int robotNum, const NRC_Position& offset, double vel, double acc, double dec, int pl, int tm = 0, bool moveToNextLine = false);


/**
 * @brief MOVJEXT instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param pos  Robot motion target position, see NRC_Position
 * @param syncPos  Robot motion target position, see NRC_SyncPosition
 * @param vel Robot motion speed, as a percentage of the robot's maximum speed, range: 0 < vel <= 100
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 */
void NRC_Jobrun_MoveDirectSync(int robotNum, const NRC_Position & pos, const NRC_SyncPosition & syncPos, double vel, double acc, double dec, int pl, bool moveToNextLine = false);


/**
 * @brief MOVLEXT instruction for custom job file instruction calls, cannot be called directly
 * @param robotNum Robot number [1-4]
 * @param pos  Robot motion target position, see NRC_Position
 * @param syncPos  Robot motion target position, see NRC_SyncPosition
 * @param vel Robot motion speed, absolute speed of the robot end point position, in millimeters per second (mm/s), range: vel > 1
 * @param acc Robot motion acceleration, as a percentage of each joint's maximum acceleration, range: 0 < vel <= 100
 * @param dec Robot motion deceleration, as a percentage of each joint's maximum deceleration, range: 0 < vel <= 100
 * @param pl Smoothness, will smooth-transition with the next motion instruction. Higher values mean smoother with larger trajectory deviation, range: 0 <= pl <= 5
 * @param moveToNextLine Whether to advance to the next line, only set moveToNextLine to true for the last instruction
 * @param sync Whether to synchronize
 */
void NRC_Jobrun_MoveLinearSync(int robotNum, const NRC_Position & pos, const NRC_SyncPosition & syncPos, double vel, double acc, double dec, int pl, int sync, bool moveToNextLine = false);
/**
 * @brief Block non-motion instructions. When a robot motion instruction is currently executing and has not completed, it will block at this interface, preventing the program from continuing execution;
 * @brief During breakpoint recovery, the program will continue executing from this interface where it was paused
 */
void NRC_JobRun_BlockNotMoveInstruction();