示教
机器人索引设置/获取
void Test()
{
int rob_index=0;
int err=-1;
err=set_robot_index(robot_index); // Success: err=0 Fail: err!=0
int ind=-1;
ind=get_robot_index();
cout << "get_robot_index OK " << endl;
}
set_robot_index
设置机器人索引
get_robot_index
获取机器人索引
rob_index
机器人索引
机器人工具设置/获取
void Test()
{
string toolName = "";
const char * tool_name = toolName.c_str();
int isRobotToolSet = set_robot_tool(tool_name); // Success: isRobotToolSet=0 Fail: isRobotToolSet!=0
cout << "set_robot_tool OK " << endl;
string robot_tool = get_robot_tool();
cout << "get_robot_tool OK " << endl;
}
set_robot_tool
设置当前操作机器人工具
get_robot_tool
获取当前操作机器人工具
toolName
工具名称
机器人工件设置/获取
void Test()
{
string wobjName = "";
const char * wobj_name = wobjName.c_str();
int isRobotWobjSet = set_robot_wobj(wobj_name);// Success: isRobotWobjSet=0 Fail: isRobotWobjSet!=0
cout << "set_robot_wobj OK " << endl;
string robot_wobj = get_robot_wobj();
cout << "get_robot_wobj OK " << endl;
}
set_robot_wobj
设置当前操作机器人工件
get_robot_wobj
获取当前操作机器人工件
wobjName
工件名称
机器人坐标系设置/获取
void Test()
{
int frame = 0;
int isTeachCoordSet = set_robot_teach_coordinate(frame);
cout << "set_robot_teach_coordinate OK " << endl;
int teach_coord = get_robot_teach_coordinate();
cout << "get_robot_teach_coordinate OK " << endl;
}
set_robot_teach_coordinate
设置当前操作机器人的坐标系
get_robot_teach_coordinate
获取当前操作机器人的坐标系
frame
坐标系编号, 0:关节;1:机器人基坐标系;2:机器人工具坐标系;3:机器人工件坐标系
获取机器人数量和状态
void Test()
{
// 机器人数量
int num = get_robot_num();
cout << "get_robot_num OK " << endl;
// 机器人自由度
int dof = get_robot_dof();
cout << "get_robot_dof OK " << endl;
// 机器人关节位置
double joint[ROBOT_MAX_DOF];
int isJointGot = get_robot_joint(joint);
gettimeofday(&tend,NULL);
int sec = tend.tv_sec;
cout << "joint: " << joint[0] << "," << joint[1] << ".. t= " << sec << endl;
double robot_coord[6];
int isCoordGot = get_robot_cartesian(robot_coord);
cout << "get_robot_cartesian OK " << endl;
}
get_robot_num
获取机器人数目
get_robot_dof
获取当前操作机器人的自由度
get_robot_joint
获取当前操作机器人的关节位置
get_robot_cartesian
获取当前操作机器人的笛卡尔位置
joint
机器人关节位置(rad)
robot_coord
机器人笛卡尔位置(mm, rad), 数据相对设置的坐标系描述
机器人示教速度设置/获取
void Test()
{
double valV = 0.5;
set_robot_teach_velocity(valV);
cout << "set_robot_teach_velocity OK " << endl;
double valV = get_robot_teach_velocity();
cout << "get_robot_teach_velocity OK " << endl;
}
set_robot_teach_velocity
设置当前操作机器人的示教速度
get_robot_teach_velocity
获取当前操作机器人的示教速度
valV
示教速度百分比(0~1)
机器人运行方式设置/获取
void Test()
{
int isSimulation = 1;
set_robot_run_type(isSimulation);
cout << "set_robot_run_type OK " << endl;
int run_type = get_robot_run_type();
cout << "get_robot_run_type OK " << endl;
}
set_robot_run_type
设置当前操作机器人的运行方式
get_robot_run_type
获取当前操作机器人的运行方式
isSimulation
0: 非仿真运行;1: 仿真运行
机器人运行状态获取
void Test()
{
int run_state = get_robot_run_state();
cout << "get_robot_run_state OK " << endl;
}
get_robot_run_state
获取当前操作机器人的运行状态
run_state
_move_finish(0):运动完成,_move_run_joint(1),_move_run_line(2),_move_run_cricle(3),_move_run_helical(4),_move_run_bspline(5),_move_run_zone(6),_move_stop(7),_move_run_zone_finish(8);其他:运动状态错误:_move_error(-1)
末端六维力传感器创建/标定/获取
void Test()
{
// 创建
string sensorName = "";
const char * sensor_name = sensorName.c_str();
int isTorqueSensorCreated = create_robot_torque_sensor(sensor_name);
cout << "create_robot_torque_sensor OK " << endl;
// 标定
string sensorName = "";
const char * sensor_name = sensorName.c_str();
int isTorqueSensorCalibed = calibration_robot_torque_sensor(sensor_name);
cout << "calibration_robot_torque_sensor OK " << endl;
// 获取
string sensorName = "";
const char * sensor_name = sensorName.c_str();
double dataTorqueSensor[6];
int isTorqueSensorData = get_robot_torque_sensor(sensor_name, dataTorqueSensor);
cout << "get_robot_torque_sensor OK " << endl;
}
create_robot_torque_sensor
创建末端六维力传感器
calibration_robot_torque_sensor
末端六维力传感器标定(仅需一次,永久生效)
get_robot_torque_sensor
获取末端六维力传感器数据
sensorName
创建时指定的名字,其他操作用到该名字。该名字与设备描述配置文件名一致(不包含后缀)
dataTorqueSensor
六维传感器数据,[fx, fy, fz, tx, ty, tz](N, Nm)
获取末端六维力传感器转换到工具数据
void Test()
{
string sensorName = "";
const char * sensor_name = sensorName.c_str();
double dataTorqueSensor[6];
int isTorqueSensorData = get_robot_torque_sensor(sensor_name, dataTorqueSensor);
cout << "get_robot_torque_sensor_transform OK " << endl;
}
get_robot_torque_sensor_transform
获取末端六维力传感器转换到工具数据
sensorName
创建时指定的名字
dataTorqueSensor
六维传感器数据,[fx,fy,fz,tx,ty,tz](N, Nm)
夹爪创建/开合控制
void Test()
{
string gripName = ”“;
const char * grip_name = gripName.c_str();
int isGripCreated = create_robot_grip(grip_name);
cout << "create_robot_grip OK " << endl;
string gripName = "";
const char * grip_name = gripName.c_str();
double gripPercent = 1.0;
int isGripControl = control_robot_grip(grip_name, gripPercent);
cout << "control_robot_grip OK " << endl;
}
create_robot_grip
创建夹爪
control_robot_grip
夹爪开合控制
gripName
创建时指定的名字,其他操作用到该名字。该名字与设备描述配置文件名一致(不包含后缀)
gripPercent
夹爪闭合程度,0.0~1.0之间取值,0.0完全伸展开,1.0完全夹紧
机器人错误运动状态清除
void Test()
{
robot_move_error_clear();
cout << "control_robot_grip OK " << endl;
}
robot_move_error_clear
清除当前操作机器人的错误运动状态
机器人项目启动/关闭
void Test()
{
string projectName = "";
const char * project_name = projectName.c_str();
int isProject = start_robot_project(project_name);
// int isProject = start_robot_c_project(project_name);
// int isProject = start_robot_lua_project(project_name);
cout << "start_robot_project OK " << endl;
int isProject = close_robot_project();
int isProject = close_robot_c_project();
int isProject = close_robot_lua_project();
cout << "close_robot_project OK " << endl;
}
start_robot_project
启动机器人项目
close_robot_project
关闭机器人项目
start_robot_c_project
启动机器人C项目
close_robot_c_project
关闭机器人C项目
start_robot_lua_project
启动机器人lua项目
close_robot_lua_project
关闭机器人lua项目
projectName
机器人项目名
保存机器人关节数据/位置及姿态数据
void Test()
{
string dataName = "";
const char * data_name = dataName.c_str();
int isSaved = save_robot_current_joint_data(data_name);
cout << "save_robot_current_joint_data OK " << endl;
string dataName = "";
const char * data_name = dataName.c_str();
int isSaved = save_robot_current_cartesian_data(data_name);
cout << "save_robot_current_cartesian_data OK " << endl;
}
save_robot_current_joint_data
保存当期操作机器人的当前关节数据
save_robot_current_cartesian_data
保存当期操作机器人的当前位置及姿态数据
dataName
数据名字,建议数据命名规则:”j1","j2",...,"jn"或”p1","p2",...,"pn",重名数据被覆盖
机器人使能/去使能
void Test()
{
int nState = robot_teach_enable();
cout << "robot_teach_enable OK " << endl;
int nState = robot_teach_disenable();
cout << "robot_teach_disenable OK " << endl;
}
robot_teach_enable
使能当前操作机器人
robot_teach_disenable
去使能当前操作机器人
nState
0: 执行成功;其他:运动状态错误或去使能失败(-1), _move_run_joint(1), _move_run_line(2), _move_run_cricle(3), _move_run_helical(4), _move_run_bspline(5), _move_run_zone(6), _move_stop(7), _move_run_zone_finish(8)
机器人示教移动停止
void Test()
{
int nState = robot_teach_stop();
cout << "robot_teach_stop OK " << endl;
}
robot_teach_stop
停止当前操作机器人的示教移动
机器人回零运动
void Test()
{
int move_state = robot_home();
cout << "robot_home OK " << endl;
}
robot_home
当前操作机器人回零运动
机器人运动到指定目标关节位置
void Test()
{
double movJ[ROBOT_MAX_DOF];
for(int ii=0; ii<ROBOT_MAX_DOF; ii++) {
movJ[ii] = request->reqarr(ii);
}
int move_state = robot_goto(movJ, dof);
cout << "robot_goto OK " << endl;
}
robot_goto
当前操作机器人运动到指定目标关节位置
movJ
机器人目标关节位置(rad)
dof
机器人机器人自由度
在关节空间示教机器人
void Test()
{
int axis_index = 1;
int direction = 1;
int move_state = robot_teach_joint(axis_index, direction);
cout << "robot_teach_joint OK " << endl;
}
robot_teach_joint
在关节空间示教当前操作机器人
axis_index
机器人关节索引(0, 1, 2, ...)
direction
运动方向,>0: 正方向运动,<0: 负方向运动,=0: 不运动
在笛卡尔空间示教机器人
void Test()
{
int axis_index = 0;
int direction = 1;
int move_state = robot_teach_cartesian(axis_index, direction);
cout << "robot_teach_cartesian OK " << endl;
cout << "robot_teach_joint OK " << endl;
}
robot_teach_cartesian
在笛卡尔空间示教当前操作机器人,运动相对坐标系包括:基座坐标系,工件坐标系,工具坐标系,由当前设置的坐标系决定
axis_index
机器人笛卡尔轴索引(0:x,1:y,2:z,3:rx,4:ry,5:rz)
direction
运动方向,>0:正方向运动,<0:负方向运动,=0:不运动
示教机器人
void Test()
{
int axis_index = 0;
int direction = 1;
int move_state = robot_teach_move(axis_index, direction);
cout << "robot_teach_move OK " << endl;
}
robot_teach_move
示教当前操作机器人,运动相对坐标系包括:关节坐标系,基座坐标系,工件坐标系,工具坐标系,由当前设置的坐标系决定
axis_index
机器人关节索引(0, 1, 2, ...)或机器人笛卡尔轴索引(0:x, 1:y, 2:z, 3:rx, 4:ry, 5:rz)
direction
运动方向,>0: 正方向运动,<0: 负方向运动,=0: 不运动