Page 176 - Welding Robots Technology, System Issues, and Applications
P. 176
Read from a position/orientation variable “position”:
164 Welding Robots
pcrob.ReadRobTarget(“position”, result, channel);
where result is a data structure of the appropriate type to hold a robtarget
position/orientation structure [9][10].
Read actual robot position and orientation
Associated Code m_pon.ReadCurrRobT(&var,&wobj,&tobj);
psa = var.parray;
SafeArrayUnlock(psa); Read current
position/orientation
for (i=0;i<=16;i++)
{
SafeArrayGetElement(psa,&i,&var1.fltVal);
warn[i] = var1.fltVal; Represent obtained
} data.
msg.Format("%.3f",warn[0]); m_x.SetWindowText(msg);
msg.Format("%.3f",warn[1]); m_y.SetWindowText(msg);
msg.Format("%.3f",warn[2]); m_z.SetWindowText(msg);
msg.Format("%.5f",warn[3]); m_q1.SetWindowText(msg);
msg.Format("%.5f",warn[4]); m_q2.SetWindowText(msg);
msg.Format("%.5f",warn[5]); m_q3.SetWindowText(msg);
msg.Format("%.5f",warn[6]); m_q4.SetWindowText(msg);
msg.Format("%.0f",warn[7]); m_cf1.SetWindowText(msg);
msg.Format("%.0f",warn[8]); m_cf4.SetWindowText(msg);
msg.Format("%.0f",warn[9]); m_cf6.SetWindowText(msg);
msg.Format("%.0f",warn[10]); m_cfx.SetWindowText(msg);
msg.Format("%.0f",warn[11]); m_exa.SetWindowText(msg);
msg.Format("%.0f",warn[12]); m_exb.SetWindowText(msg);
msg.Format("%.0f",warn[13]); m_exc.SetWindowText(msg);
msg.Format("%.0f",warn[14]); m_exd.SetWindowText(msg);
msg.Format("%.0f",warn[15]); m_exe.SetWindowText(msg);
msg.Format("%.0f",warn[16]); m_exf.SetWindowText(msg);
SafeArrayDestroy(psa); VariantClear(&var); VariantClear(&var1);
Figure 5.13. Code associated with the function Read Actual Position/Orientation