Servo mapping relationship configuration
Call the function int NRC_SetAllServoMapRelation(std::vector<int> servoMap,int syncGroupSum, int syncType[], std::vector<std::vector<int>> syncServoMap)
to set the servo mapping relationship.
- servoMap represents the robot servo mapping relationship, the number is the total number of robot axes set, and the value is the number of the servo connected to each axis.
- syncGroupSum is the maximum number of external axis groups, with a maximum of 3, supporting up to two dual-axis positioners and one ground rail.
- syncType indicates the type of external axis group, 0: none, 1: single-axis positioner, 2: dual-axis positioner, 3: ground rail.
- syncServoMap indicates the mapping relationship between the external axes and servos.
For example, if the robot axes are corresponding to the servos as follows: axis 1 is connected to servo 2, axis 2 is connected to servo 3, axis 3 is connected to servo 1, axis 4 is connected to servo 4, axis 5 is connected to servo 6, and axis 6 is connected to servo 5, then the value of servoMap is {2,3,1,4,6,5}.
Correspondence between the number of external axes and the servos:
- No external axes: syncGroupSum = 0;
- One single-axis positioner: syncGroupSum = 1, syncType = {1,0,0}, syncServoMap = {{7}}.
- Two dual-axis positioners and one ground rail: syncGroupSum = 3, syncType = {2,2,3}, syncServoMap = {{7,8},{9,10},{11}}.
C++ demo program for setting servo mapping relationship
#include <iostream>
#include "nrcAPI.h"
using namespace std;
void SetServoMap()
{
std::vector<int> servoMap = {0,0,0,0,0,0};//Robot mapping
int syncGroupNum = 1;//Number of external axis groups
int syncType[]={0,0,0};//External axis type
std::vector<std::vector<int>> syncServoMap={{0,0},{0,0},{0,0}};
NRC_SetAllServoMapRelation(servoMap,syncGroupNum,syncType,syncServoMap);
}
int main()
{
SystemStartup();//System startup, see section 3.3 for details
SetServoMap();//Set the servo mapping relationship, for program simplicity, adopt a call form
while(1)//Keep the program running
NRC_Delayms(1000);
}
}