Making some axes independent of the motion controller

  • cogzoid
  • cogzoid's Avatar Topic Author
  • Visitor
  • Visitor
04 Jan 2019 05:14 #123452 by cogzoid
I just had an idea, and I wonder if it might work. I could set up all 8 axes using the normal motion controller as I have now, and home normally, then use a custom M code to disconnect output of the motion controller to the non-arm axes and implement limit3 codes to drive those. If I ever need to re-home the machine I could send another M code that switches back to the motion controller. I think this is doable, but I'd love to hear if there's another path to success here.

Please Log in or Create an account to join the conversation.

More
04 Jan 2019 11:34 #123464 by newbynobi
Hallo,

if you find that out, I hope you publish a sample config, as I have the same issue on handling units.

I would like to see a possibility to add JOINTS in the INI file and not needing to pass this ones through motion, but still being able to move them with gcode like G0 J7 100 moving Joint 7 100 machine units. Unfortunately my knowledge does not allow to implement this.

Norbert

Please Log in or Create an account to join the conversation.

More
06 Jan 2019 19:55 #123627 by andypugh
I am starting to see a use-case for a special version of Limit3 that has a built-in homing sequence.

Please Log in or Create an account to join the conversation.

  • cogzoid
  • cogzoid's Avatar Topic Author
  • Visitor
  • Visitor
07 Jan 2019 23:30 #123734 by cogzoid
I've been playing with swapping out the limit3 for the motion controller. What I'm learning is that I need to keep the feedback of the motion controller happy or else I get a Following Error. So what I'm implementing is Adding the output of Limit3 to the usual Axis motion controller, sending that through the PID loop and to the Mesaboard. Then the feedback has the limit3 value subtracted from it before goes back to the motion controller. So in order to keep the homing capabilities this is going through quite a complicated route, but I think it'll work great when I'm done.

Please Log in or Create an account to join the conversation.

More
08 Jan 2019 01:31 #123742 by andypugh
I wasn't ever really suggesting running the other axes through the motion controller.

I was thinking more of a scheme where:
M-code drives the input to the Limit3
Limit3 drives the (independent) PID
PID controls the motor.

Though that doesn't solve the homing problem. But with steppers you can probably just send a very negative value and let the motion hit the end stop. Then assume it is at zero. That's all the dials on car dashboards do....

Please Log in or Create an account to join the conversation.

  • cogzoid
  • cogzoid's Avatar Topic Author
  • Visitor
  • Visitor
08 Jan 2019 18:55 #123785 by cogzoid
Unfortunately, I don't have endstops on 4 of the 5 axes that I want to control with limit3, so I've got to figure out a homing solution for them.

I'm going to detail what I understand in the hopes that either someone can correct me, or use this info for their own projects.

axis.4.motor-pos-cmd is the output of the motion controller and the pin is connected to pid.b.command.
pid.b.out is actually a velocity output and connects to hm2_7i76e.0.stepgen.04.velocity-cmd

hm2_7i76e is essentially the chip on the board and that makes the motor move. This is working great on my benchtop setup.

The motion controller needs feedback to make sure everything is moving as expected, or it complains with a following error.

hm2_7i76e.0.stepgen.04.position-fb is connected straight to axis.4.motor-pos-fb and this completes the loop.

In other words:
axis.4.motor-pos-cmd  => pid.b.command
pid.b.out             => hm2_7i76e.0.stepgen.04.velocity-cmd

hm2_7i76e.0.stepgen.04.position-fb => axis.4.motor-pos-fb

What I am attempting to do is switch the control over to a limit3 function that is divorced from the motion planner. However, I have to do it in such a way that I preserve the feedback for the motion planner.

It'll look something like this:
axis.4.motor-pos-cmd  + limit3.b.out => pid.b.command
pid.b.out             => hm2_7i76e.0.stepgen.04.velocity-cmd

hm2_7i76e.0.stepgen.04.position-fb - limit3.b.out => axis.4.motor-pos-fb

I won't be using any G-codes to control the motion of the axis, but rather using M-codes to change the setpoint of limit3.b.in. I can even use M-codes to change the maxV and maxA parameters of limit3 to get fast or slow movements as desired. In order to home I'll need to set all of the limit3 setpoints to 0 first, or my home position will have an unwanted offset.

Thoughts?

Please Log in or Create an account to join the conversation.

More
08 Jan 2019 19:50 #123787 by andypugh
I think that you will find it easier to omit the pid components in this application.

Use the stepgens in position mode.

Please Log in or Create an account to join the conversation.

More
08 Jan 2019 23:19 - 08 Jan 2019 23:20 #123799 by Grotius
The first post of this threat included a link to this video :


In previous page there was a reply : as far as i know external offset branch will only apply an offset to a known axis!
In fact it can do much more then that, and it's complete independent. It don't depend's on g-code for example.

I have little example.

When you have an old music playbox like this, called music player :


You change the cilinder of the old music playbox with this, called music program :


It results in a other way of coding machine movement's. Maybe it's nice for his application.
Last edit: 08 Jan 2019 23:20 by Grotius.

Please Log in or Create an account to join the conversation.

  • cogzoid
  • cogzoid's Avatar Topic Author
  • Visitor
  • Visitor
08 Jan 2019 23:51 #123804 by cogzoid
I was able to switch around some nets and get everything working like I hoped!

A couple of things that were messing me up... I didn't notice a net connected to pid.feedback and that was causing an error. I also had to get rid of the pid.command-deriv input, as the limit3 function doesn't have a velocity output.

Anyway, I'm going to clean up my .hal file and post the relevant connections if anyone is interested. I'll also post an example M code file to show how easy it is to change the value.

Please Log in or Create an account to join the conversation.

  • cogzoid
  • cogzoid's Avatar Topic Author
  • Visitor
  • Visitor
09 Jan 2019 00:00 - 14 Jan 2019 19:27 #123805 by cogzoid
I hope this all makes sense. It's working on one axis, now I just need to translate it to the others as well.
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES num_dio=16
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config="firmware=hm2/7i80/7i76e_7i76x1_7i85x1D.bit num_encoders=0 num_pwmgens=0 num_stepgens=9 sserial_port_0=00xxxx" 
setp    hm2_7i76e.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.b,pid.c,pid.u,pid.v
loadrt limit3 names=limit3.a,limit3.b,limit3.c,limit3.u,limit3.v
loadrt sum2 names=sum2.a-cmd,sum2.b-cmd,sum2.c-cmd,sum2.u-cmd,sum2.v-cmd,sum2.a-fb,sum2.b-fb,sum2.c-fb,sum2.u-fb,sum2.v-fb
#loadrt siggen

addf hm2_7i76e.0.read         servo-thread
addf sum2.a-fb                servo-thread
addf sum2.b-fb                servo-thread
addf sum2.c-fb                servo-thread
addf sum2.u-fb                servo-thread
addf sum2.v-fb                servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf limit3.a 		      servo-thread
addf limit3.b                 servo-thread
addf limit3.c 		      servo-thread
addf limit3.u                 servo-thread
addf limit3.v                 servo-thread
addf sum2.a-cmd               servo-thread
addf sum2.b-cmd               servo-thread
addf sum2.c-cmd               servo-thread
addf sum2.u-cmd               servo-thread
addf sum2.v-cmd               servo-thread
addf pid.x.do-pid-calcs       servo-thread
addf pid.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
addf pid.a.do-pid-calcs       servo-thread
addf pid.b.do-pid-calcs       servo-thread
addf pid.c.do-pid-calcs       servo-thread
addf pid.u.do-pid-calcs       servo-thread
addf pid.v.do-pid-calcs       servo-thread
addf hm2_7i76e.0.write        servo-thread
setp hm2_7i76e.0.dpll.01.timer-us -50
setp hm2_7i76e.0.stepgen.timer-number 1

.
.
.
.

#*******************
#  AXIS B -- Tipper
#*******************

setp limit3.b.maxv [AXIS_4]MAX_VELOCITY
setp limit3.b.maxa [AXIS_4]MAX_ACCELERATION
setp limit3.b.min  [AXIS_4]MIN_LIMIT
setp limit3.b.max  [AXIS_4]MAX_LIMIT
setp limit3.b.in 0

setp   pid.b.Pgain     [AXIS_4]P
setp   pid.b.Igain     [AXIS_4]I
setp   pid.b.Dgain     [AXIS_4]D
setp   pid.b.bias      [AXIS_4]BIAS
setp   pid.b.FF0       [AXIS_4]FF0
setp   pid.b.FF1       [AXIS_4]FF1
setp   pid.b.FF2       [AXIS_4]FF2
setp   pid.b.deadband  [AXIS_4]DEADBAND
setp   pid.b.maxoutput [AXIS_4]MAX_OUTPUT
setp   pid.b.error-previous-target true
setp   pid.b.maxerror .0005

net b-index-enable  <=> pid.b.index-enable
net b-enable        =>  pid.b.enable
net b-pos-cmd       =>  pid.b.command
#net b-vel-cmd       =>  pid.b.command-deriv
net b-pos-fb0       =>  pid.b.feedback
net b-output        =>  pid.b.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.04.dirsetup        [AXIS_4]DIRSETUP
setp   hm2_7i76e.0.stepgen.04.dirhold         [AXIS_4]DIRHOLD
setp   hm2_7i76e.0.stepgen.04.steplen         [AXIS_4]STEPLEN
setp   hm2_7i76e.0.stepgen.04.stepspace       [AXIS_4]STEPSPACE
setp   hm2_7i76e.0.stepgen.04.position-scale  [AXIS_4]STEP_SCALE
setp   hm2_7i76e.0.stepgen.04.step_type        0
setp   hm2_7i76e.0.stepgen.04.control-type     1
setp   hm2_7i76e.0.stepgen.04.maxaccel         [AXIS_4]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.04.maxvel           [AXIS_4]STEPGEN_MAXVEL

# ---closedloop stepper signals---

setp limit3.b.in 0.0  #this gets set to the target number by M120

net b-pos-cmd-in0 sum2.b-cmd.in0 <= axis.4.motor-pos-cmd

#net b-vel-cmd    <= axis.4.joint-vel-cmd
net b-output     => hm2_7i76e.0.stepgen.04.velocity-cmd
net b-pos-fb0 sum2.b-fb.in0  <= hm2_7i76e.0.stepgen.04.position-fb
#net b-pos-fb     => axis.4.motor-pos-fb
net b-pos-fb-out => axis.4.motor-pos-fb
net b-enable     <= axis.4.amp-enable-out
net b-enable     => hm2_7i76e.0.stepgen.04.enable

# ---command summation math---
net limit-b-out sum2.b-cmd.in1 sum2.b-fb.in1 <= limit3.b.out
net b-pos-cmd    <= sum2.b-cmd.out

# ---feedback subtraction math---
setp sum2.b-fb.gain1 -1.0  #subtract off limit3 signal
net b-pos-fb-out sum2.b-fb.out 

# ---setup home / limit switch signals---

net home-b     =>  axis.4.home-sw-in
net b-neg-limit     =>  axis.4.neg-lim-sw-in
net b-pos-limit     =>  axis.4.pos-lim-sw-in
Last edit: 14 Jan 2019 19:27 by cogzoid.

Please Log in or Create an account to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum