This interface contains functions for reading information about a specific control group.
Name | Description |
---|---|
ReadPositionData | Read the current position data for a control group. |
ReadAxisConfiguration | Read the current axis configuration for the specified control group. |
ReadPositionError | Read Robot servo error data. |
ReadTorqueData | Read the current torque data for a control group. |
Retrieves the current position data for the specified control group.
If using a controller generation before YRC1000, the only allowed coordinate type will be pulse and base.
In addition, the base position returned will be in relation to the active tool.
StatusInfo ReadPositionData(ControlGroupId controlGroupId, CoordinateType coordinateType, UINT8 userFrameNumber, UINT8 toolNumber, PositionData& robotPositionData)
controlGroupId
[In] The control group to read position data from. See ControlGroupId.
coordinateType
[In] Specifies the coordinate type for position data to be reflected as. When CoordinateType::Pulse is selected,
the data returned will be reflected in pulse counts. Otherwise, the position data will be reflected as cartesian
coordinates. See CoordinateType.
userFrameNumber
[In] User frame number of the Position Data requested. Set to 0 if coordinateType is anything but UserCoordinate.
toolNumber
[In] Tool number of the Position Data requested.
robotPositionData
[Out] Contains the current position data. See PositionData.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
PositionData positionData{};
status = c->ControlGroup->ReadPositionData(ControlGroupId::R1, CoordinateType::Pulse, 0, 0, positionData);
cout << status << endl;
cout << positionData << endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Coordinate Type: Pulse
Tool Number: 0
Axes:
Axis S : 112809 pulses.
Axis L : -49105 pulses.
Axis U : -49999 pulses.
Axis R : 1942 pulses.
Axis B : -90217 pulses.
Axis T : 2766 pulses.
Axis E : 0 pulses.
Axis W : 0 pulses.
Reads the current axis configuration for the specified control group.
A robot (Rx) control group will return the names of the axes, such as SLURBT
. A station (Sx) or base (Bx) control group will return the number of the axis.
For example, an Sx control group will return 1
for the first axis, 2
for the second axis, etc.
StatusInfo ReadAxisConfiguration(ControlGroupId controlGroupId, AxisConfigurationData& axisConfigData)
controlGroupId
[In] The control group for which to read axis configuration. See ControlGroupId.
axisConfigData
[Out] Contains the current axis configuration. See AxisConfigurationData.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
AxisConfigurationData axisData{};
c->ControlGroup->ReadAxisConfiguration(ControlGroupId::R1, axisData);
std::cout << status << std::endl;
for (auto& axis : axisData)
{
std::cout << axis << std::endl;
}
YMConnect::CloseConnection(c);
Output
Code (0): OK
S
L
U
R
B
T
Robot servo error data. This is the pulse count between the current position and the target position.
StatusInfo ReadPositionError(ControlGroupId controlGroupId, PositionErrorData& positionErrorData)
controlGroupId
[In] The control group for which to read position error data. See ControlGroupId.
positionErrorData
[Out] Contains the current position error data. See PositionErrorData.
0 if successful, otherwise a StatusInfo object with a description of error.
This example was done while a six axis robot was moving about the -S axis.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
PositionErrorData positionErrorData{};
status = c->ControlGroup->ReadPositionError(ControlGroupId::R1, positionErrorData);
std::cout << status << std::endl;
std::cout << positionErrorData << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Code (0): OK
Axis 0 : -41
Axis 1 : 0
Axis 2 : 0
Axis 3 : 0
Axis 4 : 0
Axis 5 : 0
Axis 6 : 0
Reads the current torque data for a control group.
StatusInfo ReadTorqueData(ControlGroupId controlGroupId, TorqueData& torqueData)
controlGroupId
[In] The control group for which to read torque data. See ControlGroupId.
torqueData
[Out] Contains the current torque data expressed as a percentage. See TorqueData.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("
TorqueData torqueData{};
status = c->ControlGroup->ReadTorqueData(ControlGroupId::R1, torqueData);
std::cout << status << std::endl;
std::cout << torqueData << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Control Group Id: R1
Axis 0 : 11
Axis 1 : 16
Axis 2 : 24
Axis 3 : -2
Axis 4 : 1
Axis 5 : -8
Axis 6 : 0