Skip to main content

Mode switching and speed setting

Mode switching

The teach pendant system independently developed by Inexbot has three operation modes: teach mode, run mode and remote mode. In the teach mode, you can run the program step by step, and in the run mode, you can realize the existing functions on the teach pendant. Use enumeration type to define these three operation modes:

enum NRC_OperationMode

{NRC_TEACH_ = 0, ///< Teach mode
NRC_REMOTE_ = 1, ///< Remote mode
NRC_RUN_ = 2, ///< Run mode
}

Call the function NRC_SetOperationMode(NRC_OperationMode mode) to set the operation mode, where the parameter "mode" means to switch the current mode to this mode.

You can also call the function NRC_OperationMode NRC_GetOperationMode() to return the current mode. The teach speed should be appropriate.

Speed setting

(1) Call the function NRC_SetTeachRunSpeedPer(int speedPer) to set the teach speed percentage, where the speed parameter range is: 0 < speedPer <= 100, and the inching parameter range is: -1, -2 (in joint coordinate system: -1 means 0.1 degree, -2 means 0.01 degree; in other modes: -1 means 1mm/s, -2 means 0.1mm/s)

Call the function NRC_GetTeachRunSpeedPer() to get the teach speed percentage. The range of the return value is -2 < NRC_GetTeachRunSpeedPer() <= 100, and NRC_GetTeachRunSpeedPer() != 0. The actual speed should be the command speed multiplied by the teach speed percentage and then multiplied by the robot rated speed.

(2) Similarly, call the function NRC_SetAutoRunSpeedPer(int speedPer) to set the running speed percentage, with the speedPer parameter range of 0 < speedPer <= 100

Call the function NRC_GetAutoRunSpeedPer() to return the auto-run speed percentage, and the range of the return value should be 0 < NRC_GetARunSpeedPer() <= 10.

C++ demo program for setting operation mode

#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
//////The above call functions can be found in Appendix I/////
NRC_SetServoReadyStatus(1);//Set servo ready status, see section 3.8 for details
NRC_SetOperationMode(NRC_RUN_);//Set the operation mode to run mode
NRC_SetAutoRunSpeedPer(80);//Set the auto-run speed to 80
NRC_Delayms(1000);//Delay 1000ms
cout<< NRC_GetAutoRunSpeedPer()<<endl;
cout<<"Set the operation mode successfully"<<endl;
while(1)//Keep the program running
{
NRC_Delayms(1000);
}
}