Robot Logging¶
The KinematicsLogInput class is available to support the WMX3 Log API.
You can log the Command and Feedback values of toolPose.
Through the example below, you can see how to get the toolPose Command value of a PTP motion.
double testJointAngle1[] = {
0,
0,
0,
50,
0,
0
};
wmx3Api::kinematics::PTPParam ptpParamEx = wmx3Api::PtpMotionParam::PtpPosParam(mz07lf.robotMotionParam.robotParam, mz07lf.robotMotionParam.profile, testJointAngle1).EnableTriggeredOverride(false);
wmx3Api::kinematics::KinematicsLogInput testKinematicsLogInput;
wmx3Api::LogChannelOptions config;
wmx3Api::LogFilePathA path;
wmx3Api::Log logapi(&core.wmx_lib);
int log_channel = 1;
int errCode = 0;
int robotId = this->robotMotionParam.robotParam.robotId;
//config initialize
{
config.maxLogFileSize = 0;
config.maxLogFileCount = 0;
config.samplingTimeMilliseconds = 5000; // 5sec
config.isRotateFile = false;
config.stopLoggingOnBufferOverflow = true;
config.samplingPeriodInCycles = 1;
config.precision = 9;
config.isDelimInLastCol = true;
strcpy(config.delimiter,"\t");
config.triggerOnCondition = 0;
config.triggerOnEvent = 0;
config.triggerEventID = 0;
}
strcpy(path.dirPath, "C:\\RobotLogs\\");
CreateDirectoryA("C:\\RobotLogs\\", NULL);
strcpy(path.fileName, "TestLog.txt");
testKinematicsLogInput.add(robotId, kinematics::KinematicsLogInput::ToolPoseCommand);
errCode = logapi.ResetLog(log_channel);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = logapi.SetLogOption(log_channel, &config);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = logapi.SetLog(log_channel, &testKinematicsLogInput);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = logapi.SetLogFilePath(log_channel, &path);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = logapi.StartLog(log_channel);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = this->robot.mKinematics.StartPTPPos(ptpParamEx);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = this->robot.mKinematics.Wait(robotId);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}
errCode = logapi.StopLog(log_channel);
if (errCode != wmx3Api::ErrorCode::None) {
// Handle exception cases here
}