Jump to content
OMRON Forums

JeffB

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by JeffB

  1. Will the code below work such that even_number is false if count is odd, true if count is even? Any issue with count actually being a floating point number instead of an integer? Seems not working in the field (count is always 0) but I don't have the hardware at hand to test.

    global count
    global even_number

    count = 2;

    if ((count & $1) == 0) even_number = 1 else even_number = 0

  2. Mr. Park's advice is correct. I edited the sshd_config file directly using putty but the Tools -> Options -> Power PMAC -> Communication Settings contains the same settings.

     

    Thanks!

    926296764_CommunicationSettings.png.2f9b6c7072b1a780a51f453ba0b4b964.png

  3. It seems newer firmware versions of the CK3 have a SSH timeout of 70? seconds, such that if there's no communication the PMAC will close the connection.

     

    This causes problem for our software, is it possible to set this timeout period?

  4. I need to see if a given PLC routine is running in my C background code.

     

    The line bRoutineRunning = pshm->Plc[14].Running; yields an error : 'PlcData' has no member named 'Running'.

     

    Maybe this should calculated from the Ldata like program running, e.g.

    bProgramRunning = ((pshm->Coord[1].Ldata.Status & 0x2E) == 0x20);?

     

    What is the analogous syntax for plc routines? What if my PLC is declared textually, i.e. 'open plc ScanLogPLC'?

     

    Thanks

  5. In case anybody else runs into this, if the struct is defined in a header file, its format should be typedef struct Name{definition}Name;

    Both Names must be the same and both must be present.

     

    If the struct is in the .c file it can be declared more flexibly.

  6. Thanks for the reply, Eric.

     

    So if in the same c file I can use the format

    typedef struct _SStatus

    {

    }SStatus;

     

    but if in a header file this doesn't work but

    typedef struct SStatus

    {

    };

     

    does work. What about my typedef unsigned long DWORD;? That also works fine when everything is in a .c file. How to make that work in the .h file?

     

    I attached a simple sample of my issues. The forum said the .h file type wasn't allowed so I renamed to .txt. I put the same code in one file and in the header file. It will compile as is but if you comment out the 2 typedefs in the .c file and rely on the definitions in the header it won't compile.

     

    If there's a sample of some more complicated program I could glean the compile rules from that would be ideal. Or maybe I'm doing something fundamentally wrong -- it seems strange to me that the same code should be handled differently in header and c file.

     

    Thanks!

    capp1.c

    capp1.txt

  7. My single file background c program was getting unwieldy so I decided to split it into 1 header and 3 c files. Now I get some strange errors saying my struct is not defined. So I copied my struct to the capp sample program header file and it also didn’t work. Then I defined my struct within the capp.c file and it did compile. What am I missing?

    __________

    /*For more information see notes.txt in the Documentation folder */

    #include

     

    #define _PPScriptMode_· · // for enum mode, replace this with #define _EnumMode_

    #include "../../Include/pp_proj.h"

     

    //#include "capp1.h"

     

    typedef unsigned long DWORD;

     

    typedef struct _SStatus

    {

    · union {

    · · struct {

    · · · DWORD abUnusable : 8;

    · · · DWORD bMotionBusy : 1; //0b23

    · · · DWORD bInitializeEnd : 1; //0b22

    · · · DWORD bAllServoOn : 1; //0b21

    · · · DWORD bAlarm : 1; //0b20

    · · · DWORD bHomePosition : 1; //0b19

    · · · DWORD bStandbyPosition : 1; //0b18

    · · · DWORD bExchangePosition : 1; //0b17

    · · · DWORD bSystemReady : 1; //0b16

    · · · DWORD abUnused :16;

    · · };

    · · DWORD dwStatus;

    · };

    } SStatus;

     

    int main(void)

    {

    · InitLibrary(); // Required for accessing Power PMAC library

     

    · · · · · //Put your code here

    · SStatus status;

    · status.bMotionBusy = true;

     

    · CloseLibrary();

    · return 0;

    }

  8. Is there any trick to changing the IP address. I've done it many times on new systems but it's often a pain because the IDE hangs before it can save the changes permanently. Then next time cycle the PMAC power it gets reset.

     

    Does the 'save' command in the terminal save the IP address?

  9. 1. would use a bgcplc (background c plc) instead of a background app. They already run a set number of times per background cycle.

    2. The easiest method would be unsolicited messages. The feature was really meant for sending strings to an HMI, but the IDE is easily capable of receiving and displaying the messages. Take a look at the send command in the software reference manual for more information about building formatted strings to display. Also see attachments.

     

    1. After some experimentation, I need a sleep of not longer than 2.5ms in order to catch the position changes at a high enough frequency. Will that be compatible will the background plc?

    2. Initially I had some trouble but later on it worked very well. Maybe the socket wasn't open in the beginning? Anyways works well and should make debugging a lot easier.

    Thanks

  10. I'm still struggling a bit with the lookahead. I modified my code as below and it does one scan at 25°. scan_angle is 25 and angle is 26. So somehow still looking ahead.

    But if I uncomment out the while line it can work. Why?

     

    Thanks

     

    angle = 0;

    while (angle < 25.1)

    {

    ﹒﹒//variables used by prog 10

    ﹒﹒scan_angle = angle

    ﹒﹒scan_distance_mm = ((300*cosd(tilt_angle))/cosd(scan_angle))+50

     

    ﹒﹒test_running == TRUE;

    ﹒﹒start 1:10;

    ﹒﹒dwell(0); //break lookahead

     

    ﹒﹒test_running == FALSE;

    ﹒﹒dwell(0) //force synchronous assignment

    ﹒﹒//while (!(test_running) && Coord[1].InPos == FALSE) {};

    ﹒﹒angle += 1.0;

    }

  11. Is there any way to call a motion program from another motion program and wait for the called motion program to finish?

     

    I tried something like this:

     

    angle = 0;

    while (angle < 100)

    {

    ﹒﹒test_running = FALSE;

    ﹒﹒test_running == TRUE;

     

    ﹒﹒start 1.10 //start prog 10 in CS 1

    ﹒﹒while (!(test_running) && Coord[1].InPos == FALSE) {};

    ﹒﹒﹒﹒test_running == FALSE;

    ﹒﹒angle += 1;

    }

     

    Then in the terminal I typed

    &0 b ScanTest r

     

    Instead of the angle incrementing by 1 it incremented by 4. I assume the motion program is looking ahead but I'm not sure how to force it to synchronize with my logic.

     

    Thanks

  12. Looks like the problem was using too much CPU. I added a sleep statement and it seems fine now.

     

    So now 2 questions remain:

    1. If I want run my background app at something roughly approximating a PLC routine, should I be adding a sleep of 10ms or 1ms or another way or lowering the priority?

    2. Any was to redirect program output to the IDE or screen? Like printf or MessageBox? Or can I declare a string variable that's visible in the IDE?

     

    Thanks

  13. I have a problem when downloading my project where it gets to the

    obj/

    obj/Debug/

    and hangs. I can still ping the PMAC but cannot connect to gpascii and the ServoCount in the watch window stops updating. Oncly can recover by power cycling.

     

    Eventually I figured out that the problem was one of my background apps. If I commented out most of the program (just leave main function) than I didn't have a problem with downloading.

     

    This has come and gone for awhile now. When I just build there is no problem and con compilation errors. Sometimes it matters if I am running the program at startup. In pp_startup I enable plc 1 which runs the program (system "/var/ftp/usrflash/Project/C\ Language/Background\ Programs/perimeter_interlock.out").

     

    Any suggestions?

     

    Another question:

    Any was to redirect program output to the IDE or screen? Like printf or MessageBox? Or can I declare a string variable that's visible in the IDE?

     

    Thanks

  14. So better as a background program than CfromScript? I couldn't get CfromScript to compile on the brick so used a background program but was thinking of switching when I get the real hardware tomorrow.

     

    DkillCoord sounds like it fits the bill.

     

    Thanks

  15. I want to use a polygon to detect if I’m too close to a wall. I’ve written the code in C on Windows and it works well (24 ns per check in debug mode). I have a few questions about porting it to PMAC C code:

    1. I have some constant arrays in memory, around 5 MB in total. I assume this won’t pose any issue.

    2. I could make an order of magnitude faster but I would need a 50 MB lookup table.

    3. What size integer is fastest to work with (e.g. 32 bit int)?

    4. When the plc detects the robot is too close to a wall I plan to servo off the motor. The motors have a brake function so servo off should stop the motor, which in turn should stop all the motors in the coordinate system.

  16. Not sure if it's exactly the same thing but I (inadvertently) had a p variable alone on a line in a motion program. No compiler error but the motion program would exit when it reached this line. Took me awhile to debug. Better if there was a compile error.
  17. Thanks to the plethora of good advice, I was able to greatly simplify a couple of homing routines that have been around for almost 15 years in hundreds of machines. Initially I had some issue because I was only waiting for HomeComplete, which as mentioned, signals when the hardstop is found, not when the move to HomeOffset is complete. After using the InPos flag (which includes DesVelZero), everything works as expected.

    Thanks again

  18. Glad its working for you. I have the ecattypedsdo called thousands of times a day on our robot as a check for errors before it does a task. Once and a while, when I'm debugging something else ecat related in the terminal, it will start to receive NaNs. Then I usually do $$$ first, then $$$*** if necessary.

     

    I wonder if the ecatypedsdo reading has to occur between the PDO transfers, so if you're transferring more PDO variables or have shorter update periods due to ECAT[].ServoExtension, you have less time for ecatypedsdo. My mental model of the EtherCAT communication still has a lot of holes.

  19. Thanks Dave, Eric,

     

    Using David's suggested hardstop homing method seems to work, but part of the home procedure involves going from the negative hardstop to the positive hardstop and verifying the range. How can I best do that using the native home method? I assume I can subtract my HomeOffset from 0 to get the negative hardstop position but if I call home a second time I will lose the relative position because it will zero the axis on the positive side.

     

    Also, is there any difference between waiting for HomeComplete vs waiting for DesVelZero? I worry if I start the home routine at the hardstop I may miss the DesVelZero.

  20. I have a homing plc routine that I'm converting to the Power PMAC from the Turbo PMAC (identical hardware; identical motor tuning parameters after conversion).

     

    Somehow I'm not quite getting to the hardstop. After it stops, if I servo off I can still easily manually move it 1 degree before hitting the hardstop.

     

    My code is:

    ...

    Motor[4].HomeVel = 10

    jog-4

    call Timer.msec(500); // delay for motor to start moving

    PLC14_TIMER1 = 30 + Sys.Time // set timer to 30 sec

    while (Motor[4].DesVelZero == 0 && Motor[4].AmpEna == 1 && PLC14_TIMER1 > Sys.Time && Abs(Motor[4].ActVel) > Abs(Motor[4].HomeVel*0.25)) // wait for end or amp killed or Timeout

    {}

     

    one difference with the Turbo PMAC version (motor number has switched from 2 to 4 but that doesn't matter):

    The turbo pmac code has I24 = I224 | $400000 right before the jog with a comment 'jog to a stall condition'. What's the the PowerPMAC equivalent of this? I know I224 is Motor[2].Ctrl. Later in the routine it sets it back: I224 = I224 & $BFFFFF

     

    Thanks

×
×
  • Create New...