Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A quick glance at Power PMAC Gather setup
#1
The following is an example on how to setup the gather feature in the Power PMAC.

Gather.enable = 0 ;disable
= 1 ; pause & setup
= 2 ; run & setup
Gather.addr[] ;source address
Ldata.Type ; After assign address and Ldata.Type will be return gather.type
Gather.type[] = 0 ;unsigned 32bit
= 1 ;signed 32bit
= 2 ;unsigned 24bit
= 3 ;signed 24bit
= 4 ;float 32bit
= 5 ;double 64bit
Gather.Items ;# of items to gather (128 sources)
Gather.Period = 1 ;every servo
= 2 ;2 every other servo etc.
Gather.MaxLines ; after assign address and Gather.enable=1 then Maxlines will ;calculate Max buffer size, so MaxSamples have to be less then ;Maxlines
Gather.MaxSamples ;# of samples to gather if doing a traditional gather that fits into ;internal buffer, do not exceed Gather.MaxLines Gather.
******************** Examples *****************
Gather.enable = 0
Gather.addr[0]=Sys.ServoCount.a
Gather.addr[1]=Motor[0].ActPos.a
Gather.addr[2]=Motor[0].DesVel.a
Gather.addr[3]=Motor[0].PosError.a
Gather.items=4
Gather.Period=1
Gather.MaxSamples=2147483647

Gather.enable = 2
Gather.Enable = 0




Gather.Phaseenable = 0
Gather.Phaseaddr[0]= Sys.ServoCount.a
Gather.Phaseaddr[1]=Motor[0].ActPos.a
Gather.Phaseaddr[2]=Motor[0].DesVel.a
Gather.Phaseaddr[3]=Motor[0].PosError.a
Gather.Phaseitems=2
Gather.PhasePeriod=1
Gather.PhaseMaxSamples=200000
Gather.Phaseenable = 1
Gather.Phaseenable = 2




Gather.Phaseenable
Gather.Phaseaddr[0]
Gather.Phasetype[0]
Gather.Phaseaddr[1]
Gather.Phasetype[1]
Gather.Phaseaddr[2]
Gather.Phasetype[2]
Gather.Phaseaddr[3]
Gather.Phasetype[3]
Gather.Phaseitems
Gather.PhasePeriod
Gather.PhaseMaxSamples
Gather.Phaseenable
Gather.Phaseenable

How to export the gather to a file in ftp:// …/Gather folder

In the telnet session, Issue the following Commands:

sync
gather -u /var/ftp/gather/gatheroutput.txt

if gather at phase rate:

sync
gather -p -u /var/ftp/gather/gatheroutput.txt
Sina Sattari
Hardware Engineering Manager
Delta Tau Data Systems, Inc.
Reply
#2
This process has worked for me in the past, but today I receive the following error when trying to download the gather data:

login as: deltatau
deltatau@192.168.100.210's password:
Linux powerpmac 2.6.30.3 #12 Tue Nov 17 13:58:49 PST 2009 ppc
---------------------------------
-- PowerPMAC Motion Controller --
---------------------------------
You have new mail.
Last login: Thu Oct 7 03:57:41 2010 from 192.168.100.215
deltatau@powerpmac:~$ sync
deltatau@powerpmac:~$ gather -u /var/ftp/gather/oct14_100hz.txt
Xenomai: binding failed: Operation not permitted.
deltatau@powerpmac:~$

Any ideas? I am using the 8/26/2010 IDE and firmware 1.2.1.5. This is the first time I've tried to transfer data after the firmware update.

Thanks,

Scott
Reply
#3
Lack of permissions as you are trying this as a non root. You can use ftp and login in as user ftp with a password ftp and get the file.

If you really want to try doing it through deltatau check out this link. I have not tried this myself. http://www.xenomai.org/index.php/Non-root_RT


(10-14-2010, 12:47 PM)scott.eichhorn@etrema.com Wrote: This process has worked for me in the past, but today I receive the following error when trying to download the gather data:

login as: deltatau
deltatau@192.168.100.210's password:
Linux powerpmac 2.6.30.3 #12 Tue Nov 17 13:58:49 PST 2009 ppc
---------------------------------
-- PowerPMAC Motion Controller --
---------------------------------
You have new mail.
Last login: Thu Oct 7 03:57:41 2010 from 192.168.100.215
deltatau@powerpmac:~$ sync
deltatau@powerpmac:~$ gather -u /var/ftp/gather/oct14_100hz.txt
Xenomai: binding failed: Operation not permitted.
deltatau@powerpmac:~$

Any ideas? I am using the 8/26/2010 IDE and firmware 1.2.1.5. This is the first time I've tried to transfer data after the firmware update.

Thanks,

Scott
Reply
#4
Hi Henry,

I think I must be missing something. Per Sina's instructions, I thought I needed to create the gather text file though a Telnet session:

How to export the gather to a file in ftp:// …/Gather folder
In the telnet session, Issue the following Commands:
sync
gather -u /var/ftp/gather/gatheroutput.txt


Then I would FTP in to transfer the text file. The errors I posted were when I tried to create the text files in the Telnet session. I hadn't had permission issues before. I'm hesitant to mess with Xenomai since I don't have the slightest idea what unintended issues I might cause.

Do Sina's instructions need to be revised for the latest firmware, or is there something fundamental I am not grasping?

Thanks again,
Scott
Reply
#5
Scott,

I missed to write in my post that you need to login under root. Most of the task that are done through telnet require root access, including use of gather application.
Sina Sattari
Hardware Engineering Manager
Delta Tau Data Systems, Inc.
Reply
#6
This works as far as it goes, but I want to use the 'indefinite;' gather mode, where Gather.Enable = 3.
I also want to acquire the data in a binary format rather than the csv that gather() logs.

I'd hope to be able to do all that with a background C program, but could do wiith a little help on the C interface to the gather system.

-artag
Reply
#7
The Gather Buffer is just a series of bytes so to access the Gather Buffer Data from a C App you must know what type of variables you gathered. Then you can access the buffer directly and offset your pointer the correct number of bytes for each element that was gathered.


pGatherBuffer = (char *)(pSharedMem->Gather.Buffer);
samples = pSharedMem->Gather.Index;
*timeConstant = 0.0;

fpGather = fopen ("/var/ftp/gather/autotune_gather.txt", "w");


//--------------------------------------------------------------------------
// Read in gathered data and compute the following error and min max
// following error
//--------------------------------------------------------------------------
for (i = 0; i < samples; i++)
{
memcpy(&t, (unsigned char*)pGatherBuffer, sizeof(unsigned));
pGatherBuffer += sizeof(unsigned);
memcpy(&cmdpos,(unsigned char*) pGatherBuffer, sizeof(double));
pGatherBuffer += sizeof(double);
memcpy(&actpos, (unsigned char*)pGatherBuffer, sizeof(double));
pGatherBuffer += sizeof(double);
memcpy(&dac, (unsigned char*)pGatherBuffer, sizeof(float));
pGatherBuffer += sizeof(float);
fprintf(fpGather, "%u %lf %lf %lf\r\n", time, cmdpos, actpos, dac);
}
fclose(fpGather);

Reply
#8
Here is a cleaned up version of the above code, put into an actual Background C App for reference:

Code:
//--------------------------------------------------------------------------------
#include <gplib.h>    // Global Gp Shared memory pointer
//-------------------------------------------------------------
// The following is a projpp created file from the User defines
//-------------------------------------------------------------
#include "../../Include/pp_proj.h"

int main(void)
{
    char *pGatherBuffer;
    double samples,time,cmdpos,actpos,dac;
    unsigned int i;
    FILE *fpGather;
    
    InitLibrary();
    
    pGatherBuffer = (char *)(pshm->Gather.Buffer);
    samples = pshm->Gather.Index;

    fpGather = fopen("/var/ftp/gather/autotune_gather.txt", "w");

    //--------------------------------------------------------------------------
    // Read in gathered data and output to data file
    //--------------------------------------------------------------------------
    for (i = 0; i < samples; i++)
    {
        memcpy(&time, (unsigned char*)pGatherBuffer, sizeof(unsigned));
        pGatherBuffer += sizeof(unsigned);
        memcpy(&cmdpos,(unsigned char*)pGatherBuffer, sizeof(double));
        pGatherBuffer += sizeof(double);
        memcpy(&actpos, (unsigned char*)pGatherBuffer, sizeof(double));
        pGatherBuffer += sizeof(double);
        memcpy(&dac, (unsigned char*)pGatherBuffer, sizeof(float));
        pGatherBuffer += sizeof(float);
        fprintf(fpGather, "%u %lf %lf %lf\r\n", time, cmdpos, actpos, dac);
    }
    fclose(fpGather);
    CloseLibrary();
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)