Tutorial 4-2: Set coordinates
The axis coordinates can also be changed manually using the SetCommandPos or SetFeedbackPos function. These functions, like homing, will change the axis coordinates.
Using these functions, a manual homing routine can be executed. For example, the SetHardwareTouchProbe function can be used to detect a touch probe position, and the SetCommandPos function can be used to set the home position to the touch probe position.
When homing the axis this way, the Home Done signal should also be manually set after homing is completed. To do so, use the SetHomeDone function. If the Home Done signal is not set, some functions that require homing to have completed will not work.
The following code sets the command position of the axis to 0, setting the home position of the axis to the current command position of the axis. The Home Done signal is also set.
//Set home position to current command position of axis
err = wmxlib_cm.home->SetCommandPos(0, 0);
if (err != ErrorCode::None) {
wmxlib_cm.ErrorToString(err, errString, sizeof(errString));
printf("Failed to set command position. Error=%d (%s)\n", err, errString);
goto exit;
}
//Set the home done status
err = wmxlib_cm.home->SetHomeDone(0, 1);
if (err != ErrorCode::None) {
wmxlib_cm.ErrorToString(err, errString, sizeof(errString));
printf("Failed to set home done status. Error=%d (%s)\n", err, errString);
goto exit;
}