EMC & EtherCAT

More
11 Jan 2011 09:34 - 11 Jan 2011 09:34 #6610 by jan233321
EMC & EtherCAT was created by jan233321
Hi all,
I found some preliminary support for EherCAT in EMC2 - mainly for I/O, not for drives.

Would it be possible to write HAL driver for EtherCAT servo inverter and use this inverter within emc2?

Servo inverter can send: actual position (32bit), actual speed, actual torque/current, bit "in position" etc. - it is fully configurable.
can receive: target position, ramps, max. speed - also it is possible to configure it in nearly any way.

Is it possible to use emc2 with this kind of servo drive?

Well, the drive is possible to configure also in other way, to recieve target speed, ramps etc. and send back to emc actual position, speed....

The question now is, IF is possible (easily) add HAL driver for such a drive.

I looked inside hal_skeleton.c and it is not clear to me how to connect target/actual position inside system, is here any better example? The project is in preliminary stage, we are looking for good CNC software - and emc looks really, really good! :cheer:

Thanks

Jan
Last edit: 11 Jan 2011 09:34 by jan233321. Reason: typo in subj.

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

More
11 Jan 2011 13:18 #6616 by andypugh
Replied by andypugh on topic Re:EMC & EtherCAT
jan233321 wrote:

Would it be possible to write HAL driver for EtherCAT servo inverter and use this inverter within emc2?


As long as EtherCAT is Real Time (or Real Time enough) then it is emminently possible.

The question now is, IF is possible (easily) add HAL driver for such a drive.

It will need programming. Depending on whether the available drivers are realtime-compatible it might take a lot of programming.

I looked inside hal_skeleton.c and it is not clear to me how to connect target/actual position inside system, is here any better example?

It is probably easier to write the driver using comp, which is a preprocessor that takes away a lot of the housekeeping involved in writing a HAL component and lets you get on with the coding.
linuxcnc.org/docs/html/hal_comp.html

HAL "pins" are actually locations in shared memory that any component connected to the pin can read from or write to. All your driver would have to do is read the commanded position from a pin connected to motion.axis.0.command-position and write back the position to motion.axis.0.positio-fb.
So, you would create a component with a position-command input pin and a position-fb output pin, and then have code that performs the required etherCAT comms.

have a look at pluto_servo.comp for an example of a motion controller driver written in comp.

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

More
11 Jan 2011 14:24 #6622 by jan233321
Replied by jan233321 on topic Re:EMC & EtherCAT
Hello,
thank you for fast reply! :)

Well, it looks like that this is good way. Driver is Real Time, that's not a problem - I'm planning to use etherlab.org/en/ethercat/ IgH driver with supported Eth. card.

Other way is, how fast can servo drive refresh values on the bus in real life - that's maybe bigger problem than all other future programming issues etc.
With a standard servodrive configuration, we can reach 1ms cycle - within this 1ms interval you cannot get new/updated value and any change you do will be processed after (in the worst case) 1ms.

On the other way, what we need is relatively slow motion in three axis CNC machine - machine for cutting glass tables into parts (with shapes, not only rectangular).

For internal emc2 PID regulator can be this behavior problem, because what I seen from HAL until now is, that every time when is called HAL function with actual position request, HAL driver calculate and send new fresh position.

So, if I set in my .ini file to 1ms period

BASE_PERIOD = 1000000
# Servo task period, in nanoseconds
SERVO_PERIOD =1000000

then it should be OK? Will system ask HAL for actual position (and then set new position) in 1ms intervals with this configuration?

Regards
Jan

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

More
11 Jan 2011 15:46 #6627 by andypugh
Replied by andypugh on topic Re:EMC & EtherCAT
jan233321 wrote:

Well, it looks like that this is good way. Driver is Real Time, that's not a problem

More usefully, it appears to use RTAI, so might turn out to be quite straightforward to use.

Other way is, how fast can servo drive refresh values on the bus in real life - that's maybe bigger problem than all other future programming issues etc.
With a standard servodrive configuration, we can reach 1ms cycle - within this 1ms interval you cannot get new/updated value and any change you do will be processed after (in the worst case) 1ms.

BASE_PERIOD = 1000000
# Servo task period, in nanoseconds
SERVO_PERIOD =1000000

then it should be OK? Will system ask HAL for actual position (and then set new position) in 1ms intervals with this configuration?
n

You would typically not bother with the base thread in such a system, just run everything in the 1mS servo-thread. The base thread only supports integer arithmetic and is used purely for reading and setting pins for such elements as encoder counters.

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

More
11 Jan 2011 15:47 #6628 by andypugh
Replied by andypugh on topic Re:EMC & EtherCAT
Supplementary question:

Whilst it probably is possible to use EtherCAT, do you have a specific reason to want to? My assumption was that you already had an investment in drives and servos, but if that is not the case then there are probably cheaper and easier solutions.

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

More
14 Jan 2011 07:22 #6676 by jan233321
Replied by jan233321 on topic Re:EMC & EtherCAT
Hello,
your assumption is not completely correct, but you are very near - I'm from company which is servo and servo drives manufacturer. My only choices are CANopen and EtherCAT.

Actually, I (personally) would love to have CNC solution under GPL.

Regards
Jan.

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

More
15 Jan 2011 07:48 - 15 Jan 2011 07:49 #6700 by ulda
Replied by ulda on topic Re:EMC & EtherCAT
Hi Jan
I wrote the ethercat part in the wiki. Sorry for replying this late.

Does your hardware support a closed loop setup? It should.

If so, you can set up the speed loop and the position loop within the ethercat device.
Then you can use the stub I created to send emc's commanded position directy to the device.
Because then you are not in the need of closing the pid loop within the pc and can relax on the settings for BASE_PERIOD and a slow pc would do.

bye
Ulf
Last edit: 15 Jan 2011 07:49 by ulda.

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

More
15 Jan 2011 09:09 #6702 by jan233321
Replied by jan233321 on topic Re:EMC & EtherCAT
Yes, hardware support closed loop - it is primary made for this kind of control.

Actually, I did not find any wiki regarding EtherCAT based servo control, only wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Etherlab - but this is about digital I/O...

Now, we are in phase building testing machine (2D CNC like a plotter - it takes some time).

Regards

Jan

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

More
15 Jan 2011 16:16 #6707 by ulda
Replied by ulda on topic Re:EMC & EtherCAT
try to bild the ethercat system as described in this wiki.
Then connect the drive controllers directly to the ethercat activated network card of the pc

if you start the realtime and ethercat system you should see transmit all leds blinking
try issuing the "ethercat slaves" command and post the output. Then I can help you to set up the glue module.

/ulf

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

More
01 Jun 2011 12:15 #10236 by Coyote
Replied by Coyote on topic Re:EMC & EtherCAT
jan233321 wrote:

Hello,
thank you for fast reply! :)

Well, it looks like that this is good way. Driver is Real Time, that's not a problem - I'm planning to use etherlab.org/en/ethercat/ IgH driver with supported Eth. card.

Other way is, how fast can servo drive refresh values on the bus in real life - that's maybe bigger problem than all other future programming issues etc.
With a standard servodrive configuration, we can reach 1ms cycle - within this 1ms interval you cannot get new/updated value and any change you do will be processed after (in the worst case) 1ms.

On the other way, what we need is relatively slow motion in three axis CNC machine - machine for cutting glass tables into parts (with shapes, not only rectangular).

For internal emc2 PID regulator can be this behavior problem, because what I seen from HAL until now is, that every time when is called HAL function with actual position request, HAL driver calculate and send new fresh position.

So, if I set in my .ini file to 1ms period

BASE_PERIOD = 1000000
# Servo task period, in nanoseconds
SERVO_PERIOD =1000000

then it should be OK? Will system ask HAL for actual position (and then set new position) in 1ms intervals with this configuration?

Regards
Jan



I would go for speed control over ethercat instead of position control, because the drive would try to move from point A to point B with acceleration and speed parametrized in drive itself. IMHO you should make like this:

velocity_feedforward = derivation of desired_position / or something more stable approach
desired_velocity = Kp* (desired_position - actual_position) + velocity_feedforward;

You have a position loop with P-regulator and velocity feedforward, this is classics.
Faster update - better results as long jitter is not causing problems.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum