586,307 active members*
3,598 visitors online*
Register for free
Login
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    66

    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

  2. #2
    Join Date
    May 2006
    Posts
    4046

    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);
    }
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Oct 2007
    Posts
    66

    Re: Kflop pos command

    Ah, yes that makes sense.

    Many thanks for your rapid and detailed response.

    I will give it a go.

    Mike

Similar Threads

  1. Move command works until velocity command issued
    By madprinter in forum Dynomotion/Kflop/Kanalog
    Replies: 1
    Last Post: 06-30-2015, 01:06 AM
  2. OSP 200 P Command ?
    By Dave Allen in forum Okuma
    Replies: 9
    Last Post: 10-24-2012, 11:56 PM
  3. M01 command
    By slideleft in forum Haas Mills
    Replies: 4
    Last Post: 11-20-2008, 10:01 PM
  4. G03 COMMAND HELP!!
    By hkfanatic in forum G-Code Programing
    Replies: 25
    Last Post: 08-04-2008, 09:14 PM
  5. what is the same command?
    By hop in forum G-Code Programing
    Replies: 0
    Last Post: 06-20-2006, 11:24 AM

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
  •