Page 177 - Welding Robots Technology, System Issues, and Applications
P. 177

Read actual robot position/orientation:  Robotic Welding: Application Examples  165
                               pcrob.ReadCurrRobTarget(result, channel);

                           where result is again a data structure of the appropriate type to hold a robtarget
                           position/orientation structure [9][10].

                           The process of accessing information from the robot controller and from the loaded
                           program modules is thus very simple, namely because the necessary data structures
                           are available  from the above-mentioned  software component. For example, the
                           code associated with the  software  button “Read RobT” of the application
                           “WeldPanel” (Figure 5.7) is represented in Figure 5.13.

                                                CString msg;
                                                float value = 9301;

                                                nresult = m_pon.WriteNum(LPCTSTR("decision1"),&value);
                                                msg.Format("Error: %d",nresult);
                                                if (nresult != 0) AfxMessageBox(msg);

                                                CString msg;
                                                float value = 9401;

                                                nresult = m_pon.WriteNum(LPCTSTR("decision1"),&value);
                                                msg.Format("Error: %d",nresult);
                                                if (nresult != 0) AfxMessageBox(msg);
                                                startweld=1;
                                                Sleep(100);
                                                nresult = m_pon.ReadNum(LPCTSTR("weldpoint"),&value);
                                                msg.Format("Error: %d",nresult);

                                                CString msg;
                                                float value = 123;

                                                nresult = m_pon.WriteNum(LPCTSTR("decision1"),&value);
                                                msg.Format("Error: %d",nresult);
                                                if (nresult != 0) AfxMessageBox(msg);
                                                startweld=0;

                               Figure 5.14. Code associated with some functions of the “WeldPanel” application

                           Figure 5.14 shows  the code  associated with  the software  buttons  “Start
                           Simulation”, “Start” and “Stop” of the software “WeldPanel” tool. Furthermore,
                           Figure 5.15 shows the code associated with the robot jogging capabilities of the
                           software tool “WeldAdjust”.
   172   173   174   175   176   177   178   179   180   181   182