I finally got it right. Newbie mistake. Forgot to sudo make install when 
rebuilding my version of the code. But my proposed fix was correct.

I attach the git diff file. I would appreciate if someone would check it before 
(someone with the power) pushes it into the main branch.

Thanks
Lisandro

> From: [email protected]
> To: [email protected]
> Date: Sat, 22 Dec 2012 08:12:06 -0500
> Subject: Re: [Emc-developers] Error when jogging axes in teleop mode
> 
> On Saturday 22 December 2012 08:03:33 andy pugh did opine:
> 
> > On 21 December 2012 17:04, Lisandro Massera <[email protected]> 
> wrote:
> > > Is there any problem using the abs() function in a real time module?
> > 
> > abs() is an integer function.
> 
> Mmmm,  according to my "man 9 abs", its a float.  And the output I see on 
> the halmeter is a float.
>  
> > There is fabs() for floating point. (which is valid in realtime code)
> 
> There is a fabs, fabsf, fabsl in linux, man pages are in man3, but it isn't 
> part of linuxcnc, from my read of their man pages, its usable in a bash 
> script or similar.
> 
> Cheers, Gene
> -- 
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
> Green's Law of Debate:
>       Anything is possible if you don't know what you're talking about.
> I was taught to respect my elders, but its getting 
> harder and harder to find any...
> 
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers
                                          
diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c
index 3ee0f76..ada126d 100644
--- a/src/emc/motion/command.c
+++ b/src/emc/motion/command.c
@@ -1429,14 +1429,14 @@ check_stuff ( "before command_handler()" );
                double velmag;
                emcmotDebug->teleop_data.desiredVel = emcmotCommand->pos;
                pmCartMag(emcmotDebug->teleop_data.desiredVel.tran, &velmag);
-               if (emcmotDebug->teleop_data.desiredVel.a > velmag) {
-                   velmag = emcmotDebug->teleop_data.desiredVel.a;
+               if (fabs(emcmotDebug->teleop_data.desiredVel.a) > velmag) {
+                   velmag = fabs(emcmotDebug->teleop_data.desiredVel.a);
                }
-               if (emcmotDebug->teleop_data.desiredVel.b > velmag) {
-                   velmag = emcmotDebug->teleop_data.desiredVel.b;
+               if (fabs(emcmotDebug->teleop_data.desiredVel.b) > velmag) {
+                   velmag = fabs(emcmotDebug->teleop_data.desiredVel.b);
                }
-               if (emcmotDebug->teleop_data.desiredVel.c > velmag) {
-                   velmag = emcmotDebug->teleop_data.desiredVel.c;
+               if (fabs(emcmotDebug->teleop_data.desiredVel.c) > velmag) {
+                   velmag = fabs(emcmotDebug->teleop_data.desiredVel.c);
                }
                if (velmag > emcmotConfig->limitVel) {
                    pmCartScalMult(emcmotDebug->teleop_data.desiredVel.tran,
diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c
index d3590a2..2d759bd 100644
--- a/src/emc/motion/control.c
+++ b/src/emc/motion/control.c
@@ -25,6 +25,7 @@
 #include "motion_debug.h"
 #include "config.h"
 
+
 // Mark strings for translation, but defer translation to userspace
 #define _(s) (s)
 
@@ -1303,14 +1304,14 @@ static void get_pos_cmds(long period)
            (emcmotDebug->teleop_data.desiredVel.c -
            emcmotDebug->teleop_data.currentVel.c) /
            servo_period;
-       if (emcmotDebug->teleop_data.desiredAccell.a > accell_mag) {
-           accell_mag = emcmotDebug->teleop_data.desiredAccell.a;
+       if (fabs(emcmotDebug->teleop_data.desiredAccell.a) > accell_mag) {
+           accell_mag = fabs(emcmotDebug->teleop_data.desiredAccell.a);
        }
-       if (emcmotDebug->teleop_data.desiredAccell.b > accell_mag) {
-           accell_mag = emcmotDebug->teleop_data.desiredAccell.b;
+       if (fabs(emcmotDebug->teleop_data.desiredAccell.b) > accell_mag) {
+           accell_mag = fabs(emcmotDebug->teleop_data.desiredAccell.b);
        }
-       if (emcmotDebug->teleop_data.desiredAccell.c > accell_mag) {
-           accell_mag = emcmotDebug->teleop_data.desiredAccell.c;
+       if (fabs(emcmotDebug->teleop_data.desiredAccell.c) > accell_mag) {
+           accell_mag = fabs(emcmotDebug->teleop_data.desiredAccell.c);
        }
        
        /* accell_mag should now hold the max accell */
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to