Hello All,
I am trying to measure the velocity and acceleration of the individual axis 
in machinekit.

I have added the ddt components and included them in my hal.

This is a copy of part of my hal file with the DDTs included.

*# axis enable chain*
*newsig emcmot.00.enable bit*
*sets emcmot.00.enable FALSE*

*net emcmot.00.enable axis.0.amp-enable-out => hpg.stepgen.00.enable 
pid.0.enable*

*# position command and feedback*
*net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command ddt.0.in*
*net emcmot.00.vel-cmd axis.0.joint-vel-cmd => pid.0.command-deriv*

*net emcmot.00.pos-fb hpg.stepgen.00.position-fb => axis.0.motor-pos-fb 
pid.0.feedback *
*net emcmot.00.command pid.0.output => hpg.stepgen.00.velocity-cmd*
*#net emcmot.00.pos-cmd => hpg.stepgen.00.position-cmd ddt.0.in*

*setp pid.0.error-previous-target true*
*setp pid.0.maxerror .001*

*# Set the stepgen in velocity mode*
*setp hpg.stepgen.00.control-type 1*

*# timing parameters*
*setp hpg.stepgen.00.dirsetup        [AXIS_0]DIRSETUP*
*setp hpg.stepgen.00.dirhold         [AXIS_0]DIRHOLD*

*setp hpg.stepgen.00.steplen         [AXIS_0]STEPLEN*
*setp hpg.stepgen.00.stepspace       [AXIS_0]STEPSPACE*

*setp hpg.stepgen.00.position-scale  [AXIS_0]SCALE*

*setp hpg.stepgen.00.maxvel          [AXIS_0]STEPGEN_MAX_VEL*
*setp hpg.stepgen.00.maxaccel        [AXIS_0]STEPGEN_MAX_ACC*

*# P8.9 X_Step*
*setp hpg.stepgen.00.steppin         0x65*
*# P8.10 X_Dir*
*setp hpg.stepgen.00.dirpin          0x64*

*# PID settings to prevent PRU pin hunting*
*setp pid.0.Pgain [AXIS_0]P*
*setp pid.0.Igain [AXIS_0]I*
*setp pid.0.Dgain [AXIS_0]D*
*setp pid.0.bias [AXIS_0]BIAS*
*setp pid.0.FF0 [AXIS_0]FF0*
*setp pid.0.FF1 [AXIS_0]FF1*
*setp pid.0.FF2 [AXIS_0]FF2*
*setp pid.0.deadband [AXIS_0]DEADBAND*
*setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT*

*# set the signals for the velocity and acceleration*
*net Xvel ddt.0.out => ddt.1.in *
*net Xacc <= ddt.1.out*

This is, if I am correct, the same way Bas de Bruin showed in his setup. 
The derivative of the position is the speed ( with the problem that I don't 
know what unit is being used, since the time constant will be the 
servo-thread period ). And the derivative of the speed is the acceleration.

I opened halscope and plotted the Xvel net. But instead of a "logical" 
speed graph I got the following:

<https://lh3.googleusercontent.com/-IiOBZyfo24Y/WRxq4G0MgzI/AAAAAAAAAk0/Rf4VRJZzV4Y5ijrA7kWjJPQd3ukeQo8VgCLcB/s1600/HalScope%2BXAcceleration%2B2017-05-17-10-43.png>

Does anybody know why this doesn't look like what I would expect ( 
something more of a straight line with nice slopes )??

With regards,
Michel van der Breggen



-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to