Config absolute encoder with step/dir system

More
31 Jan 2019 18:23 #125422 by thang
I'm trying to use absolute encoder for my machine, here is my goal:
+ Getting absolute encoder data
+ Setting absolute encoder is used for homing.
+ Setting motor and absolute encoder direction
To use encoder i did:
+ Create a halcomponent to get absolute encoder data and make an output pin:
abs_pos_fb = absolute_pos_encoder + pos_offset + pos_incr
+ Connect halpin:
Hm2_5i25.0.stepgen.pos_fb <=> pos_incr
abs_pos_fb <=> motor_pos_fb
+ I take absolute encoder before power_on
+ Set homing with absolute encoder
There is a problem when i use this config:
+ after getting absolute encoder, motor_pos_fb is changed ==> generate motor_pos_cmd this will cause motor run.
If someone have exp about using absolute encoder ? Or is there anyway that i can set offset to make motor_pos_cmd =0 after get abs encoder? I found joint.x.motor_offset but i dont know how it work and this pin seem not writeable

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

More
01 Feb 2019 13:37 #125462 by andypugh
I think you need to _not_ add any offsets to the encoder output.

Try
net pos-fb absolute_pos_encoder joint.0.motor-pos-fb

I think that all the calculations that you are doing in HAL are duplicates of calculations done in the motion module.

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

More
01 Feb 2019 17:13 #125481 by thang
Curently i'm using open loop so I can only take absolute position once time(i use estop signal to start reading serial data). And i didnt use encoder increment.

When i connected:
motor-pos-cmd => hm2_5i25.0.stepgen.0.position-cmd
(abs_pos_encoder+ pos_offset + hm2_5i25.0.stepgen.0.position-fb) => motor-pos-fb
I saw:
+ After reading encoder data,
hm2_5i25.0.stepgen.0.position-cmd changed from 0 to value = -motor-pos-fb
hm2_5i25.0.stepgen.0.position-fb=0.

+ Turn power-on make f-error.

+ If there is noway to use absolute encoder with open loop, i will use step/dir system close loop like u mention, i wish i dont have to do it

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

More
01 Feb 2019 17:32 #125483 by andypugh

thang wrote: + If there is noway to use absolute encoder with open loop, i will use step/dir system close loop like u mention, i wish i dont have to do it


The way I suggested isn't closed loop, it just gives the system some information to use for homing.

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

More
02 Feb 2019 00:11 #125510 by thang
Absoluter position(without add stepgen position-fb or increment encoder) is constant. If i connect it directly to motor-pos-fb, this pin wont change.

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

More
02 Feb 2019 13:56 #125532 by dm17ry
if you add a constant to stepgen.0.position-fb before feeding it to joint.0.motor-pos-fb then i think you have to subtract the same amount from joint.0.motor-pos-cmd and then feed it to stepgen.0.position-cmd

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

More
14 Feb 2019 10:04 - 20 Feb 2019 02:07 #126440 by thang
Sorry, my pc just get fixed today. I created a simulator to show you how i configed.

File Attachment:

File Name: test_abs_2...2-19.hal
File Size:5 KB

File Attachment:

File Name: abs_sim_20...-19.comp
File Size:1 KB

File Attachment:

File Name: test_abs_2...2-19.ini
File Size:5 KB


Just need compile abs_sim.comp by halcompile then run it. The following error happen when i turn machine on (F2)

This is an update to files that use abs encoder to home, who interesting in using absolute encoder can take this to prefer
Attachments:
Last edit: 20 Feb 2019 02:07 by thang.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum