Modbus input for absolute encoder position?

More
04 Dec 2019 01:11 - 04 Dec 2019 01:13 #151929 by 0x2102
Hello,

I recently purchased servo drives with multiturn / absolute encoders. I am able to read the required registers via MB2HAL.

Multiturn Count: 0 - 65536
Pulses per Turn: 0 - 65536

I was wondering if anybody was able to get this to work in LCNC as PCW/andypugh described? ModBus absolute position read at startup and then incremental encoders for realtime feedback.

Regards,
Markus
Last edit: 04 Dec 2019 01:13 by 0x2102.

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

More
04 Dec 2019 11:22 #151975 by andypugh

0x2102 wrote: Multiturn Count: 0 - 65536
Pulses per Turn: 0 - 65536

I was wondering if anybody was able to get this to work in LCNC as PCW/andypugh described? ModBus absolute position read at startup and then incremental encoders for realtime feedback.


I think it might be simpler than you think. You should be able to just add the numbers together in HAL and use directly.

Note that the sum2 HAL component has separate gains for the two inputs, so you can scale one for distance-per-turn and the other for distance-per-pulse.
You might need to convert from signed integer (S32) to Floating point, but that, plus specifying absolute encoder homing should be all that you need.
(This assumes you are reading the Modbus in a realtime thread, of course)

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

More
04 Dec 2019 11:53 #151979 by 0x2102
Thanks Andy.

Still learning LinuxCNC - so I might ask stupid questions.

I set up LinuxCNC in closed loop (velocity mode). The incremental encoders are driving the PID for the axis. That is working fine.

The ModBus reading would be too slow to drive the PID.

Does your example this still apply?

Regards,
Markus

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

More
04 Dec 2019 13:09 #151987 by andypugh

0x2102 wrote: The ModBus reading would be too slow to drive the PID.

The PID updates once per mS. Modbus can transfer hundreds of registers in that time.
But I think that you are correct, in that both modbus2hal and Classic Ladder modbus implementations run in user space.

What is the actual servo drive?

Does your example this still apply?

With modifications, probably. You would need to add together all three numbers (incremental encoder counter float position, mutli-turn and single turn)
That would need two sum2 components per axis, or you could make a simple HAL component as a 3-way adder with scaling / number conversion. This might be needed if the modbus register are likely to change during operation, you would want to latch the initial numbers if you are also using the incrmental output.

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

More
04 Dec 2019 21:24 #152023 by 0x2102
They are JMC 400W Servos with a JASD4002-20B drive.

www.jmc-motor.com/product/903.html

www.jmc-motor.com/file/1806085008.pdf

I guess it would be a nice to have feature, but it's not really that critical.

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

More
04 Dec 2019 22:38 #152026 by andypugh
What interface hardware are you using? Maybe you can be the first to do realtime modbus with a Mesa UART.

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

More
04 Dec 2019 22:47 - 04 Dec 2019 22:47 #152028 by 0x2102
I do have a couple :-)

Currently I have a 7i95 on my test bench that I planned on using for this setup.

I also have a 7i76e and 7i92+7i76+7i77 available.
Last edit: 04 Dec 2019 22:47 by 0x2102.

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

More
05 Dec 2019 05:57 #152045 by Weiler810T
That would interest me, too. ;) I'll read along.

greeting Siggi

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

More
05 Dec 2019 07:42 #152049 by Henk
I agree, this will be very useful.

Henk

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

More
05 Dec 2019 11:18 #152057 by andypugh
So, do you know the register numbers that contain the data? (and thus the modbus transaction data)

You should, I think, be able to connect all the drives to one serial port, including the one on the 7i76e.

I think it might be relatively easy to write a .comp that loads like:
[/code]loadrt mesa_modbus uart="hm2_7i76.0.uart.0" addr="151,151,152", regs="55,65"[/code]

It might be better to have something like the format used for absolute encoders :
ssi_chan_0=error%1bposition%24g
Possibly using all the same code, in fact.

This is one existing implementation of a driver for the Mesa UART:
github.com/LinuxCNC/linuxcnc/blob/master...ivers/mesa_uart.comp

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

Time to create page: 0.117 seconds
Powered by Kunena Forum