Need Help! Kflop pos command


Results 1 to 3 of 3

Thread: Kflop pos command

  1. #1
    Registered cowleym's Avatar
    Join Date
    Oct 2007
    Location
    UK
    Posts
    64
    Downloads
    0
    Uploads
    0

    Default Kflop pos command

    Hi

    Using labview I have managed to communicate with the kflop card and created 3 axis coordinated motion. This is a good result in a short period of time, so far I am very impressed with the capabilities of the kflop.

    I wish to plot the axis position but I am struggling with the Pos0 command.

    The card does not give a value for the Pos0 request and it remains at zero, the Dest0 command seems to work fine.
    ( No response from Pos1 either)
    I am using labview and have modified the example included with the installation files.

    Any ideas where I am going wrong?

    Many thanks

    Mike

    Similar Threads:


  2. #2
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3021
    Downloads
    0
    Uploads
    0

    Default Re: Kflop pos command

    Hi Mike,

    The card does not give a value for the Pos0 request and it remains at zero, the Dest0 command seems to work fine.
    ( No response from Pos1 either)
    Your system is likely an open loop system that moves blindly with no position feedback. So the measured "Position" is not used at all in your system. All KFLOP knows is the last commanded destination. If you were to add encoder feedback to your system then the Position value would be meaningful.

    I wish to plot the axis position but I am struggling with the Pos0 command.
    Polling positions or destinations vs time from the PC/Labview will work but be restricted to the whims of the PC/Windows/USB. This means that you may occasionally miss as much as a second or more of data capture.

    A better approach is to use a KFLOP C Program to capture the data into its memory, and then later upload the data to the PC. This method guarantees real-time deterministic data capture (exact 180us increments or multiples thereof). There are some simple examples such as CaptureXYZMotionToFile.c (shown below) that will capture data then upload it to a PC Disk file that you might then plot with Labview.

    KFLOP C Programs can be easily invoked by the PC using the .NET interface as shown in the Labview example. Basically one function call to Compile/Download the C Program and another to tell it to Execute.

    Code:
    #include "KMotionDef.h"
    
    #define N 10000
    
    extern double CS0_TimeExecuted;
    
    main()
    {
        int i,k;
        double X0,Y0,Z0,T0,*p=gather_buffer;
    
        CS0_TimeExecuted=0.0;	
        while (CS0_TimeExecuted==0.0) ;	// wait till we Start
    
        *p++ = 0.0;
        X0 = *p++ = ch0->Dest;
        Y0 = *p++ = ch1->Dest;
        Z0 = *p++ = ch2->Dest;
        
        T0 = Time_sec();
    
        // Capture Data
        
        for (i=0; i<N-1; i++)
        {
            for (k=0; k<1; k++)	WaitNextTimeSlice();
            
            *p++ = Time_sec() - T0;
            *p++ = ch0->Dest;
            *p++ = ch1->Dest;
            *p++ = ch2->Dest;
        }
        
        p=gather_buffer;
    
        FILE *f=fopen("C:\\temp\\kflopdata.txt","wt");
        for (i=0; i<N; i++)
        {
            // round times to neaarest servo tick
            
            p[0] = ((int)(p[0]/TIMEBASE + 0.5))*TIMEBASE;
            fprintf(f,"%16.9f,%16.3f,%16.3f,%16.3f\n",p[0],p[1],p[2],p[3]);
            p += 4;
        }
        fclose(f);
    }




  3. #3
    Registered cowleym's Avatar
    Join Date
    Oct 2007
    Location
    UK
    Posts
    64
    Downloads
    0
    Uploads
    0

    Default Re: Kflop pos command

    Ah, yes that makes sense.

    Many thanks for your rapid and detailed response.

    I will give it a go.

    Mike



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Kflop pos command

Kflop pos command