Showing results for 
Search instead for 
Do you mean 
Reply

The problems in the RCS and OLP communication

Dear Expert,

 

        We are software engineers to design RCS Module,RCS Shell and OLP to fit our own robot, but when we debug with RCS Module,RCS Shell and OLP in Proceess Simualtion 13.0(PS 13.0) and RobotExpert 13.0(RE 13.0), we encountered some problems and very confused.

1) We integrated the motion PTP algorithm library what we designed with RCS Module in RobotExpert 13.0, the OLP sends the correct initial joint values and target values what we set in Path Editor, the RCS Module receives the initial joint values and target joint values by the SET_INITIAL_POSITION and SET_NEXT_TARGET services, and the RCS Module returns status 0(successfully).

      But when the OLP calls the service GET_NEXT_STEP first, the RCS Module calls the motion PTP algorithm library, returns the interpolated point values(joint values) and successful status, then the RCS Module is waiting for the OLP sends #GetCurrentTargetLocation command to call the service GET_NEXT_STEP repeatedly before reached the target, but OLP doesn’t send this command to call the service GET_NEXT_STEP again and call only one time, then the robot doesn't move and the software RobotExpert 13.0 stops work and crashed, here is the log information and software crashed picture as picture1.

2)We want to ask two questions: what is the whole process of the simulation exactly?  How to control the OLP sends the services command to the RCS Module?

3)Is the service GET_RCS_DATA necessary for every single simulation process? 

109 REPLIES

Re: The problems in the RCS and OLP communication

Try to return a non zero elapsed time:

[CDebugInOut::Func_Out_GET_NEXT_STEP] ElapseTime:         0 	

Also in your log, returned status seems to be 1, not 0.

CDebugInOut::Func_Out_GET_NEXT_STEP] STATUS:          1 	

 

GET_RCS_DATA is not a mandatory service to implement.

Re: The problems in the RCS and OLP communication

Dear expert,

        Thanks for your reply.

         I have tested your suggestions in RobotExpert 13.0 , but  not work, OLP doesn’t send this command to call the service GET_NEXT_STEP again and call only one time, then the robot doesn't move and the software RobotExpert 13.0 stops work and crashed as before.

        Are there any other possible reasons? Could you give me a version of RCS Module which is worked by OLP?

Re: The problems in the RCS and OLP communication

I am sorry, we do not have any RCS code to share as they are all Robot Vendor properties.

Re: The problems in the RCS and OLP communication

Dear expert,

        I have set the status is 0 and elapse time is not zero, but not work and same as before.

        The software RobotExpert is crashed in rrs.dll which located in /Technomatix 13.0/eMPower.

        Could you help me to solve this problem?

        Thanks very much!

        

Re: The problems in the RCS and OLP communication

Maybe someone from Core R&D can check it. I suspect GET_NEXT_STEP output buffer not being filled properly causing rrs.dll to crash.

 

Can you use following code to double check the contents of the output buffer sent to Process Simulate / Robot Expert?

 

#define RCSFR_OUTOFF_SRVC_DATA    (8)
#define RCSFR_INT_SZ       (4)
#define RCSFR_BITSTR_SZ    (4)
#define RCSFR_REAL_SZ      (8)
#define RCSFR_FRAME_ELE_CT (12)
#define RCSFR_CARTPOS_BITS    (0)
#define RCSFR_CARTPOS_FRAME   (4)

#define RCSFR_FRAME_SZ     (RCSFR_FRAME_ELE_CT * RCSFR_REAL_SZ)
#define RCSFR_CARTPOS_SZ   (RCSFR_BITSTR_SZ + RCSFR_FRAME_SZ)
#define RCSFR_JT_ELE_CT    (32)
#define RCSFR_JTPOS_SZ      \
      (RCSFR_INT_SZ + RCSFR_BITSTR_SZ + (RCSFR_JT_ELE_CT * RCSFR_REAL_SZ))


#define RCSFR_GNS_CARTPOS       (RCSFR_OUTOFF_SRVC_DATA)
#define RCSFR_GNS_JTPOS         (RCSFR_GNS_CARTPOS + RCSFR_CARTPOS_SZ)
#define RCSFR_GNS_CONFIG        (RCSFR_GNS_JTPOS + RCSFR_JTPOS_SZ)
#define RCSFR_GNS_ELAPSED_TIME  (RCSFR_GNS_CONFIG + RCSFR_INT_SZ)
#define RCSFR_GNS_JT_LIMIT      (RCSFR_GNS_ELAPSED_TIME + RCSFR_REAL_SZ)
#define RCSFR_GNS_EVENT_COUNT   (RCSFR_GNS_JT_LIMIT + RCSFR_BITSTR_SZ)
#define RCSFR_GNS_MSG_COUNT     (RCSFR_GNS_EVENT_COUNT + RCSFR_INT_SZ)
#define RCSFR_GNS_STR_OUT       (RCSFR_GNS_MSG_COUNT + RCSFR_INT_SZ)

dashes[58] =  "-----------------------------------------------------\0", 

double rrs_get_double(char *buffer)
{
   char   *p;
   double temp;
   
   temp = 0.0;
   p = (char*) &temp;
   
   p[0] = buffer[0];
   p[1] = buffer[1];
   p[2] = buffer[2];
   p[3] = buffer[3];
   p[4] = buffer[4];
   p[5] = buffer[5];
   p[6] = buffer[6];
   p[7] = buffer[7];
   
   return temp;
}

int build_next_step_status_string(int type, char *string)
{
   switch (type) {
      case 0: strcpy(string,"0 - DATA GOOD, NO NEW DATA NEEDED\0");break;
      case 1: strcpy(string,"1 - NEW DATA NEEDED\0"); break;
      case 2: strcpy(string,"2 - MOTION COMPLETED\0"); break;
	
      case -13:
      case -25:
      case -42:
      case -68:
      case -76:
	 sprintf( string, "Error: = %d", type);
	 break;
	 
      default:
	 puts(poundsigns);
	 printf("Error: Unrecognized next step status string = %d\n",type);
	 puts(poundsigns);
	 puts("\n");
	 return(0);
      }
	     
   return(1);
}

static int print_flag(char *buf, int start)
{
   int *val = (int *)(buf+start);
   sprintf(buffer3, "  FLAG 0x%x", (*val));
   write_message(buffer3);

   return (*val);
}

void print_pose(void *buf, int start, int flag)
{
   int		i, numAxes;
   double	d;
   
   numAxes = 6;
   
   for (i=0; i<numAxes; ++i)    {
      if((flag & (1<<i)) > 0) {
	 d = rrs_get_double(((char*)buf)+start+8*i);
	    d = rad_deg(d);
	 }
	 sprintf(buffer3,"    J%d:	       %.4f\0",i+1,d);
	 write_message(buffer3);
      }
   }
}

static void print_string(void *buf, int start, char *title)
{
   int *stringSize = (int *)((char *)buf + start);
   char *str = (char *)((char *)buf + (*stringSize));

   sprintf(buffer3, "  %s : %s\0", title, str);
   write_message(buffer3);   
}

void print_cart_pose(void *buf, int start)
{
   int		i;
   double	d[12];
   char         line[256];

   for ( i = 0; i < 12; ++i ) {
      d[i] = rrs_get_double( ((char*)buf) + start + sizeof(double)*i );
   }
   sprintf( line, "     %7.1f  %7.1f %7.1f  %7.1f ",
	    d[0], d[3], d[6], d[9] );
   write_message( line );
   sprintf( line, "     %7.1f  %7.1f %7.1f  %7.1f ",
	    d[1], d[4], d[7], d[10] );
   write_message( line );
   sprintf( line, "     %7.1f  %7.1f %7.1f  %7.1f ",
	    d[2], d[5], d[8], d[11] );
   write_message( line );
   
   return;

}
static void dbg118_output(char *out)
{
   double	t = rrs_get_double(((char*)out)+376);
   int *limitFlag = (int *)(out + RCSFR_GNS_JT_LIMIT);
   int flag = 0;

   write_message("118 RJ3 REQUEST NEXT STEP is returned with:\0" );
			    
     build_next_step_status_string(((int*)(out))[1],buffer1);
      
      sprintf(buffer3,"    STATUS:       %s\0",buffer1);
      write_message(buffer3);
      
      sprintf(buffer3,"    ELAPSED TIME: %.2f0",
	      t);
      write_message(buffer3);
			       
      sprintf(buffer3,"    NUM EVENTS:   %d\0",((int*)(out))[97]);
      write_message(buffer3);
      
      sprintf(buffer3,"    NUM MESSAGES: %d\0",((int*)(out))[98]);
      write_message(buffer3);

      write_message(dashes);
      flag = print_flag(out, RCSFR_GNS_CARTPOS+RCSFR_CARTPOS_BITS);

      if(flag > 0)
	 print_cart_pose(out, RCSFR_GNS_CARTPOS+RCSFR_CARTPOS_FRAME);
      flag = print_flag(out,112);
      print_pose(out,116, flag);
      print_string(out, RCSFR_GNS_CONFIG, "CONFIG");
      sprintf(buffer1, "  JOINT LIMITS 0x%x\0", *limitFlag);
      write_message(buffer1);
  			       
      write_message(dashes);
      }
   }
   
}

 

Re: The problems in the RCS and OLP communication

Dear expert,

        Thanks very much for your help, because of your codes what you given, the OLP called the RCS Module constantly before reach the target and the robot is moving successfully. But I also some problems which makes me confused.

        1)How does the RCS Module get the DH paramters of the robot? Does the OLP reads the DH paramters of the robot model in the PS 13.0 automatically, then passes to the RCS Module? Or is there any other way to RCS Module obtains the DH parameters from the robot model?

         2)According to our demand, how to automatically call service what we need , such as setting up the acceleration and velocity, etc?

         Thanks very much and waiting for your reply.

Re: The problems in the RCS and OLP communication

1) The RCS module should guess/read the DH parameters from the "ManipulatorType" entry of the INITIALIZE call and/or RCS machine data file (own RCS format) in the folder mentioned as "RobotPathName" of the INITIALIZE call.

    In most OLP Controller/Robot Setup, we have a UI to load machine data. This facility helps the user select files from the real robot and copy them into this "RobotPathName" folder for the RCS to read the DH parameters and other parameters (that are also required by the real controller).

 

 2) In your OLP Controller, you can use RrsSim\<Controller>MotionParamsHandler.SetRrsMotionParams to retrieve the motion parameters from the location and send it to the RCS via m_app.RrsEngineServices

Re: The problems in the RCS and OLP communication

[ Edited ]

Dear Expert,

         Thanks very much for your help and we slove many problems.

          Nowadays, we want to realiaze the download function. In kuka RCS Moule and OLP, they can download two files:  .src file and .dat file, but we only have a .tpl  template file, only to download one file(.tpl).

         I want to consult you: how to implement the function of downloading two files in the OLP code, just like the format of attach files? Could you give me a demo code(sample code) in OLP(C#)?

        Thank you.

Re: The problems in the RCS and OLP communication

In Robot Setup, Template Selection / Edition, you need to call the OlpUtil functionality with 2 file extensions:

 

       protected void ProgramTemplateEditionClickCb(object sender, System.EventArgs e)
        {
            Regex regexTplFilter = new Regex(@"\.tdat|\.tsrc$", RegexOptions.IgnoreCase);;
            string tplFilter = "Templates (*.tdat;*.tsrc)|*.tdat;*.tsrc";

            // open dialog
            CUiOlpUtilProgramTemplatesEditor dlg = new CUiOlpUtilProgramTemplatesEditor(m_app, regexTplFilter, tplFilter);
            dlg.ShowDialog();
        }

       protected void ProgramTemplateSelectionClickCb(object sender, System.EventArgs e)
        {
            // build template info
            CUiOlpUtilProgramTemplatesSelector.tOlpUtilTemplateInfo[] tplInfo = CUiOlpUtilProgramTemplatesSelector.tOlpUtilTemplateInfo.InitNewArray(2);
            tplInfo[0].Name = "Template source      .tsrc";
            tplInfo[0].RegexFilter = new Regex(@"\.tsrc$", RegexOptions.IgnoreCase);;

            tplInfo[1].Name = "Template local data  .tdat";
            tplInfo[1].RegexFilter = new Regex(@"\.tdat$", RegexOptions.IgnoreCase);

            // open dialog
            CUiOlpUtilProgramTemplatesSelector dlg = new CUiOlpUtilProgramTemplatesSelector(m_app, tplInfo);
            dlg.ShowDialog();
        }

Then at download, you should create 2 file writer classes, one per extension.

And in <Ctrl>Download.DownloadLocationInformation, you should pass the location to each writers which will write relevant information for the location (motion instruction in src, location coordinates in dat).