Skip to main content

Cartesian jog and joint jog

Jog basic settings

When performing jog operation, the first step is to set the servo status as described in section 3.8, that is, call the NRC_SetServoReadyStatus(int status) function to switch the servo to ready state. Then call the function NRC_ServoEnable() to power on the servo. Once the function is successfully called, the servo will be powered on and enabled. Please pay attention to safety. Jog each axis of the robot individually to verify if the positive direction of each axis is correct.

(1) Set the joint jog speed by calling the function NRC_SetJogJointSpeedConfig(int axisNum, double maxSpeed, double acc).

  • The parameter "axisNum" is the number of the axis to be set. The parameter range is 1 <= axisNum <= total number of robot axes.
  • The parameter "maxSpeed" refers to the maximum speed that the axis can reach when jogging, unit: °/s.
  • The parameter "acc" refers to the acceleration of the axis when jogging, unit: °/s². It should be noted that this parameter needs to be set when the servo is stopped or in a ready state.

(2) Set the Cartesian jog speed by calling the function NRC_SetJogRectangularSpeedConfig(double maxSpeed, double acc).

  • The parameter "axSpeed" refers to the maximum speed that Cartesian coordinates can reach when jogging, unit: mm/s.
  • The parameter "acc" refers to the acceleration of the Cartesian coordinates when jogging, unit: mm/s². It should be noted that this parameter needs to be set when the servo is stopped or in a ready state.

(3) Set the jog sensitivity by calling the function NRC_SetJogSensitivitySpeedConfig(double sensitivity). The parameter "sensitivity" determines the responsiveness of the jog motion. A smaller value results in slower jog response, while a larger value introduces greater jog error. When the error is significant, it may cause robot to jitter. The unit of sensitivity is degrees, and the default initial value is 0.001. The valid range for the parameter is 0.0001 <= sensitivity < 1. It's important to note that this parameter should be set when the servo is stopped or in a ready state.

Jog

(1) After the servo is powered on and enabled, start jogging a certain axis. The function NRC_GetCurrentCoord() can be called to determine in which coordinate system the robot will move along the axis in the specified direction (dir). To ensure safety, the function NRC_JogMove(int axis, int dir) needs to be called every 200ms. If the function is not called within the timeout period, the robot will automatically stop jogging. During jogging, even if the function is called continuously, it will only be executed once. To perform the next jog, the function needs to be called again after stopping the current jog. Once the function is successfully called, the robot will start moving. Please pay attention to safety. The parameter "axis" specifies the axis to be jogged, with a range of 1-6, and the parameter "dir" indicates the direction of motion, where 1 represents forward and -1 represents reverse.

(2) Stop jogging by calling the function NRC_JogMoveStop(). The robot will decelerate and come to a stop. To check the current position of the robot, you can call the NRC_GetCurrentPos(NRC_COORD coord, NRC_Position& position) function to get the current position. The function outputs whether the robot has reached the target position. That is, this function retrieves the robot's position in the coordinate system specified by the "coord" parameter, and the position data is returned through the parameter reference "position". The robot position structure is as follows:

struct NRC_Position
{
std::vector<double> v;
NRC_COORD coord; ///< The coordinate system of the position
int usrNum; ///User coordinate system
int toolNum; ///Tool coordinate system
int configuration; ///Form value
/**
* @brief Value of the position
* - In the joint coordinate system, pos[0] to pos[6] correspond to robot's axis 1-7 respectively.
* - In other coordinate systems, pos[0] to pos[6] correspond to the robot's X-axis, Y-axis, Z-axis, A-axis, B-axis, C-axis, and wrist angle (for a 7-axis robot) respectively.
*/
double pos[7];
};

Power off the servo by calling the function NRC_ServoDisable(), that is, after successfully calling this function, the servo will be powered off and in a disabled state. The jogging motion is terminated. Jogging can be performed in joint coordinate system or Cartesian coordinate system.

C++ demo program for Cartesian jog and joint jog

#include <iostream>
#include "nrcAPI.h"
#include<stdio.h>
using namespace std;
int main()
{
SystemStartup();//System startup, see section 3.3 for details
RobotMsg();//Get the robot configuration, see section 3.4 for details
SetServoMap();//Set the servo mapping relationship, see section 3.5 for details
SettingofRobotRelatedParameters();//Robot-related parameter settings, see section 3.6 for details
NRC_SetServoReadyStatus(1);//Set servo ready status, see section 3.8 for details
//Basic settings before jogging
for (int i = 1; i < 7; i++)
{
NRC_SetJogJointSpeedConfig(i, 40, 800);
}//Joint jog speed setting
NRC_SetJogRectangularSpeedConfig(200, 3000);//Cartesian jog speed setting
NRC_SetJogSensitivitySpeedConfig(0.001);//Jog sensitivity setting
cout << "config Success" << endl;
//Joint jog
NRC_SetServoReadyStatus(1); //Set servo enable (servo ready state)
NRC_SetOperationMode(NRC_TEACH_);//Set the operation mode to teach mode
NRC_SetTeachRunSpeedPer(80);//Set teach speed
NRC_Position inexbot1; //Define the position structure object inexbot1
NRC_SetCurrentCoord(NRC_ACS);//Set the current coordinate system to joint coordinate system
NRC_GetCurrentPos(NRC_ACS, inexbot1); //Get the current joint coordinate position and assign it to inexbot1, i.e., the coordinate position before joint jogging
printf(" inexbot1.pos=%f,%f,%f,%f,%f,%f,%f,\n", inexbot1.pos[0], inexbot1.pos[1], inexbot1.pos[2], inexbot1.pos[3], inexbot1.pos[4], inexbot1.pos[5], inexbot1.pos[6]);
//printf(" inexbot1.pos=%f,%f,%f,%f,%f,%f,\n", inexbot1.pos[0], inexbot1.pos[1], inexbot1.pos[2], inexbot1.pos[3], inexbot1.pos[4], inexbot1.pos[5]);
NRC_Delayms(1000);//Delay 1000ms
NRC_ServoEnable();//Servo power on
for (int i = 1; i <7; i++)
{
for (int j = 1; j <7; j++)
{
NRC_JogMove(i, 1);
NRC_Delayms(200); //Delay 200ms
}
NRC_JogMoveStop(i);//Stop jogging
}//Joint jogging each axis in the positive direction
NRC_ServoDisable(); //Servo power off
NRC_Position inexbot2; //Define the position structure object inexbot2
NRC_GetCurrentPos(NRC_ACS, inexbot2);//Get the current joint coordinate position and assign it to inexbot2, i.e., the coordinate position after joint jogging
printf(" inexbot2.pos=%f,%f,%f,%f,%f,%f,%f,\n",inexbot2.pos[0], inexbot2.pos[1], inexbot2.pos[2], inexbot2.pos[3], inexbot2.pos[4], inexbot2.pos[5],inexbot2.pos[6]);
// printf(" inexbot2.pos=%f,%f,%f,%f,%f,%f,\n", inexbot2.pos[0], inexbot2.pos[1], inexbot2.pos[2], inexbot2.pos[3], inexbot2.pos[4], inexbot2.pos[5]);
cout << "ACS Jog success" << endl;
//Cartesian jog
NRC_SetServoReadyStatus(1); //Set servo enable (servo ready state)
NRC_SetOperationMode(NRC_TEACH_);//Set the operation mode to teach mode
NRC_SetTeachRunSpeedPer(80);//Set teach speed
NRC_Position inexbot3; //Define the position structure object inexbot3
NRC_SetCurrentCoord(NRC_MCS);//Set the current coordinate system to Cartesian coordinate system
NRC_GetCurrentPos(NRC_MCS, inexbot3); //Get the current Cartesian coordinate position and assign it to inexbot3, i.e., the coordinate position before Cartesian jogging
printf(" inexbot3.pos=%f,%f,%f,%f,%f,%f,%f,\n",inexbot3.pos[0], inexbot3.pos[1], inexbot3.pos[2], inexbot3.pos[3], inexbot3.pos[4], inexbot3.pos[5],inexbot3.pos[6]);
NRC_Delayms(1000);//Delay 1000ms
NRC_ServoEnable();//Servo power on
for (int i = 1; i < 4; i++)
{
for (int j = 1; j < 7; j++)
{
NRC_JogMove(i, 1);
NRC_Delayms(200); //Delay 200ms
}
NRC_JogMoveStop(i);//Stop jogging
}//Jog the basic axis 7 times in the positive direction
NRC_ServoDisable(); //Servo power off
NRC_Position inexbot4; //Define the position structure object inexbot4
NRC_GetCurrentPos(NRC_MCS, inexbot4);//Get the current Cartesian coordinate position and assign it to inexbot4, i.e., the coordinate position after Cartesian jogging
printf("inexbot4.pos=%f,%f,%f,%f,%f,%f,%f,\n", inexbot4.pos[0], inexbot4.pos[1], inexbot4.pos[2], inexbot4.pos[3], inexbot4.pos[4], inexbot4.pos[5],inexbot3.pos[6]);
cout << "MCS Jog success" << endl;
while (1)
{
NRC_Delayms(1000);
}
}