法奥机械臂更换SDK_3.8.6
This commit is contained in:
parent
f82f468a6b
commit
7d4be2936b
@ -1,445 +1,447 @@
|
||||
/**
|
||||
* @file FairinoRobotWrapper.cpp
|
||||
* @brief Fairino机器人SDK二次封装实现
|
||||
*/
|
||||
|
||||
#include "FairinoRobotWrapper.h"
|
||||
#include <cstring>
|
||||
|
||||
FairinoRobotWrapper::FairinoRobotWrapper()
|
||||
: robot_(std::make_unique<FRRobot>())
|
||||
, connected_(false)
|
||||
, last_error_(ERR_SUCCESS)
|
||||
{
|
||||
}
|
||||
|
||||
FairinoRobotWrapper::~FairinoRobotWrapper()
|
||||
{
|
||||
if (connected_) {
|
||||
Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::Connect(const std::string& ip)
|
||||
{
|
||||
if (connected_) {
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
last_error_ = robot_->RPC(ip.c_str());
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
connected_ = true;
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::Disconnect()
|
||||
{
|
||||
if (!connected_) {
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
last_error_ = robot_->CloseRPC();
|
||||
connected_ = false;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
bool FairinoRobotWrapper::IsConnected() const
|
||||
{
|
||||
return connected_;
|
||||
}
|
||||
|
||||
// ==================== 运动控制接口 ====================
|
||||
|
||||
errno_t FairinoRobotWrapper::MoveL(double x, double y, double z,
|
||||
double rx, double ry, double rz,
|
||||
float vel, float acc, float blendR,
|
||||
int tool, int user)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 构造目标笛卡尔位姿
|
||||
DescPose desc_pos(x, y, z, rx, ry, rz);
|
||||
|
||||
// 扩展轴位置(不使用)
|
||||
ExaxisPos epos;
|
||||
memset(&epos, 0, sizeof(epos));
|
||||
|
||||
// 偏移量(不偏移)
|
||||
DescPose offset_pos;
|
||||
|
||||
// 使用不需要关节位置输入的MoveL重载版本
|
||||
last_error_ = robot_->MoveL(&desc_pos, tool, user, vel, acc, 100.0f, blendR, 0, &epos, 0, 0, &offset_pos, -1, 0, 0, 10);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::MoveJByPose(double x, double y, double z,
|
||||
double rx, double ry, double rz,
|
||||
float vel, float acc, float blendT,
|
||||
int tool, int user)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 首先使用逆运动学计算关节位置
|
||||
DescPose desc_pos(x, y, z, rx, ry, rz);
|
||||
JointPos joint_pos;
|
||||
|
||||
last_error_ = robot_->GetInverseKin(0, &desc_pos, -1, &joint_pos);
|
||||
if (last_error_ != ERR_SUCCESS) {
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 扩展轴位置(不使用)
|
||||
ExaxisPos epos;
|
||||
memset(&epos, 0, sizeof(epos));
|
||||
|
||||
// 偏移量(不偏移)
|
||||
DescPose offset_pos;
|
||||
|
||||
// 使用MoveJ进行关节空间运动
|
||||
last_error_ = robot_->MoveJ(&joint_pos, &desc_pos, tool, user, vel, acc, 100.0f, &epos, blendT, 0, &offset_pos);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::MoveJByJoint(double j1, double j2, double j3,
|
||||
double j4, double j5, double j6,
|
||||
float vel, float acc, float blendT,
|
||||
int tool, int user)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 构造目标关节位置
|
||||
JointPos joint_pos(j1, j2, j3, j4, j5, j6);
|
||||
|
||||
// 扩展轴位置(不使用)
|
||||
ExaxisPos epos;
|
||||
memset(&epos, 0, sizeof(epos));
|
||||
|
||||
// 偏移量(不偏移)
|
||||
DescPose offset_pos;
|
||||
|
||||
// 使用不需要笛卡尔位置输入的MoveJ重载版本
|
||||
last_error_ = robot_->MoveJ(&joint_pos, tool, user, vel, acc, 100.0f, &epos, blendT, 0, &offset_pos);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// ==================== 辅助接口 ====================
|
||||
|
||||
errno_t FairinoRobotWrapper::StopMotion()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->StopMotion();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::PauseMotion()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->PauseMotion();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::ResumeMotion()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->ResumeMotion();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::RobotEnable(uint8_t state)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->RobotEnable(state);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::ResetAllError()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->ResetAllError();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetCurrentJointPos(double& j1, double& j2, double& j3,
|
||||
double& j4, double& j5, double& j6,
|
||||
uint8_t blocking)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
JointPos joint_pos;
|
||||
last_error_ = robot_->GetActualJointPosDegree(blocking, &joint_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
j1 = joint_pos.jPos[0];
|
||||
j2 = joint_pos.jPos[1];
|
||||
j3 = joint_pos.jPos[2];
|
||||
j4 = joint_pos.jPos[3];
|
||||
j5 = joint_pos.jPos[4];
|
||||
j6 = joint_pos.jPos[5];
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetCurrentTCPPose(double& x, double& y, double& z,
|
||||
double& rx, double& ry, double& rz,
|
||||
uint8_t blocking)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose desc_pos;
|
||||
last_error_ = robot_->GetActualTCPPose(blocking, &desc_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
x = desc_pos.tran.x;
|
||||
y = desc_pos.tran.y;
|
||||
z = desc_pos.tran.z;
|
||||
rx = desc_pos.rpy.rx;
|
||||
ry = desc_pos.rpy.ry;
|
||||
rz = desc_pos.rpy.rz;
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetMotionDone(uint8_t& state)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->GetRobotMotionDone(&state);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetErrorCode(int& maincode, int& subcode)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->GetRobotErrorCode(&maincode, &subcode);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetRobotState(ROBOT_STATE_PKG& state)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->GetRobotRealTimeState(&state);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::SetToolCoord(int id, double x, double y, double z,
|
||||
double rx, double ry, double rz)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose coord(x, y, z, rx, ry, rz);
|
||||
last_error_ = robot_->SetToolCoord(id, &coord, 0, 0, 0, 0);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::SetWObjCoord(int id, double x, double y, double z,
|
||||
double rx, double ry, double rz, int refFrame)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose coord(x, y, z, rx, ry, rz);
|
||||
last_error_ = robot_->SetWObjCoord(id, &coord, refFrame);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::SetSpeed(int vel)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->SetSpeed(vel);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::Wait(int ms)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->WaitMs(ms);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::GetSDKVersion()
|
||||
{
|
||||
char version[64] = {0};
|
||||
if (robot_) {
|
||||
robot_->GetSDKVersion(version);
|
||||
}
|
||||
return std::string(version);
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::GetControllerIP()
|
||||
{
|
||||
if (!connected_) {
|
||||
return "";
|
||||
}
|
||||
|
||||
char ip[64] = {0};
|
||||
robot_->GetControllerIP(ip);
|
||||
return std::string(ip);
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::ForwardKinematics(double j1, double j2, double j3,
|
||||
double j4, double j5, double j6,
|
||||
double& x, double& y, double& z,
|
||||
double& rx, double& ry, double& rz)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
JointPos joint_pos(j1, j2, j3, j4, j5, j6);
|
||||
DescPose desc_pos;
|
||||
|
||||
last_error_ = robot_->GetForwardKin(&joint_pos, &desc_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
x = desc_pos.tran.x;
|
||||
y = desc_pos.tran.y;
|
||||
z = desc_pos.tran.z;
|
||||
rx = desc_pos.rpy.rx;
|
||||
ry = desc_pos.rpy.ry;
|
||||
rz = desc_pos.rpy.rz;
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::InverseKinematics(double x, double y, double z,
|
||||
double rx, double ry, double rz,
|
||||
double& j1, double& j2, double& j3,
|
||||
double& j4, double& j5, double& j6,
|
||||
int config)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose desc_pos(x, y, z, rx, ry, rz);
|
||||
JointPos joint_pos;
|
||||
|
||||
last_error_ = robot_->GetInverseKin(0, &desc_pos, config, &joint_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
j1 = joint_pos.jPos[0];
|
||||
j2 = joint_pos.jPos[1];
|
||||
j3 = joint_pos.jPos[2];
|
||||
j4 = joint_pos.jPos[3];
|
||||
j5 = joint_pos.jPos[4];
|
||||
j6 = joint_pos.jPos[5];
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::GetLastErrorString() const
|
||||
{
|
||||
return ErrorToString(last_error_);
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::ErrorToString(errno_t error) const
|
||||
{
|
||||
switch (error) {
|
||||
case ERR_SUCCESS:
|
||||
return "成功";
|
||||
case ERR_OTHER:
|
||||
return "其他错误";
|
||||
case ERR_SOCKET_COM_FAILED:
|
||||
return "网络通讯异常";
|
||||
case ERR_XMLRPC_COM_FAILED:
|
||||
return "XMLRPC通讯失败,请检查网络连接以及服务器IP地址";
|
||||
case ERR_XMLRPC_CMD_FAILED:
|
||||
return "XMLRPC接口执行失败";
|
||||
case ERR_LUA_FILE_NOT_FOUND:
|
||||
return "LUA文件不存在";
|
||||
case ERR_SAVE_FILE_PATH_NOT_FOUND:
|
||||
return "保存文件路径不存在";
|
||||
case ERR_UPLOAD_FILE_NOT_FOUND:
|
||||
return "上传文件不存在";
|
||||
case ERR_DOWN_LOAD_FILE_FAILED:
|
||||
return "文件下载失败";
|
||||
case ERR_DOWN_LOAD_FILE_CHECK_FAILED:
|
||||
return "文件下载校验失败";
|
||||
case ERR_DOWN_LOAD_FILE_WRITE_FAILED:
|
||||
return "下载文件写入失败";
|
||||
case ERR_FILE_NAME:
|
||||
return "文件名称异常";
|
||||
case ERR_UPLOAD_FILE_ERROR:
|
||||
return "上传文件异常";
|
||||
case ERR_FILE_TOO_LARGE:
|
||||
return "文件大小超限";
|
||||
case ERR_FILE_OPEN_FAILED:
|
||||
return "文件打开失败";
|
||||
case ERR_SOCKET_SEND_FAILED:
|
||||
return "Socket发送失败";
|
||||
case ERR_SOCKET_RECV_FAILED:
|
||||
return "Socket接收失败";
|
||||
case ERR_PARAM_NUM:
|
||||
return "参数个数不一致";
|
||||
case ERR_PARAM_VALUE:
|
||||
return "参数值不在合理范围";
|
||||
case ERR_TPD_FILE_OPEN_FAILED:
|
||||
return "TPD文件打开失败";
|
||||
case ERR_EXECUTION_FAILED:
|
||||
return "指令执行失败";
|
||||
case ERR_PROGRAM_IS_RUNNING:
|
||||
return "程序正在运行";
|
||||
case ERR_COMPUTE_FAILED:
|
||||
return "计算失败";
|
||||
case ERR_INVERSE_KINEMATICS_COMPUTE_FAILED:
|
||||
return "逆运动学计算失败";
|
||||
case ERR_SERVOJ_JOINT_OVERRUN:
|
||||
return "关节值超限";
|
||||
case ERR_NON_RESSETTABLE_FAULT:
|
||||
return "不可复位故障,请断电重启控制箱";
|
||||
case ERR_STRANGE_POSE:
|
||||
return "奇异位姿";
|
||||
case ERR_TARGET_POSE_CANNOT_REACHED:
|
||||
return "目标位姿无法到达";
|
||||
default:
|
||||
return "未知错误码: " + std::to_string(error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @file FairinoRobotWrapper.cpp
|
||||
* @brief Fairino机器人SDK二次封装实现
|
||||
*/
|
||||
|
||||
#include "FairinoRobotWrapper.h"
|
||||
#include "VrLog.h"
|
||||
#include <cstring>
|
||||
|
||||
FairinoRobotWrapper::FairinoRobotWrapper()
|
||||
: robot_(std::make_unique<FRRobot>())
|
||||
, connected_(false)
|
||||
, last_error_(ERR_SUCCESS)
|
||||
{
|
||||
}
|
||||
|
||||
FairinoRobotWrapper::~FairinoRobotWrapper()
|
||||
{
|
||||
if (connected_) {
|
||||
Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::Connect(const std::string& ip)
|
||||
{
|
||||
if (connected_) {
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
last_error_ = robot_->RPC(ip.c_str());
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
connected_ = true;
|
||||
}
|
||||
LOG_DEBUG("link robot ip : %s result: %d \n", ip.c_str(), last_error_);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::Disconnect()
|
||||
{
|
||||
if (!connected_) {
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
last_error_ = robot_->CloseRPC();
|
||||
connected_ = false;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
bool FairinoRobotWrapper::IsConnected() const
|
||||
{
|
||||
return connected_;
|
||||
}
|
||||
|
||||
// ==================== 运动控制接口 ====================
|
||||
|
||||
errno_t FairinoRobotWrapper::MoveL(double x, double y, double z,
|
||||
double rx, double ry, double rz,
|
||||
float vel, float acc, float blendR,
|
||||
int tool, int user)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 构造目标笛卡尔位姿
|
||||
DescPose desc_pos(x, y, z, rx, ry, rz);
|
||||
|
||||
// 扩展轴位置(不使用)
|
||||
ExaxisPos epos;
|
||||
memset(&epos, 0, sizeof(epos));
|
||||
|
||||
// 偏移量(不偏移)
|
||||
DescPose offset_pos;
|
||||
|
||||
// 使用不需要关节位置输入的MoveL重载版本
|
||||
last_error_ = robot_->MoveL(&desc_pos, tool, user, vel, acc, 100.0f, blendR, 0, &epos, 0, 0, &offset_pos, -1, 0, 0, 10);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::MoveJByPose(double x, double y, double z,
|
||||
double rx, double ry, double rz,
|
||||
float vel, float acc, float blendT,
|
||||
int tool, int user)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 首先使用逆运动学计算关节位置
|
||||
DescPose desc_pos(x, y, z, rx, ry, rz);
|
||||
JointPos joint_pos;
|
||||
|
||||
last_error_ = robot_->GetInverseKin(0, &desc_pos, -1, &joint_pos);
|
||||
if (last_error_ != ERR_SUCCESS) {
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 扩展轴位置(不使用)
|
||||
ExaxisPos epos;
|
||||
memset(&epos, 0, sizeof(epos));
|
||||
|
||||
// 偏移量(不偏移)
|
||||
DescPose offset_pos;
|
||||
|
||||
// 使用MoveJ进行关节空间运动
|
||||
last_error_ = robot_->MoveJ(&joint_pos, &desc_pos, tool, user, vel, acc, 100.0f, &epos, blendT, 0, &offset_pos);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::MoveJByJoint(double j1, double j2, double j3,
|
||||
double j4, double j5, double j6,
|
||||
float vel, float acc, float blendT,
|
||||
int tool, int user)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// 构造目标关节位置
|
||||
JointPos joint_pos(j1, j2, j3, j4, j5, j6);
|
||||
|
||||
// 扩展轴位置(不使用)
|
||||
ExaxisPos epos;
|
||||
memset(&epos, 0, sizeof(epos));
|
||||
|
||||
// 偏移量(不偏移)
|
||||
DescPose offset_pos;
|
||||
|
||||
// 使用不需要笛卡尔位置输入的MoveJ重载版本
|
||||
last_error_ = robot_->MoveJ(&joint_pos, tool, user, vel, acc, 100.0f, &epos, blendT, 0, &offset_pos);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
// ==================== 辅助接口 ====================
|
||||
|
||||
errno_t FairinoRobotWrapper::StopMotion()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->StopMotion();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::PauseMotion()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->PauseMotion();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::ResumeMotion()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->ResumeMotion();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::RobotEnable(uint8_t state)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->RobotEnable(state);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::ResetAllError()
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->ResetAllError();
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetCurrentJointPos(double& j1, double& j2, double& j3,
|
||||
double& j4, double& j5, double& j6,
|
||||
uint8_t blocking)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
JointPos joint_pos;
|
||||
last_error_ = robot_->GetActualJointPosDegree(blocking, &joint_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
j1 = joint_pos.jPos[0];
|
||||
j2 = joint_pos.jPos[1];
|
||||
j3 = joint_pos.jPos[2];
|
||||
j4 = joint_pos.jPos[3];
|
||||
j5 = joint_pos.jPos[4];
|
||||
j6 = joint_pos.jPos[5];
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetCurrentTCPPose(double& x, double& y, double& z,
|
||||
double& rx, double& ry, double& rz,
|
||||
uint8_t blocking)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose desc_pos;
|
||||
last_error_ = robot_->GetActualTCPPose(blocking, &desc_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
x = desc_pos.tran.x;
|
||||
y = desc_pos.tran.y;
|
||||
z = desc_pos.tran.z;
|
||||
rx = desc_pos.rpy.rx;
|
||||
ry = desc_pos.rpy.ry;
|
||||
rz = desc_pos.rpy.rz;
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetMotionDone(uint8_t& state)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->GetRobotMotionDone(&state);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetErrorCode(int& maincode, int& subcode)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->GetRobotErrorCode(&maincode, &subcode);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::GetRobotState(ROBOT_STATE_PKG& state)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->GetRobotRealTimeState(&state);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::SetToolCoord(int id, double x, double y, double z,
|
||||
double rx, double ry, double rz)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose coord(x, y, z, rx, ry, rz);
|
||||
last_error_ = robot_->SetToolCoord(id, &coord, 0, 0, 0, 0);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::SetWObjCoord(int id, double x, double y, double z,
|
||||
double rx, double ry, double rz, int refFrame)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose coord(x, y, z, rx, ry, rz);
|
||||
last_error_ = robot_->SetWObjCoord(id, &coord, refFrame);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::SetSpeed(int vel)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->SetSpeed(vel);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::Wait(int ms)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
last_error_ = robot_->WaitMs(ms);
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::GetSDKVersion()
|
||||
{
|
||||
char version[64] = {0};
|
||||
if (robot_) {
|
||||
robot_->GetSDKVersion(version);
|
||||
}
|
||||
return std::string(version);
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::GetControllerIP()
|
||||
{
|
||||
if (!connected_) {
|
||||
return "";
|
||||
}
|
||||
|
||||
char ip[64] = {0};
|
||||
robot_->GetControllerIP(ip);
|
||||
return std::string(ip);
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::ForwardKinematics(double j1, double j2, double j3,
|
||||
double j4, double j5, double j6,
|
||||
double& x, double& y, double& z,
|
||||
double& rx, double& ry, double& rz)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
JointPos joint_pos(j1, j2, j3, j4, j5, j6);
|
||||
DescPose desc_pos;
|
||||
|
||||
last_error_ = robot_->GetForwardKin(&joint_pos, &desc_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
x = desc_pos.tran.x;
|
||||
y = desc_pos.tran.y;
|
||||
z = desc_pos.tran.z;
|
||||
rx = desc_pos.rpy.rx;
|
||||
ry = desc_pos.rpy.ry;
|
||||
rz = desc_pos.rpy.rz;
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
errno_t FairinoRobotWrapper::InverseKinematics(double x, double y, double z,
|
||||
double rx, double ry, double rz,
|
||||
double& j1, double& j2, double& j3,
|
||||
double& j4, double& j5, double& j6,
|
||||
int config)
|
||||
{
|
||||
if (!connected_) {
|
||||
last_error_ = ERR_SOCKET_COM_FAILED;
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
DescPose desc_pos(x, y, z, rx, ry, rz);
|
||||
JointPos joint_pos;
|
||||
|
||||
last_error_ = robot_->GetInverseKin(0, &desc_pos, config, &joint_pos);
|
||||
if (last_error_ == ERR_SUCCESS) {
|
||||
j1 = joint_pos.jPos[0];
|
||||
j2 = joint_pos.jPos[1];
|
||||
j3 = joint_pos.jPos[2];
|
||||
j4 = joint_pos.jPos[3];
|
||||
j5 = joint_pos.jPos[4];
|
||||
j6 = joint_pos.jPos[5];
|
||||
}
|
||||
return last_error_;
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::GetLastErrorString() const
|
||||
{
|
||||
return ErrorToString(last_error_);
|
||||
}
|
||||
|
||||
std::string FairinoRobotWrapper::ErrorToString(errno_t error) const
|
||||
{
|
||||
switch (error) {
|
||||
case ERR_SUCCESS:
|
||||
return "成功";
|
||||
case ERR_OTHER:
|
||||
return "其他错误";
|
||||
case ERR_SOCKET_COM_FAILED:
|
||||
return "网络通讯异常";
|
||||
case ERR_XMLRPC_COM_FAILED:
|
||||
return "XMLRPC通讯失败,请检查网络连接以及服务器IP地址";
|
||||
case ERR_XMLRPC_CMD_FAILED:
|
||||
return "XMLRPC接口执行失败";
|
||||
case ERR_LUA_FILE_NOT_FOUND:
|
||||
return "LUA文件不存在";
|
||||
case ERR_SAVE_FILE_PATH_NOT_FOUND:
|
||||
return "保存文件路径不存在";
|
||||
case ERR_UPLOAD_FILE_NOT_FOUND:
|
||||
return "上传文件不存在";
|
||||
case ERR_DOWN_LOAD_FILE_FAILED:
|
||||
return "文件下载失败";
|
||||
case ERR_DOWN_LOAD_FILE_CHECK_FAILED:
|
||||
return "文件下载校验失败";
|
||||
case ERR_DOWN_LOAD_FILE_WRITE_FAILED:
|
||||
return "下载文件写入失败";
|
||||
case ERR_FILE_NAME:
|
||||
return "文件名称异常";
|
||||
case ERR_UPLOAD_FILE_ERROR:
|
||||
return "上传文件异常";
|
||||
case ERR_FILE_TOO_LARGE:
|
||||
return "文件大小超限";
|
||||
case ERR_FILE_OPEN_FAILED:
|
||||
return "文件打开失败";
|
||||
case ERR_SOCKET_SEND_FAILED:
|
||||
return "Socket发送失败";
|
||||
case ERR_SOCKET_RECV_FAILED:
|
||||
return "Socket接收失败";
|
||||
case ERR_PARAM_NUM:
|
||||
return "参数个数不一致";
|
||||
case ERR_PARAM_VALUE:
|
||||
return "参数值不在合理范围";
|
||||
case ERR_TPD_FILE_OPEN_FAILED:
|
||||
return "TPD文件打开失败";
|
||||
case ERR_EXECUTION_FAILED:
|
||||
return "指令执行失败";
|
||||
case ERR_PROGRAM_IS_RUNNING:
|
||||
return "程序正在运行";
|
||||
case ERR_COMPUTE_FAILED:
|
||||
return "计算失败";
|
||||
case ERR_INVERSE_KINEMATICS_COMPUTE_FAILED:
|
||||
return "逆运动学计算失败";
|
||||
case ERR_SERVOJ_JOINT_OVERRUN:
|
||||
return "关节值超限";
|
||||
case ERR_NON_RESSETTABLE_FAULT:
|
||||
return "不可复位故障,请断电重启控制箱";
|
||||
case ERR_STRANGE_POSE:
|
||||
return "奇异位姿";
|
||||
case ERR_TARGET_POSE_CANNOT_REACHED:
|
||||
return "目标位姿无法到达";
|
||||
default:
|
||||
return "未知错误码: " + std::to_string(error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,50 +1,52 @@
|
||||
# FairinoWrapper.pro
|
||||
# Fairino机器人SDK封装库项目(支持静态库/动态库)
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += c++17
|
||||
CONFIG -= qt
|
||||
|
||||
TARGET = FairinoWrapper
|
||||
|
||||
# 编译为静态库或动态库(取消注释以下行切换为动态库)
|
||||
CONFIG += staticlib
|
||||
#CONFIG += shared
|
||||
|
||||
# 定义导出宏(编译库时定义)
|
||||
DEFINES += FAIRINO_WRAPPER_LIB
|
||||
|
||||
# Windows下使用UTF-8编码
|
||||
win32 {
|
||||
QMAKE_CXXFLAGS += /utf-8
|
||||
}
|
||||
|
||||
# 头文件包含路径
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include/Robot-CN
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include
|
||||
|
||||
# 源文件
|
||||
SOURCES += \
|
||||
FairinoRobotWrapper.cpp
|
||||
|
||||
# 头文件
|
||||
HEADERS += \
|
||||
FairinoRobotWrapper.h
|
||||
|
||||
# 依赖libfairino库
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/release/ -lfairino
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/debug/ -lfairino
|
||||
else:unix: LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/ -lfairino
|
||||
|
||||
# Windows平台链接库
|
||||
win32 {
|
||||
LIBS += -lws2_32
|
||||
}
|
||||
|
||||
# Linux/Unix平台配置
|
||||
unix {
|
||||
QMAKE_CXXFLAGS += -fPIC
|
||||
target.path = /usr/lib
|
||||
}
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
# FairinoWrapper.pro
|
||||
# Fairino机器人SDK封装库项目(支持静态库/动态库)
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += c++17
|
||||
CONFIG -= qt
|
||||
|
||||
TARGET = FairinoWrapper
|
||||
|
||||
# 编译为静态库或动态库(取消注释以下行切换为动态库)
|
||||
CONFIG += staticlib
|
||||
#CONFIG += shared
|
||||
|
||||
# 定义导出宏(编译库时定义)
|
||||
DEFINES += FAIRINO_WRAPPER_LIB
|
||||
|
||||
# Windows下使用UTF-8编码
|
||||
win32 {
|
||||
QMAKE_CXXFLAGS += /utf-8
|
||||
}
|
||||
|
||||
# 头文件包含路径
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += $$PWD/../../Utils/VrCommon/Inc
|
||||
INCLUDEPATH += $$PWD/../../Utils/VrUtils/Inc
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include/Robot-CN
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include
|
||||
|
||||
# 源文件
|
||||
SOURCES += \
|
||||
FairinoRobotWrapper.cpp
|
||||
|
||||
# 头文件
|
||||
HEADERS += \
|
||||
FairinoRobotWrapper.h
|
||||
|
||||
# 依赖libfairino库
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/release/ -lfairino
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/debug/ -lfairino
|
||||
else:unix: LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/ -lfairino
|
||||
|
||||
# Windows平台链接库
|
||||
win32 {
|
||||
LIBS += -lws2_32
|
||||
}
|
||||
|
||||
# Linux/Unix平台配置
|
||||
unix {
|
||||
QMAKE_CXXFLAGS += -fPIC
|
||||
target.path = /usr/lib
|
||||
}
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
@ -58,24 +58,21 @@ file(GLOB ALL_SRC ${BASE_SRC}/*.cpp
|
||||
|
||||
if(WIN32)
|
||||
# 静态库路径
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Release)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Debug)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
|
||||
# 动态库路径
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Release)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Debug)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Release)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Debug)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
|
||||
|
||||
add_library(fairino SHARED ${ALL_INCLUDE} ${ALL_SRC})
|
||||
#add_library(fairinod STATIC ${ALL_INCLUDE} ${ALL_SRC})
|
||||
add_library(fairinod STATIC ${ALL_INCLUDE} ${ALL_SRC})
|
||||
target_link_libraries(fairino ws2_32)
|
||||
target_link_libraries(fairino Shlwapi)
|
||||
|
||||
#add_executable(test_fairino ${ALL_INCLUDE} ${ALL_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
|
||||
#target_link_libraries(test_fairino ws2_32)
|
||||
#target_link_libraries(test_fairino Shlwapi)
|
||||
|
||||
add_executable(test_fairino ${ALL_INCLUDE} ${ALL_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
|
||||
target_link_libraries(test_fairino ws2_32)
|
||||
target_link_libraries(test_fairino Shlwapi)
|
||||
target_link_libraries(test_fairino ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Release/fairino.lib)
|
||||
elseif(UNIX)
|
||||
# 静态库路径
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/LinuxBuild/bin)
|
||||
@ -90,7 +87,7 @@ elseif(UNIX)
|
||||
# 关闭优化选项
|
||||
target_compile_options(fairino PRIVATE -O0)
|
||||
# 为动态库生成版本信息
|
||||
set_target_properties(fairino PROPERTIES VERSION 2.3.2 SOVERSION 2)
|
||||
set_target_properties(fairino PROPERTIES VERSION 2.2.6 SOVERSION 2)
|
||||
|
||||
add_executable(test_fairino ${ALL_INCLUDE} ${ALL_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
@ -99,5 +96,5 @@ elseif(UNIX)
|
||||
# 关闭优化选项
|
||||
target_compile_options(test_fairino PRIVATE -O0)
|
||||
target_link_libraries(test_fairino pthread)
|
||||
#target_link_libraries(test_fairino ${CMAKE_CURRENT_SOURCE_DIR}/LinuxBuild/bin/libfairino.so)
|
||||
target_link_libraries(test_fairino ${CMAKE_CURRENT_SOURCE_DIR}/LinuxBuild/bin/libfairino.so)
|
||||
endif()
|
||||
@ -18,4 +18,4 @@ windows 下的编译方法:
|
||||
linux 下的编译方法
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
make
|
||||
@ -1,21 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// 跨平台获取文件大小的函数
|
||||
std::streampos GetFileSize(const std::string& filePath);
|
||||
|
||||
//从文件路径种取文件名称
|
||||
std::string GetFileNameInPath(std::string path);
|
||||
|
||||
//检查本地文件是否存在
|
||||
bool CheckFileIsExist(std::string path);
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// 跨平台获取文件大小的函数
|
||||
std::streampos GetFileSize(const std::string& filePath);
|
||||
|
||||
//从文件路径种取文件名称
|
||||
std::string GetFileNameInPath(std::string path);
|
||||
|
||||
//检查本地文件是否存在
|
||||
bool CheckFileIsExist(std::string path);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,400 +1,323 @@
|
||||
#ifndef ROBOTTYPES_H_
|
||||
#define ROBOTTYPES_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
|
||||
typedef int errno_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short int uint16_t;
|
||||
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
/**
|
||||
* @brief 关节位置数据类型
|
||||
*/
|
||||
typedef struct JointPos
|
||||
{
|
||||
double jPos[6]; /* 六个关节位置,单位deg */
|
||||
JointPos(double J1, double J2, double J3, double J4, double J5, double J6)
|
||||
{
|
||||
jPos[0] = J1;
|
||||
jPos[1] = J2;
|
||||
jPos[2] = J3;
|
||||
jPos[3] = J4;
|
||||
jPos[4] = J5;
|
||||
jPos[5] = J6;
|
||||
}
|
||||
|
||||
JointPos()
|
||||
{
|
||||
jPos[0] = 0.0;
|
||||
jPos[1] = 0.0;
|
||||
jPos[2] = 0.0;
|
||||
jPos[3] = 0.0;
|
||||
jPos[4] = 0.0;
|
||||
jPos[5] = 0.0;
|
||||
}
|
||||
}JointPos;
|
||||
|
||||
/**
|
||||
* @brief 笛卡尔空间位置数据类型
|
||||
*/
|
||||
typedef struct DescTran
|
||||
{
|
||||
double x; /* x轴坐标,单位mm */
|
||||
double y; /* y轴坐标,单位mm */
|
||||
double z; /* z轴坐标,单位mm */
|
||||
|
||||
DescTran(double _x, double _y, double _z)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
}
|
||||
|
||||
DescTran()
|
||||
{
|
||||
x = 0.0;
|
||||
y = 0.0;
|
||||
z = 0.0;
|
||||
}
|
||||
} DescTran;
|
||||
|
||||
/**
|
||||
* @brief 欧拉角姿态数据类型
|
||||
*/
|
||||
typedef struct Rpy
|
||||
{
|
||||
double rx; /* 绕固定轴X旋转角度,单位:deg */
|
||||
double ry; /* 绕固定轴Y旋转角度,单位:deg */
|
||||
double rz; /* 绕固定轴Z旋转角度,单位:deg */
|
||||
Rpy(double _rx, double _ry, double _rz)
|
||||
{
|
||||
rx = _rx;
|
||||
ry = _ry;
|
||||
rz = _rz;
|
||||
}
|
||||
|
||||
Rpy()
|
||||
{
|
||||
rx = 0.0;
|
||||
ry = 0.0;
|
||||
rz = 0.0;
|
||||
}
|
||||
} Rpy;
|
||||
|
||||
/**
|
||||
*@brief 笛卡尔空间位姿类型
|
||||
*/
|
||||
typedef struct DescPose
|
||||
{
|
||||
DescTran tran; /* 笛卡尔空间位置 */
|
||||
Rpy rpy; /* 笛卡尔空间姿态 */
|
||||
|
||||
DescPose(double x, double y, double z, double rx, double ry, double rz)
|
||||
{
|
||||
tran.x = x;
|
||||
tran.y = y;
|
||||
tran.z = z;
|
||||
|
||||
rpy.rx = rx;
|
||||
rpy.ry = ry;
|
||||
rpy.rz = rz;
|
||||
}
|
||||
|
||||
DescPose()
|
||||
{
|
||||
tran = { 0.0, 0.0, 0.0 };
|
||||
rpy = { 0.0, 0.0, 0.0 };
|
||||
}
|
||||
} DescPose;
|
||||
|
||||
/**
|
||||
* @brief 扩展轴位置数据类型
|
||||
*/
|
||||
typedef struct ExaxisPos
|
||||
{
|
||||
double ePos[4]; /* 四个扩展轴位置,单位mm */
|
||||
|
||||
ExaxisPos(double axis1, double axis2, double axis3, double axis4)
|
||||
{
|
||||
ePos[0] = axis1;
|
||||
ePos[1] = axis2;
|
||||
ePos[2] = axis3;
|
||||
ePos[3] = axis4;
|
||||
}
|
||||
|
||||
ExaxisPos()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}ExaxisPos;
|
||||
|
||||
/**
|
||||
* @brief 力传感器的受力分量和力矩分量
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double fx; /* 沿x轴受力分量,单位N */
|
||||
double fy; /* 沿y轴受力分量,单位N */
|
||||
double fz; /* 沿z轴受力分量,单位N */
|
||||
double tx; /* 绕x轴力矩分量,单位Nm */
|
||||
double ty; /* 绕y轴力矩分量,单位Nm */
|
||||
double tz; /* 绕z轴力矩分量,单位Nm */
|
||||
} ForceTorque;
|
||||
|
||||
|
||||
/**
|
||||
* @brief 螺旋参数数据类型
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int circle_num; /* 螺旋圈数 */
|
||||
float circle_angle; /* 螺旋倾角 */
|
||||
float rad_init; /* 螺旋初始半径,单位mm */
|
||||
float rad_add; /* 半径增量 */
|
||||
float rotaxis_add; /* 转轴方向增量 */
|
||||
unsigned int rot_direction; /* 旋转方向,0-顺时针,1-逆时针 */
|
||||
int velAccMode; /* 速度加速度参数模式:0-角速度恒定;1-线速度恒定 */
|
||||
}SpiralParam;
|
||||
|
||||
typedef struct AxleComParam
|
||||
{
|
||||
int baudRate; //波特率:支持 1-9600,2-14400,3-19200,4-38400,5-56000,6-67600,7-115200,8-128000;
|
||||
int dataBit; //数据位:数据位支持(8,9),目前常用为 8
|
||||
int stopBit; //停止位:1-1,2-0.5,3-2,4-1.5,目前常用为 1
|
||||
int verify; //校验位:0-None,1-Odd,2-Even,目前常用为 0;
|
||||
int timeout; //超时时间:1~1000ms,此值需要结合外设搭配设置合理的时间参数
|
||||
int timeoutTimes; //超时次数:1~10,主要进行超时重发,减少偶发异常提高用户体验
|
||||
int period; //周期性指令时间间隔:1~1000ms,主要用于周期性指令每次下发的时间间隔
|
||||
|
||||
AxleComParam()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AxleComParam(int _baudRate, int _dataBit, int _stopBit, int _verify, int _timeout, int _timeoutTimes, int _period)
|
||||
{
|
||||
baudRate = _baudRate;
|
||||
dataBit = _dataBit;
|
||||
stopBit = _stopBit;
|
||||
verify = _verify;
|
||||
timeout = _timeout;
|
||||
timeoutTimes = _timeoutTimes;
|
||||
period = _period;
|
||||
}
|
||||
}AxleComParam;
|
||||
|
||||
/**
|
||||
* @brief 机器人时间
|
||||
*/
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct RobotTime
|
||||
{
|
||||
uint16_t year = 0;
|
||||
uint8_t mouth = 0;
|
||||
uint8_t day = 0;
|
||||
uint8_t hour = 0;
|
||||
uint8_t minute = 0;
|
||||
uint8_t second = 0;
|
||||
uint16_t millisecond = 0;
|
||||
|
||||
RobotTime()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string ToString()
|
||||
{
|
||||
std::string rtn = std::to_string(year) + "-" + std::to_string(mouth) + "-" + std::to_string(day) + " " + std::to_string(hour) + ":" + std::to_string(minute) + ":" + std::to_string(second) + "." + std::to_string(millisecond);
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
}RobotTime;
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct ROBOT_AUX_STATE
|
||||
{
|
||||
uint8_t servoId;
|
||||
int servoErrCode;
|
||||
int servoState;
|
||||
double servoPos;
|
||||
float servoVel;
|
||||
float servoTorque;
|
||||
} robot_aux_state;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct _EXT_AXIS_STATUS
|
||||
{
|
||||
double pos; //扩展轴位置
|
||||
double vel; //扩展轴速度
|
||||
int errorCode; //扩展轴故障码
|
||||
uint8_t ready; //伺服准备好 0-使能;1-未使能
|
||||
uint8_t inPos; //伺服到位
|
||||
uint8_t alarm; //伺服报警
|
||||
uint8_t flerr; //跟随误差
|
||||
uint8_t nlimit; //到负限位
|
||||
uint8_t pLimit; //到正限位
|
||||
uint8_t mdbsOffLine; //驱动器485总线掉线
|
||||
uint8_t mdbsTimeout; //控制卡与控制箱485通信超时
|
||||
uint8_t homingStatus; //扩展轴回零状态
|
||||
}EXT_AXIS_STATUS;
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct _WELDING_BREAKOFF_STATE
|
||||
{
|
||||
uint8_t breakOffState; //焊接中断状态
|
||||
uint8_t weldArcState; //焊接电弧中断状态
|
||||
}WELDING_BREAKOFF_STATE;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct _ROBOT_STATE_PKG
|
||||
{
|
||||
uint16_t frame_head; // 帧头,约定为0x5A5A
|
||||
uint8_t frame_cnt; // 帧计数,循环计数0-255
|
||||
uint16_t data_len; // 数据内容的长度
|
||||
uint8_t program_state; // 程序运行状态,1-停止;2-运行;3-暂停;
|
||||
uint8_t robot_state; // 机器人运动状态,1-停止;2-运行;3-暂停;4-拖动
|
||||
int main_code; // 主故障码
|
||||
int sub_code; // 子故障码
|
||||
uint8_t robot_mode; // 机器人模式,1-手动模式;0-自动模式;
|
||||
double jt_cur_pos[6]; // 6个轴当前关节位置,单位deg
|
||||
double tl_cur_pos[6]; // 工具当前位置
|
||||
// tl_cur_pos[0],沿x轴位置,单位mm,
|
||||
// tl_cur_pos[1],沿y轴位置,单位mm,
|
||||
// tl_cur_pos[2],沿z轴位置,单位mm,
|
||||
// tl_cur_pos[3],绕固定轴X旋转角度,单位deg
|
||||
// tl_cur_pos[4],绕固定轴y旋转角度,单位deg
|
||||
// tl_cur_pos[5],绕固定轴z旋转角度,单位deg
|
||||
double flange_cur_pos[6]; // 末端法兰当前位置
|
||||
// flange_cur_pos[0],沿x轴位置,单位mm,
|
||||
// flange_cur_pos[1],沿y轴位置,单位mm,
|
||||
// flange_cur_pos[2],沿z轴位置,单位mm,
|
||||
// flange_cur_pos[3],绕固定轴X旋转角度,单位deg
|
||||
// flange_cur_pos[4],绕固定轴y旋转角度,单位deg
|
||||
// flange_cur_pos[5],绕固定轴z旋转角度,单位deg
|
||||
double actual_qd[6]; // 当前6个关节速度,单位deg/s
|
||||
double actual_qdd[6]; // 当前6个关节加速度,单位deg/s^2
|
||||
double target_TCP_CmpSpeed[2];
|
||||
// target_TCP_CmpSpeed[0],TCP合成指令速度(位置),单位mm/s
|
||||
// target_TCP_CmpSpeed[1],TCP合成指令速度(姿态),单位deg/s */
|
||||
double target_TCP_Speed[6]; // TCP指令速度
|
||||
// target_TCP_Speed[0],沿x轴速度,单位mm/s,
|
||||
// target_TCP_Speed[1],沿y轴速度,单位mm/s,
|
||||
// target_TCP_Speed[2],沿z轴速度,单位mm/s,
|
||||
// target_TCP_Speed[3],绕固定轴X旋转角速度,单位deg/s
|
||||
// target_TCP_Speed[4],绕固定轴y旋转角速度,单位deg/s
|
||||
// target_TCP_Speed[5],绕固定轴z旋转角速度,单位deg/s */
|
||||
double actual_TCP_CmpSpeed[2];
|
||||
// actual_TCP_CmpSpeed[0],TCP合成实际速度(位置),单位mm/s
|
||||
// actual_TCP_CmpSpeed[1],TCP合成实际速度(姿态),单位deg/s
|
||||
double actual_TCP_Speed[6]; // TCP实际速度
|
||||
// actual_TCP_Speed[0],沿x轴速度,单位mm/s,
|
||||
// actual_TCP_Speed[1],沿y轴速度,单位mm/s,
|
||||
// actual_TCP_Speed[2],沿z轴速度,单位mm/s,
|
||||
// actual_TCP_Speed[3],绕固定轴X旋转角速度,单位deg/s
|
||||
// actual_TCP_Speed[4],绕固定轴y旋转角速度,单位deg/s
|
||||
// actual_TCP_Speed[5],绕固定轴z旋转角速度,单位deg/s
|
||||
double jt_cur_tor[6]; // 6个轴当前扭矩,单位N·m
|
||||
int tool; // 应用的工具坐标系编号
|
||||
int user; // 应用的工件坐标系编号
|
||||
uint8_t cl_dgt_output_h; // 控制箱数字量IO输出15-8
|
||||
uint8_t cl_dgt_output_l; // 控制箱数字量IO输出7-0
|
||||
uint8_t tl_dgt_output_l; // 工具数字量IO输出7-0,仅bit0-bit1有效
|
||||
uint8_t cl_dgt_input_h; // 控制箱数字量IO输入15-8
|
||||
uint8_t cl_dgt_input_l; // 控制箱数字量IO输入7-0
|
||||
uint8_t tl_dgt_input_l; // 工具数字量IO输入7-0,仅bit0-bit1有效
|
||||
uint16_t cl_analog_input[2]; // cl_analog_input[0],控制箱模拟量输入0
|
||||
//cl_analog_input[1],控制箱模拟量输入1
|
||||
uint16_t tl_anglog_input; // 工具模拟量输入
|
||||
double ft_sensor_raw_data[6]; // 力矩传感器原始数据
|
||||
// ft_sensor_raw_data[0],沿x轴力,单位N
|
||||
// ft_sensor_raw_data[1],沿y轴力,单位N
|
||||
// ft_sensor_raw_data[2],沿z轴力,单位N
|
||||
// ft_sensor_raw_data[3],沿x轴力矩,单位Nm
|
||||
// ft_sensor_raw_data[4],沿y轴力矩,单位Nm
|
||||
// ft_sensor_raw_data[5],沿z轴力矩,单位Nm
|
||||
double ft_sensor_data[6]; // 力矩传感器数据,
|
||||
// ft_sensor_data[0],沿x轴力,单位N
|
||||
// ft_sensor_data[1],沿y轴力,单位N
|
||||
// ft_sensor_data[2],沿z轴力,单位N
|
||||
// ft_sensor_data[3],沿x轴力矩,单位Nm
|
||||
// ft_sensor_data[4],沿y轴力矩,单位Nm
|
||||
// ft_sensor_data[5],沿z轴力矩,单位Nm
|
||||
uint8_t ft_sensor_active; // 力矩传感器激活状态,0-复位,1-激活
|
||||
uint8_t EmergencyStop; // 急停标志,0-急停未按下,1-急停按下
|
||||
int motion_done; // 运动到位信号,1-到位,0-未到位
|
||||
uint8_t gripper_motiondone; // 夹爪运动完成信号,1-完成,0-未完成
|
||||
int mc_queue_len; // 运动指令队列长度
|
||||
uint8_t collisionState; // 碰撞检测,1-碰撞,0-无碰撞
|
||||
int trajectory_pnum; // 轨迹点编号
|
||||
uint8_t safety_stop0_state; // 安全停止信号SI0
|
||||
uint8_t safety_stop1_state; // 安全停止信号SI1
|
||||
uint8_t gripper_fault_id; // 错误夹爪号
|
||||
uint16_t gripper_fault; // 夹爪故障
|
||||
uint16_t gripper_active; // 夹爪激活状态
|
||||
uint8_t gripper_position; // 夹爪位置
|
||||
int8_t gripper_speed; // 夹爪速度
|
||||
int8_t gripper_current; // 夹爪电流
|
||||
int gripper_temp; // 夹爪温度
|
||||
int gripper_voltage; // 夹爪电压
|
||||
robot_aux_state aux_state; // 485扩展轴状态
|
||||
EXT_AXIS_STATUS extAxisStatus[4]; // UDP扩展轴状态
|
||||
uint16_t extDIState[8]; // 扩展DI输入
|
||||
uint16_t extDOState[8]; // 扩展DO输出
|
||||
uint16_t extAIState[4]; // 扩展AI输入
|
||||
uint16_t extAOState[4]; // 扩展AO输出
|
||||
int rbtEnableState; // 机器人使能状态
|
||||
double jointDriverTorque[6]; //机器人关节驱动器扭矩
|
||||
double jointDriverTemperature[6]; //机器人关节驱动器温度
|
||||
RobotTime robotTime; // 机器人系统时间
|
||||
int softwareUpgradeState; // 机器人软件升级状态
|
||||
uint16_t endLuaErrCode; // 末端LUA运行状态
|
||||
uint16_t cl_analog_output[2]; // 控制箱模拟量输出
|
||||
uint16_t tl_analog_output; // 工具模拟量输出
|
||||
float gripperRotNum; // 旋转夹爪当前旋转圈数
|
||||
uint8_t gripperRotSpeed; // 旋转夹爪当前旋转速度百分比
|
||||
uint8_t gripperRotTorque; // 旋转夹爪当前旋转力矩百分比
|
||||
WELDING_BREAKOFF_STATE weldingBreakOffState; //焊接中断状态
|
||||
double jt_tgt_tor[6]; // 关节指令力矩
|
||||
int smartToolState; // SmartTool手柄按钮状态
|
||||
float wideVoltageCtrlBoxTemp; //宽电压控制箱温度
|
||||
uint16_t wideVoltageCtrlBoxFanCurrent;//宽电压控制箱风扇电流(mA)
|
||||
double toolCoord[6]; //工具坐标系
|
||||
double wobjCoord[6]; //工件坐标系
|
||||
double extoolCoord[6]; //外部工具坐标系
|
||||
double exAxisCoord[6]; //扩展轴坐标系
|
||||
double load; //负载质量
|
||||
double loadCog[3]; //负载质心
|
||||
double lastServoTarget[6]; //队列中最后一个ServoJ目标位置
|
||||
int servoJCmdNum; //servoJ指令计数
|
||||
uint16_t check_sum; // 和校验
|
||||
}ROBOT_STATE_PKG;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef ROBOTTYPES_H_
|
||||
#define ROBOTTYPES_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
|
||||
typedef int errno_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short int uint16_t;
|
||||
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
/**
|
||||
* @brief 关节位置数据类型
|
||||
*/
|
||||
typedef struct JointPos
|
||||
{
|
||||
double jPos[6]; /* 六个关节位置,单位deg */
|
||||
JointPos(double J1, double J2, double J3, double J4, double J5, double J6)
|
||||
{
|
||||
jPos[0] = J1;
|
||||
jPos[1] = J2;
|
||||
jPos[2] = J3;
|
||||
jPos[3] = J4;
|
||||
jPos[4] = J5;
|
||||
jPos[5] = J6;
|
||||
}
|
||||
|
||||
JointPos()
|
||||
{
|
||||
|
||||
}
|
||||
}JointPos;
|
||||
|
||||
/**
|
||||
* @brief 笛卡尔空间位置数据类型
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x; /* x轴坐标,单位mm */
|
||||
double y; /* y轴坐标,单位mm */
|
||||
double z; /* z轴坐标,单位mm */
|
||||
} DescTran;
|
||||
|
||||
/**
|
||||
* @brief 欧拉角姿态数据类型
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double rx; /* 绕固定轴X旋转角度,单位:deg */
|
||||
double ry; /* 绕固定轴Y旋转角度,单位:deg */
|
||||
double rz; /* 绕固定轴Z旋转角度,单位:deg */
|
||||
} Rpy;
|
||||
|
||||
/**
|
||||
*@brief 笛卡尔空间位姿类型
|
||||
*/
|
||||
typedef struct DescPose
|
||||
{
|
||||
DescTran tran; /* 笛卡尔空间位置 */
|
||||
Rpy rpy; /* 笛卡尔空间姿态 */
|
||||
|
||||
DescPose(double x, double y, double z, double rx, double ry, double rz)
|
||||
{
|
||||
tran.x = x;
|
||||
tran.y = y;
|
||||
tran.z = z;
|
||||
|
||||
rpy.rx = rx;
|
||||
rpy.ry = ry;
|
||||
rpy.rz = rz;
|
||||
}
|
||||
|
||||
DescPose()
|
||||
{
|
||||
|
||||
}
|
||||
} DescPose;
|
||||
|
||||
/**
|
||||
* @brief 扩展轴位置数据类型
|
||||
*/
|
||||
typedef struct ExaxisPos
|
||||
{
|
||||
double ePos[4]; /* 四个扩展轴位置,单位mm */
|
||||
|
||||
ExaxisPos(double axis1, double axis2, double axis3, double axis4)
|
||||
{
|
||||
ePos[0] = axis1;
|
||||
ePos[1] = axis2;
|
||||
ePos[2] = axis3;
|
||||
ePos[3] = axis4;
|
||||
}
|
||||
|
||||
ExaxisPos()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}ExaxisPos;
|
||||
|
||||
/**
|
||||
* @brief 力传感器的受力分量和力矩分量
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double fx; /* 沿x轴受力分量,单位N */
|
||||
double fy; /* 沿y轴受力分量,单位N */
|
||||
double fz; /* 沿z轴受力分量,单位N */
|
||||
double tx; /* 绕x轴力矩分量,单位Nm */
|
||||
double ty; /* 绕y轴力矩分量,单位Nm */
|
||||
double tz; /* 绕z轴力矩分量,单位Nm */
|
||||
} ForceTorque;
|
||||
|
||||
|
||||
/**
|
||||
* @brief 螺旋参数数据类型
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int circle_num; /* 螺旋圈数 */
|
||||
float circle_angle; /* 螺旋倾角 */
|
||||
float rad_init; /* 螺旋初始半径,单位mm */
|
||||
float rad_add; /* 半径增量 */
|
||||
float rotaxis_add; /* 转轴方向增量 */
|
||||
unsigned int rot_direction; /* 旋转方向,0-顺时针,1-逆时针 */
|
||||
}SpiralParam;
|
||||
|
||||
typedef struct AxleComParam
|
||||
{
|
||||
int baudRate; //波特率:支持 1-9600,2-14400,3-19200,4-38400,5-56000,6-67600,7-115200,8-128000;
|
||||
int dataBit; //数据位:数据位支持(8,9),目前常用为 8
|
||||
int stopBit; //停止位:1-1,2-0.5,3-2,4-1.5,目前常用为 1
|
||||
int verify; //校验位:0-None,1-Odd,2-Even,目前常用为 0;
|
||||
int timeout; //超时时间:1~1000ms,此值需要结合外设搭配设置合理的时间参数
|
||||
int timeoutTimes; //超时次数:1~10,主要进行超时重发,减少偶发异常提高用户体验
|
||||
int period; //周期性指令时间间隔:1~1000ms,主要用于周期性指令每次下发的时间间隔
|
||||
|
||||
AxleComParam()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AxleComParam(int _baudRate, int _dataBit, int _stopBit, int _verify, int _timeout, int _timeoutTimes, int _period)
|
||||
{
|
||||
baudRate = _baudRate;
|
||||
dataBit = _dataBit;
|
||||
stopBit = _stopBit;
|
||||
verify = _verify;
|
||||
timeout = _timeout;
|
||||
timeoutTimes = _timeoutTimes;
|
||||
period = _period;
|
||||
}
|
||||
}AxleComParam;
|
||||
|
||||
/**
|
||||
* @brief 机器人时间
|
||||
*/
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct RobotTime
|
||||
{
|
||||
uint16_t year = 0;
|
||||
uint8_t mouth = 0;
|
||||
uint8_t day = 0;
|
||||
uint8_t hour = 0;
|
||||
uint8_t minute = 0;
|
||||
uint8_t second = 0;
|
||||
uint16_t millisecond = 0;
|
||||
|
||||
RobotTime()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string ToString()
|
||||
{
|
||||
std::string rtn = std::to_string(year) + "-" + std::to_string(mouth) + "-" + std::to_string(day) + " " + std::to_string(hour) + ":" + std::to_string(minute) + ":" + std::to_string(second) + "." + std::to_string(millisecond);
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
}RobotTime;
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct ROBOT_AUX_STATE
|
||||
{
|
||||
uint8_t servoId;
|
||||
int servoErrCode;
|
||||
int servoState;
|
||||
double servoPos;
|
||||
float servoVel;
|
||||
float servoTorque;
|
||||
} robot_aux_state;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct _EXT_AXIS_STATUS
|
||||
{
|
||||
double pos; //扩展轴位置
|
||||
double vel; //扩展轴速度
|
||||
int errorCode; //扩展轴故障码
|
||||
uint8_t ready; //伺服准备好 0-使能;1-未使能
|
||||
uint8_t inPos; //伺服到位
|
||||
uint8_t alarm; //伺服报警
|
||||
uint8_t flerr; //跟随误差
|
||||
uint8_t nlimit; //到负限位
|
||||
uint8_t pLimit; //到正限位
|
||||
uint8_t mdbsOffLine; //驱动器485总线掉线
|
||||
uint8_t mdbsTimeout; //控制卡与控制箱485通信超时
|
||||
uint8_t homingStatus; //扩展轴回零状态
|
||||
}EXT_AXIS_STATUS;
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct _WELDING_BREAKOFF_STATE
|
||||
{
|
||||
uint8_t breakOffState; //焊接中断状态
|
||||
uint8_t weldArcState; //焊接电弧中断状态
|
||||
}WELDING_BREAKOFF_STATE;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct _ROBOT_STATE_PKG
|
||||
{
|
||||
uint16_t frame_head;
|
||||
uint8_t frame_cnt;
|
||||
uint16_t data_len;
|
||||
uint8_t program_state; //Program running status, 1- stop;2- Run; 3- Pause
|
||||
uint8_t robot_state;//Robot motion state, 1- stop; 2- Run; 3- Pause; 4- Drag
|
||||
int main_code;
|
||||
int sub_code;
|
||||
uint8_t robot_mode;//Robot mode, 0-automatic mode; 1- Manual mode
|
||||
double jt_cur_pos[6];//Current joint position
|
||||
double tl_cur_pos[6];//Current tool position
|
||||
double flange_cur_pos[6];//Current pose of end flange
|
||||
double actual_qd[6];//Robot current joint speed
|
||||
double actual_qdd[6];//Current joint acceleration of robot
|
||||
double target_TCP_CmpSpeed[2];//Robot TCP synthesis command speed
|
||||
double target_TCP_Speed[6]; //Robot TCP command speed
|
||||
double actual_TCP_CmpSpeed[2]; //Robot TCP synthesizes actual speed
|
||||
double actual_TCP_Speed[6];//Robot TCP actual speed
|
||||
double jt_cur_tor[6];//Current torque
|
||||
int tool;//tool number
|
||||
int user; //workpiece number
|
||||
uint8_t cl_dgt_output_h;//Digital output 15-8
|
||||
uint8_t cl_dgt_output_l;//Digital output 7-0
|
||||
uint8_t tl_dgt_output_l; //tool digital output7-0
|
||||
uint8_t cl_dgt_input_h;//Digital input 15-8
|
||||
uint8_t cl_dgt_input_l;//Digital input 7-0
|
||||
uint8_t tl_dgt_input_l;//tool Digital input 7-0
|
||||
uint16_t cl_analog_input[2];//Control box analog input
|
||||
uint16_t tl_anglog_input; //Tool analog input
|
||||
double ft_sensor_raw_data[6];//Force/torque sensor raw data
|
||||
double ft_sensor_data[6];//Force/torque sensor data
|
||||
uint8_t ft_sensor_active;//Force/torque sensor active status, 0-reset, 1-activated
|
||||
uint8_t EmergencyStop;//Emergency stop sign
|
||||
int motion_done;//Position signal
|
||||
uint8_t gripper_motiondone;//gripper movement complete signal
|
||||
int mc_queue_len; //Motion queue length
|
||||
uint8_t collisionState;//Collision detection, 1- collision; 0- No collision
|
||||
int trajectory_pnum; //Track point number
|
||||
uint8_t safety_stop0_state; /* 安全停止信号SI0 *//* Safety stop signal SI0 */
|
||||
uint8_t safety_stop1_state; /* 安全停止信号SI1 *//* Safety stop signal SI1 */
|
||||
uint8_t gripper_fault_id; /* 错误夹爪号 */ /* gripper error number */
|
||||
uint16_t gripper_fault; /* 夹爪故障 *//* Gripper fault */
|
||||
uint16_t gripper_active; /* 夹爪激活状态 *//* Gripper active status */
|
||||
uint8_t gripper_position; /* 夹爪位置 */ /* Gripper position */
|
||||
int8_t gripper_speed; /* 夹爪速度 */ /* Gripper speed */
|
||||
int8_t gripper_current; /* 夹爪电流 *//* Gripper current */
|
||||
int gripper_temp; /* 夹爪温度 *//* Gripper temperature */
|
||||
int gripper_voltage; /* 夹爪电压 *//* Gripper voltage */
|
||||
robot_aux_state aux_state;/* 485Extended axis state */
|
||||
EXT_AXIS_STATUS extAxisStatus[4]; /* UDP扩展轴状态 */
|
||||
uint16_t extDIState[8]; //扩展DI输入
|
||||
uint16_t extDOState[8]; //扩展DO输出
|
||||
uint16_t extAIState[4]; //扩展AI输入
|
||||
uint16_t extAOState[4]; //扩展AO输出
|
||||
int rbtEnableState; //机器人使能状态 robot enable state
|
||||
double jointDriverTorque[6]; //机器人关节驱动器扭矩 Robot joint drive torque
|
||||
double jointDriverTemperature[6]; //机器人关节驱动器温度 Robot joint drive temperature
|
||||
RobotTime robotTime; //机器人系统时间 Robot System time
|
||||
int softwareUpgradeState; //机器人软件升级状态 Robot Software Upgrade State
|
||||
uint16_t endLuaErrCode; //末端LUA运行状态
|
||||
uint16_t cl_analog_output[2]; //控制箱模拟量输出
|
||||
uint16_t tl_analog_output; //工具模拟量输出
|
||||
float gripperRotNum; //旋转夹爪当前旋转圈数
|
||||
uint8_t gripperRotSpeed; //旋转夹爪当前旋转速度百分比
|
||||
uint8_t gripperRotTorque; //旋转夹爪当前旋转力矩百分比
|
||||
WELDING_BREAKOFF_STATE weldingBreakOffState; //焊接中断状态
|
||||
double jt_tgt_tor[6]; //关节指令力矩
|
||||
int smartToolState; //SmartTool手柄按钮状态
|
||||
float wideVoltageCtrlBoxTemp; //宽电压控制箱温度
|
||||
uint16_t wideVoltageCtrlBoxFanCurrent; //宽电压控制箱风扇电流(mA)
|
||||
double toolCoord[6]; //工具坐标系
|
||||
double wobjCoord[6]; //工件坐标系
|
||||
double extoolCoord[6]; //外部工具坐标系
|
||||
double exAxisCoord[6]; //扩展轴坐标系
|
||||
double load; //负载质量
|
||||
double loadCog[3]; //负载质心
|
||||
uint16_t check_sum; /* 和校验 */
|
||||
}ROBOT_STATE_PKG;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,74 +1,74 @@
|
||||
#include "Utility.h"
|
||||
#include "logger.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Shlwapi.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define MAX_FILE_PATH_LENGTH 512
|
||||
|
||||
// 跨平台获取文件大小的函数
|
||||
std::streampos GetFileSize(const std::string& filePath)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Windows平台实现
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
|
||||
if (GetFileAttributesExA(filePath.c_str(), GetFileExInfoStandard, &fileInfo)) {
|
||||
LARGE_INTEGER size;
|
||||
size.HighPart = fileInfo.nFileSizeHigh;
|
||||
size.LowPart = fileInfo.nFileSizeLow;
|
||||
return size.QuadPart;
|
||||
}
|
||||
#else
|
||||
// Unix-like平台实现(Linux, macOS等)
|
||||
struct stat statResult;
|
||||
if (stat(filePath.c_str(), &statResult) == 0) {
|
||||
return statResult.st_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 如果获取失败,返回-1
|
||||
return -1;
|
||||
}
|
||||
|
||||
//从文件路径种取文件名称
|
||||
std::string GetFileNameInPath(std::string filePath)
|
||||
{
|
||||
string point_table_name;
|
||||
#ifdef WIN32
|
||||
point_table_name = PathFindFileNameA(filePath.c_str());
|
||||
#else
|
||||
point_table_name.append(basename(filePath.c_str()));
|
||||
logger_info("name is: %s.", point_table_name.c_str());
|
||||
#endif
|
||||
|
||||
return point_table_name;
|
||||
}
|
||||
|
||||
//检查本地文件是否存在
|
||||
bool CheckFileIsExist(std::string filePath)
|
||||
{
|
||||
#ifdef WIN32
|
||||
std::wstring save_path_wide(filePath.begin(), filePath.end());
|
||||
if (GetFileAttributesA(filePath.c_str()) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
char save_path[MAX_FILE_PATH_LENGTH];
|
||||
memset(save_path, 0, MAX_FILE_PATH_LENGTH);
|
||||
snprintf(save_path, MAX_FILE_PATH_LENGTH, "%s", filePath.c_str());
|
||||
if (access(save_path, F_OK) != 0)
|
||||
{
|
||||
logger_error("path %s do not exist.", save_path);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
#include "Utility.h"
|
||||
#include "logger.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Shlwapi.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define MAX_FILE_PATH_LENGTH 512
|
||||
|
||||
// 跨平台获取文件大小的函数
|
||||
std::streampos GetFileSize(const std::string& filePath)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Windows平台实现
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
|
||||
if (GetFileAttributesExA(filePath.c_str(), GetFileExInfoStandard, &fileInfo)) {
|
||||
LARGE_INTEGER size;
|
||||
size.HighPart = fileInfo.nFileSizeHigh;
|
||||
size.LowPart = fileInfo.nFileSizeLow;
|
||||
return size.QuadPart;
|
||||
}
|
||||
#else
|
||||
// Unix-like平台实现(Linux, macOS等)
|
||||
struct stat statResult;
|
||||
if (stat(filePath.c_str(), &statResult) == 0) {
|
||||
return statResult.st_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 如果获取失败,返回-1
|
||||
return -1;
|
||||
}
|
||||
|
||||
//从文件路径种取文件名称
|
||||
std::string GetFileNameInPath(std::string filePath)
|
||||
{
|
||||
string point_table_name;
|
||||
#ifdef WIN32
|
||||
point_table_name = PathFindFileNameA(filePath.c_str());
|
||||
#else
|
||||
point_table_name.append(basename(filePath.c_str()));
|
||||
logger_info("name is: %s.", point_table_name.c_str());
|
||||
#endif
|
||||
|
||||
return point_table_name;
|
||||
}
|
||||
|
||||
//检查本地文件是否存在
|
||||
bool CheckFileIsExist(std::string filePath)
|
||||
{
|
||||
#ifdef WIN32
|
||||
std::wstring save_path_wide(filePath.begin(), filePath.end());
|
||||
if (GetFileAttributesA(filePath.c_str()) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
char save_path[MAX_FILE_PATH_LENGTH];
|
||||
memset(save_path, 0, MAX_FILE_PATH_LENGTH);
|
||||
snprintf(save_path, MAX_FILE_PATH_LENGTH, "%s", filePath.c_str());
|
||||
if (access(save_path, F_OK) != 0)
|
||||
{
|
||||
logger_error("path %s do not exist.", save_path);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -44,11 +44,6 @@ FRTcpClient::FRTcpClient(string IP, int port)
|
||||
#endif
|
||||
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
#ifdef WIN32
|
||||
int syncnt = 2;
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_MAXRT, (char*)&syncnt, sizeof(syncnt)); //连接时需要将时间设置长一点,避免连接失败
|
||||
#endif
|
||||
|
||||
SetTimeOut(timeOut);
|
||||
}
|
||||
|
||||
@ -65,7 +60,6 @@ int FRTcpClient::Connect()
|
||||
if (rtn < 0)
|
||||
{
|
||||
int connectError = WSAGetLastError();
|
||||
logger_error("connect failed; socket errcode is %d", connectError);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
@ -81,10 +75,6 @@ int FRTcpClient::Connect()
|
||||
|
||||
int FRTcpClient::ReConnect()
|
||||
{
|
||||
#ifdef WIN32
|
||||
int syncnt = 1;
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_MAXRT, (char*)&syncnt, sizeof(syncnt)); //win下连接超时1s,非常准
|
||||
#endif
|
||||
reconnFlag = true;
|
||||
bool reconnectSuccess = false;
|
||||
|
||||
@ -120,7 +110,10 @@ int FRTcpClient::ReConnect()
|
||||
|
||||
int FRTcpClient::SetTimeOut(int timeout)
|
||||
{
|
||||
int syncnt = 1;
|
||||
/* 设置连接超时 */
|
||||
#ifdef WIN32
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_MAXRT, (char*)&syncnt, sizeof(syncnt)); //win下连接超时1s,非常准
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeOut, sizeof(int));
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeOut, sizeof(int));
|
||||
int bKeepAlive = TRUE;
|
||||
@ -146,8 +139,7 @@ int FRTcpClient::SetTimeOut(int timeout)
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
int syncnt = 2;
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_SYNCNT, &syncnt, sizeof(syncnt)); //这玩意不会用
|
||||
//setsockopt(fd, IPPROTO_TCP, TCP_SYNCNT, &syncnt, sizeof(syncnt)); //这玩意不会用
|
||||
struct timeval tv;
|
||||
tv.tv_sec = timeOut / 1000;
|
||||
tv.tv_usec = timeOut % 1000 * 1000;
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
#ifndef MAKEDEPEND
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
#include <stdio.h>
|
||||
#include <WS2tcpip.h>
|
||||
#include <winsock2.h>
|
||||
# include <stdio.h>
|
||||
|
||||
# include <winsock2.h>
|
||||
//# pragma lib(WS2_32.lib)
|
||||
#pragma comment(lib, "WS2_32.lib") //vincent 2023.03.22
|
||||
|
||||
@ -27,7 +27,6 @@ extern "C" {
|
||||
}
|
||||
#endif // _WINDOWS
|
||||
|
||||
|
||||
#endif // MAKEDEPEND
|
||||
|
||||
|
||||
@ -163,30 +162,11 @@ XmlRpcSocket::connect(int fd, std::string& host, int port)
|
||||
memset(&saddr, 0, sizeof(saddr));
|
||||
saddr.sin_family = AF_INET;
|
||||
|
||||
/*struct hostent *hp = gethostbyname(host.c_str());
|
||||
if (hp == 0) return false;*/
|
||||
struct addrinfo hints, * res, * p;
|
||||
int status;
|
||||
char ipstr[INET6_ADDRSTRLEN];
|
||||
struct hostent *hp = gethostbyname(host.c_str());
|
||||
if (hp == 0) return false;
|
||||
|
||||
memset(&hints, 0, sizeof hints);
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
status = getaddrinfo(host.c_str(), NULL, &hints, &res);
|
||||
if (status != 0) {
|
||||
logger_info("getaddrinfo failed %s.", host);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct sockaddr_in* ipv4 = (struct sockaddr_in*)res->ai_addr;
|
||||
|
||||
saddr.sin_family = ipv4->sin_family;
|
||||
#ifdef WIN32
|
||||
memcpy(&saddr.sin_addr, &(ipv4->sin_addr), sizeof(IN_ADDR));
|
||||
#else
|
||||
memcpy(&saddr.sin_addr, &(ipv4->sin_addr), sizeof(struct in_addr));
|
||||
#endif
|
||||
|
||||
saddr.sin_family = hp->h_addrtype;
|
||||
memcpy(&saddr.sin_addr, hp->h_addr, hp->h_length);
|
||||
saddr.sin_port = htons((u_short) port);
|
||||
|
||||
// For asynch operation, this will return EWOULDBLOCK (windows) or
|
||||
|
||||
@ -1,133 +1,133 @@
|
||||
# CalibView - 手眼标定测试工具
|
||||
QT += core gui widgets
|
||||
|
||||
CONFIG += c++17
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Windows平台UTF-8编码支持
|
||||
win32-msvc {
|
||||
QMAKE_CXXFLAGS += /utf-8
|
||||
QMAKE_CXXFLAGS += /bigobj
|
||||
}
|
||||
|
||||
TARGET = CalibView
|
||||
TEMPLATE = app
|
||||
|
||||
# 项目目录
|
||||
INCLUDEPATH += $$PWD/Inc
|
||||
INCLUDEPATH += $$PWD/../../Module/HandEyeCalib/Inc
|
||||
INCLUDEPATH += $$PWD/../../Module/HandEyeCalib/_Inc
|
||||
INCLUDEPATH += $$PWD/../../Utils/VrCommon/Inc
|
||||
INCLUDEPATH += $$PWD/../../SDK/eigen-3.3.9
|
||||
|
||||
# VrEyeView 集成
|
||||
INCLUDEPATH += $$PWD/../VrEyeView/Inc
|
||||
INCLUDEPATH += $$PWD/../../Module/ChessboardDetector/Inc
|
||||
INCLUDEPATH += $$PWD/../../Device/VrEyeDevice/Inc
|
||||
|
||||
# VzNLSDK 头文件路径
|
||||
INCLUDEPATH += $$PWD/../../SDK/Device/VzNLSDK/Inc
|
||||
|
||||
# RobotView 集成
|
||||
INCLUDEPATH += $$PWD/../RobotView
|
||||
INCLUDEPATH += $$PWD/../../Robot/FairinoWrapper
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include/Robot-CN
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include
|
||||
|
||||
# 定义静态库模式(不导入)
|
||||
DEFINES += FAIRINO_WRAPPER_LIB
|
||||
|
||||
# OpenCV 配置
|
||||
win32 {
|
||||
INCLUDEPATH += $$PWD/../../SDK/OpenCV320/include
|
||||
}
|
||||
|
||||
unix {
|
||||
INCLUDEPATH += $$PWD/../../SDK/OpenCV320/Arm/aarch64/include
|
||||
}
|
||||
|
||||
# 头文件
|
||||
HEADERS += \
|
||||
Inc/CalibViewMainWindow.h \
|
||||
Inc/CalibDataWidget.h \
|
||||
Inc/CalibResultWidget.h \
|
||||
../RobotView/MainWindow.h \
|
||||
../VrEyeView/Inc/VrEyeViewWidget.h
|
||||
|
||||
# 源文件
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
Src/CalibViewMainWindow.cpp \
|
||||
Src/CalibDataWidget.cpp \
|
||||
Src/CalibResultWidget.cpp \
|
||||
../RobotView/MainWindow.cpp \
|
||||
../VrEyeView/Src/VrEyeViewWidget.cpp
|
||||
|
||||
# 资源文件
|
||||
RESOURCES += resource/resource.qrc
|
||||
|
||||
# Windows 应用图标
|
||||
RC_ICONS = resource/logo.ico
|
||||
|
||||
# Windows平台库链接
|
||||
win32:CONFIG(release, debug|release): {
|
||||
LIBS += -L../../Module/HandEyeCalib/release -lHandEyeCalib
|
||||
LIBS += -L../../Utils/VrCommon/release -lVrCommon
|
||||
LIBS += -L../../Utils/VrUtils/release -lVrUtils
|
||||
LIBS += -L../../Utils/CloudUtils/release -lCloudUtils
|
||||
LIBS += -L$$OUT_PWD/../../Robot/FairinoWrapper/release/ -lFairinoWrapper
|
||||
LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/release/ -lfairino
|
||||
LIBS += -L$$OUT_PWD/../../Module/ChessboardDetector/release -lChessboardDetector
|
||||
LIBS += -L$$OUT_PWD/../../Device/VrEyeDevice/release -lVrEyeDevice
|
||||
LIBS += -L$$PWD/../../SDK/OpenCV320/Windows/vc14/Release -lopencv_world320
|
||||
}
|
||||
else:win32:CONFIG(debug, debug|release): {
|
||||
LIBS += -L../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
LIBS += -L../../Utils/VrCommon/debug -lVrCommon
|
||||
LIBS += -L../../Utils/VrUtils/debug -lVrUtils
|
||||
LIBS += -L../../Utils/CloudUtils/debug -lCloudUtils
|
||||
LIBS += -L$$OUT_PWD/../../Robot/FairinoWrapper/debug/ -lFairinoWrapper
|
||||
LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/debug/ -lfairino
|
||||
LIBS += -L$$OUT_PWD/../../Module/ChessboardDetector/debug -lChessboardDetectord
|
||||
LIBS += -L$$OUT_PWD/../../Device/VrEyeDevice/debug -lVrEyeDeviced
|
||||
LIBS += -L$$PWD/../../SDK/OpenCV320/Windows/vc14/Release -lopencv_world320
|
||||
}
|
||||
|
||||
# Unix平台库链接
|
||||
unix {
|
||||
LIBS += -L../../Module/HandEyeCalib -lHandEyeCalib
|
||||
LIBS += -L../../Utils/VrCommon -lVrCommon
|
||||
LIBS += -L$$OUT_PWD/../../Robot/FairinoWrapper/ -lFairinoWrapper
|
||||
LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/ -lfairino
|
||||
LIBS += -L$$OUT_PWD/../../Module/ChessboardDetector -lChessboardDetector
|
||||
LIBS += -L$$OUT_PWD/../../Device/VrEyeDevice -lVrEyeDevice
|
||||
LIBS += -L$$PWD/../../SDK/OpenCV320/Arm/aarch64
|
||||
LIBS += -lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_features2d -lopencv_imgcodecs -lopencv_highgui
|
||||
QMAKE_CXXFLAGS += -fPIC
|
||||
}
|
||||
|
||||
win32:CONFIG(release, debug|release): {
|
||||
LIBS += -L$$PWD/../../SDK/Device/VzNLSDK/Windows/x64/Release
|
||||
LIBS += -lVzKernel -lVzNLDetect -lVzNLGraphics
|
||||
}
|
||||
else:win32:CONFIG(debug, debug|release): {
|
||||
LIBS += -L$$PWD/../../SDK/Device/VzNLSDK/Windows/x64/Debug
|
||||
LIBS += -lVzKerneld -lVzNLDetectd -lVzNLGraphicsd
|
||||
}
|
||||
else:unix:!macx: {
|
||||
LIBS += -L$$PWD/../../SDK/Device/VzNLSDK/Arm/aarch64
|
||||
LIBS += -lVzEyeSecurityLoader-shared -lVzKernel -lVzNLDetect -lVzNLGraphics
|
||||
}
|
||||
|
||||
# Windows系统库
|
||||
win32 {
|
||||
LIBS += -lAdvapi32
|
||||
LIBS += -lws2_32
|
||||
}
|
||||
|
||||
DEFINES += _USE_MATH_DEFINES
|
||||
|
||||
# Default rules for deployment
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
# CalibView - 手眼标定测试工具
|
||||
QT += core gui widgets
|
||||
|
||||
CONFIG += c++17 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Windows平台UTF-8编码支持
|
||||
win32-msvc {
|
||||
QMAKE_CXXFLAGS += /utf-8
|
||||
QMAKE_CXXFLAGS += /bigobj
|
||||
}
|
||||
|
||||
TARGET = CalibView
|
||||
TEMPLATE = app
|
||||
|
||||
# 项目目录
|
||||
INCLUDEPATH += $$PWD/Inc
|
||||
INCLUDEPATH += $$PWD/../../Module/HandEyeCalib/Inc
|
||||
INCLUDEPATH += $$PWD/../../Module/HandEyeCalib/_Inc
|
||||
INCLUDEPATH += $$PWD/../../Utils/VrCommon/Inc
|
||||
INCLUDEPATH += $$PWD/../../SDK/eigen-3.3.9
|
||||
|
||||
# VrEyeView 集成
|
||||
INCLUDEPATH += $$PWD/../VrEyeView/Inc
|
||||
INCLUDEPATH += $$PWD/../../Module/ChessboardDetector/Inc
|
||||
INCLUDEPATH += $$PWD/../../Device/VrEyeDevice/Inc
|
||||
|
||||
# VzNLSDK 头文件路径
|
||||
INCLUDEPATH += $$PWD/../../SDK/Device/VzNLSDK/Inc
|
||||
|
||||
# RobotView 集成
|
||||
INCLUDEPATH += $$PWD/../RobotView
|
||||
INCLUDEPATH += $$PWD/../../Robot/FairinoWrapper
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include/Robot-CN
|
||||
INCLUDEPATH += $$PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/src/include
|
||||
|
||||
# 定义静态库模式(不导入)
|
||||
DEFINES += FAIRINO_WRAPPER_LIB
|
||||
|
||||
# OpenCV 配置
|
||||
win32 {
|
||||
INCLUDEPATH += $$PWD/../../SDK/OpenCV320/include
|
||||
}
|
||||
|
||||
unix {
|
||||
INCLUDEPATH += $$PWD/../../SDK/OpenCV320/Arm/aarch64/include
|
||||
}
|
||||
|
||||
# 头文件
|
||||
HEADERS += \
|
||||
Inc/CalibViewMainWindow.h \
|
||||
Inc/CalibDataWidget.h \
|
||||
Inc/CalibResultWidget.h \
|
||||
../RobotView/MainWindow.h \
|
||||
../VrEyeView/Inc/VrEyeViewWidget.h
|
||||
|
||||
# 源文件
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
Src/CalibViewMainWindow.cpp \
|
||||
Src/CalibDataWidget.cpp \
|
||||
Src/CalibResultWidget.cpp \
|
||||
../RobotView/MainWindow.cpp \
|
||||
../VrEyeView/Src/VrEyeViewWidget.cpp
|
||||
|
||||
# 资源文件
|
||||
RESOURCES += resource/resource.qrc
|
||||
|
||||
# Windows 应用图标
|
||||
RC_ICONS = resource/logo.ico
|
||||
|
||||
# Windows平台库链接
|
||||
win32:CONFIG(release, debug|release): {
|
||||
LIBS += -L../../Module/HandEyeCalib/release -lHandEyeCalib
|
||||
LIBS += -L../../Utils/VrCommon/release -lVrCommon
|
||||
LIBS += -L../../Utils/VrUtils/release -lVrUtils
|
||||
LIBS += -L../../Utils/CloudUtils/release -lCloudUtils
|
||||
LIBS += -L$$OUT_PWD/../../Robot/FairinoWrapper/release/ -lFairinoWrapper
|
||||
LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/release/ -lfairino
|
||||
LIBS += -L$$OUT_PWD/../../Module/ChessboardDetector/release -lChessboardDetector
|
||||
LIBS += -L$$OUT_PWD/../../Device/VrEyeDevice/release -lVrEyeDevice
|
||||
LIBS += -L$$PWD/../../SDK/OpenCV320/Windows/vc14/Release -lopencv_world320
|
||||
}
|
||||
else:win32:CONFIG(debug, debug|release): {
|
||||
LIBS += -L../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
LIBS += -L../../Utils/VrCommon/debug -lVrCommon
|
||||
LIBS += -L../../Utils/VrUtils/debug -lVrUtils
|
||||
LIBS += -L../../Utils/CloudUtils/debug -lCloudUtils
|
||||
LIBS += -L$$OUT_PWD/../../Robot/FairinoWrapper/debug/ -lFairinoWrapper
|
||||
LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/debug/ -lfairino
|
||||
LIBS += -L$$OUT_PWD/../../Module/ChessboardDetector/debug -lChessboardDetectord
|
||||
LIBS += -L$$OUT_PWD/../../Device/VrEyeDevice/debug -lVrEyeDeviced
|
||||
LIBS += -L$$PWD/../../SDK/OpenCV320/Windows/vc14/Release -lopencv_world320
|
||||
}
|
||||
|
||||
# Unix平台库链接
|
||||
unix {
|
||||
LIBS += -L../../Module/HandEyeCalib -lHandEyeCalib
|
||||
LIBS += -L../../Utils/VrCommon -lVrCommon
|
||||
LIBS += -L$$OUT_PWD/../../Robot/FairinoWrapper/ -lFairinoWrapper
|
||||
LIBS += -L$$OUT_PWD/../../SDK/Robot/fairino-cpp-sdk/libfairino/ -lfairino
|
||||
LIBS += -L$$OUT_PWD/../../Module/ChessboardDetector -lChessboardDetector
|
||||
LIBS += -L$$OUT_PWD/../../Device/VrEyeDevice -lVrEyeDevice
|
||||
LIBS += -L$$PWD/../../SDK/OpenCV320/Arm/aarch64
|
||||
LIBS += -lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_features2d -lopencv_imgcodecs -lopencv_highgui
|
||||
QMAKE_CXXFLAGS += -fPIC
|
||||
}
|
||||
|
||||
win32:CONFIG(release, debug|release): {
|
||||
LIBS += -L$$PWD/../../SDK/Device/VzNLSDK/Windows/x64/Release
|
||||
LIBS += -lVzKernel -lVzNLDetect -lVzNLGraphics
|
||||
}
|
||||
else:win32:CONFIG(debug, debug|release): {
|
||||
LIBS += -L$$PWD/../../SDK/Device/VzNLSDK/Windows/x64/Debug
|
||||
LIBS += -lVzKerneld -lVzNLDetectd -lVzNLGraphicsd
|
||||
}
|
||||
else:unix:!macx: {
|
||||
LIBS += -L$$PWD/../../SDK/Device/VzNLSDK/Arm/aarch64
|
||||
LIBS += -lVzEyeSecurityLoader-shared -lVzKernel -lVzNLDetect -lVzNLGraphics
|
||||
}
|
||||
|
||||
# Windows系统库
|
||||
win32 {
|
||||
LIBS += -lAdvapi32
|
||||
LIBS += -lws2_32
|
||||
}
|
||||
|
||||
DEFINES += _USE_MATH_DEFINES
|
||||
|
||||
# Default rules for deployment
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user