If you configure emc with --enable-simulator and run with a
configuration that doesn't load any hardware drivers, then you can use
"gdb" (commandline debugger) to single-step through your kinematics.

Step 0: Assuming you also configured with "--enable-run-in-place",
always remember to ". scripts/emc-environment" in each terminal you use
in the steps below.

Step 1: start rtapi_app inside the debugger and set breakpoints

    $ gdb rtapi_app
    (gdb) break kinematicsForward
    Function "kinematicsForward" not defined.
    Make breakpoint pending on future shared library load? (y or [n]) y
    Breakpoint 1 (kinematicsForward) pending.
    (gdb) run
    Starting program: /usr/local/jepler/src/emc2/bin/rtapi_app 

(choose kinematicsForward or kinematicsInverse depending on which
function you want to debug)

Step 2: In another terminal, start emc.  The debugger will resolve the
breakpoint and stop at the top of the kinematicsForward function:
    Breakpoint 2 at 0xb7ef15cf: file emc/kinematics/pumakins.c, line 57.
    Pending breakpoint "kinematicsForward" resolved

    Breakpoint 2, kinematicsForward (joint=0x8059074, world=0xb7afe200,
    fflags=0xb7c760a4, iflags=0xb7c760a0) at emc/kinematics/pumakins.c:57
    57     s1 = sin(joint[0]*PM_PI/180);
    Current language:  auto; currently c
    (gdb)

(if you break on kinematicsInverse, it won't stop until you first enter
coordinated mode)

You'll find many tutorials on the net about using gdb.  Here are some
good commands to know:
    To turn off the breakpoint #2 so that emc will run normally for awhile:
        (gdb) disable 2      
    To turn it back on:
        # hit ctrl-c to get gdb prompt back
        (gdb) enable 2
            
    To go through code a little bit at a time:
        (gdb) step
        (gdb) next

    To resume until the next breakpoint or until you hit ctrl-c to get
    the gdb prompt back:
        (gdb) continue

    To look at 'joint' as 9 doubles (in my kinematics, input for
    kinematicsForward is called 'joint'):
        (gdb) print (double[9])*joint

    To look at the value of local variables:
        (gdb) info locals
    Or just one
        (gdb) print hom.tran.x

AXIS will error out if you wait too long at the (gdb) prompt without
continuing.  You can prevent this by finding the line 'if statfail >
500:' line in src/emc/usr_intf/axis/scripts/axis.py and removing or
commenting out (put "#" at the start of the line) that line and the
following one.  You can also comment out the 'print "waiting for
s.axes"' line if it gets in the way.

--- src/emc/usr_intf/axis/scripts/axis.py       19 Jan 2009 22:48:01 -0000      
1.216
+++ src/emc/usr_intf/axis/scripts/axis.py       20 Jan 2009 17:17:33 -0000
@@ -3568,11 +3568,8 @@ s = emc.stat();
 s.poll()
 statfail=0
 while s.axes == 0:
-    print "waiting for s.axes"
     time.sleep(.01)
     statfail+=1
-    if statfail > 500:
-        raise SystemExit, "Invalid configuration of axes is preventing EMC 
from starting"
     s.poll()
 
 live_axis_count = 0


Jeff

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to