- Posts: 297
- Thank you received: 56
Remora - ethernet NVEM / EC300 / EC500 cnc board
- tuxcnc
- Offline
- Elite Member
-
Less
More
1 year 4 months ago #330537
by tuxcnc
QDC.
The encoder_raw code is good and there are only hardware problems (optocouplers and RC filters cut the bandwith).
But this is very bad idea to send encoder's index pulse by ethernet.
Let's make calculations.
3000 rpm and 1 ms base_thread is 18 degrees accuracy - not acceptable.
The solution is send not index, but raw_count lathed at encoder's index edge interrupt routine.
There is in your code, line 321 in qdc.cpp file:
But there is no indexCount hal pin...
In the fact, we don't need receive index pulse at component side, because change of indexCount means index was betwen last and present data transmision.
So we can update indexCount at every encoder's index edge, but use them only if hal index_enable pin is true. (look at my code).
I tried use raw_count and index pins connected to PRUencoder module. Sometimes it works, mostly not.
But even if it works, PRUencoder resets position to zero at received index, not at real index.
In my code, position is reset not to zero, but to
(raw_encoder may be not equal latched_enc)
So there is no delay.
In this case I not need PRUencoder, because I move pos and vel calculations to my component.
Replied by tuxcnc on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
Hi.Hi, which module have you been trying to use? The software Encoder module or the QDC module? Both support the index pulse detection and encoder count latching so LinuxCNC can acquire the index position count.
QDC.
The encoder_raw code is good and there are only hardware problems (optocouplers and RC filters cut the bandwith).
But this is very bad idea to send encoder's index pulse by ethernet.
Let's make calculations.
3000 rpm and 1 ms base_thread is 18 degrees accuracy - not acceptable.
The solution is send not index, but raw_count lathed at encoder's index edge interrupt routine.
There is in your code, line 321 in qdc.cpp file:
Code:
this->indexCount = ENC_GetPositionValue(this->encBase);
In the fact, we don't need receive index pulse at component side, because change of indexCount means index was betwen last and present data transmision.
So we can update indexCount at every encoder's index edge, but use them only if hal index_enable pin is true. (look at my code).
I tried use raw_count and index pins connected to PRUencoder module. Sometimes it works, mostly not.
But even if it works, PRUencoder resets position to zero at received index, not at real index.
In my code, position is reset not to zero, but to
Code:
pos = (fb.raw_encoder - latched_enc) / pos_scale;
So there is no delay.
In this case I not need PRUencoder, because I move pos and vel calculations to my component.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
1 year 4 months ago #330589
by andypugh
The counts are cleared on the index.
At the beginning of the execution thread the motion controller gets the _current_ position, which includes all counts since the index.
These are used to calculate the actual position in space of the index.
It isn't even time-critical, what the controller gets is the position in space of the index. It would still be perfectly accurate even if the motor did several turns between the index reset and the data getting to the PC.
Replied by andypugh on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
This is actually fine, and is how all the other encoders work (Mesa, Pico, software)
But this is very bad idea to send encoder's index pulse by ethernet.
Let's make calculations.
3000 rpm and 1 ms base_thread is 18 degrees accuracy - not acceptable.
The counts are cleared on the index.
At the beginning of the execution thread the motion controller gets the _current_ position, which includes all counts since the index.
These are used to calculate the actual position in space of the index.
It isn't even time-critical, what the controller gets is the position in space of the index. It would still be perfectly accurate even if the motor did several turns between the index reset and the data getting to the PC.
Please Log in or Create an account to join the conversation.
- scotta
- Offline
- Platinum Member
-
Less
More
- Posts: 959
- Thank you received: 489
1 year 4 months ago #330608
by scotta
Replied by scotta on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
Hi tuxcnc,
Have a bit more of a look at the module code.
1. Index count is captured in an ISR.
2. When the next servo period runs the module, the index input is set in the data packet so LinuxCNC knows that the index was detected.
3. The index count captured in the ISR is stored in the data packet.
On the LinuxCNC side, if the index enable hal pin is set and the phase Z input (the index input) then the the index count is set with the encoder count, the count that was captured in the ISR.
The ISR latency is the only potential timing miss match.
Have a bit more of a look at the module code.
1. Index count is captured in an ISR.
2. When the next servo period runs the module, the index input is set in the data packet so LinuxCNC knows that the index was detected.
3. The index count captured in the ISR is stored in the data packet.
On the LinuxCNC side, if the index enable hal pin is set and the phase Z input (the index input) then the the index count is set with the encoder count, the count that was captured in the ISR.
The ISR latency is the only potential timing miss match.
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Elite Member
-
Less
More
- Posts: 297
- Thank you received: 56
1 year 4 months ago - 1 year 4 months ago #330609
by tuxcnc
Replied by tuxcnc on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
Maybe I some don't know...
Maybe I do something wrong...
But :
Is the PV raw count?
Is the index some input?
Where is position captured at index ?
Maybe I do something wrong...
But :
Code:
root@HP-15:/temp/temppp# ls -n remora*
-rw-r--r-- 1 0 0 24206 2024-12-19 remora-eth-3.0.c
-rw-r--r-- 1 0 0 894 2024-12-19 remora-eth-3.0.h
root@HP-15:/temp/temppp# md5sum remora*
b447865ec7d51854e3baae2c9649fc65 remora-eth-3.0.c
4d64b37ed9177dbdb67f64479a2985f5 remora-eth-3.0.h
root@HP-15:/temp/temppp# cat remora-eth-3.0.c | grep comp_id,
comp_id, "%s.enable", prefix);
comp_id, "%s.reset", prefix);
comp_id, "%s.status", prefix);
comp_id, "%s.joint.%01d.pos-cmd", prefix, n);
comp_id, "%s.joint.%01d.vel-cmd", prefix, n);
comp_id, "%s.joint.%01d.enable", prefix, n);
comp_id, "%s.joint.%01d.pos-cmd", prefix, n);
comp_id, "%s.joint.%01d.vel-cmd", prefix, n);
comp_id, "%s.joint.%01d.freq-cmd", prefix, n);
comp_id, "%s.joint.%01d.pos-fb", prefix, n);
comp_id, "%s.joint.%01d.scale", prefix, n);
comp_id, "%s.joint.%01d.counts", prefix, n);
comp_id, "%s.joint.%01d.pgain", prefix, n);
comp_id, "%s.joint.%01d.ff1gain", prefix, n);
comp_id, "%s.joint.%01d.deadband", prefix, n);
comp_id, "%s.joint.%01d.maxaccel", prefix, n);
comp_id, "%s.SP.%01d", prefix, n);
comp_id, "%s.PV.%01d", prefix, n);
comp_id, "%s.output.%02d", prefix, n);
comp_id, "%s.input.%02d", prefix, n);
comp_id, "%s.input.%02d.not", prefix, n);
comp_id, "%s.NVMPGinput.%01d", prefix, n);
root@HP-15:/temp/temppp#
Is the index some input?
Where is position captured at index ?
Last edit: 1 year 4 months ago by tuxcnc. Reason: typos
Please Log in or Create an account to join the conversation.
- scotta
- Offline
- Platinum Member
-
Less
More
- Posts: 959
- Thank you received: 489
1 year 4 months ago #330660
by scotta
Replied by scotta on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
Hi tuxcnc,
The PRUencoder component is used.
github.com/scottalford75/Remora/tree/mai...omponents/PRUencoder
The PRUencoder component is used.
github.com/scottalford75/Remora/tree/mai...omponents/PRUencoder
Please Log in or Create an account to join the conversation.
- cakeslob
- Offline
- Platinum Member
-
Less
More
- Posts: 927
- Thank you received: 280
1 year 4 months ago #330662
by cakeslob
Replied by cakeslob on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
Hey tux, Im getting the feeling of deja vu. Didnt we go over this a few years ago? Its been explained both times, that this is how LINUXCNC does the threading, not just remora. You are also not the only person doing threading with the EC500, Remora, or LinuxCNC. Are you sure you have the encoders setup correctly? Ive seen you mention several times you dont know how to set up the index. Maybe it would be helpful to post your ini/hal/config.txt?
You shouldnt take it personally if we dont understand the issue you are having. If you dont like the way we conduct our selves, you are free to fork the project. This way, you do not need to feel like you are at the mercy of the author. No one needs to throw a tantrum, you can point out the issue, and if it is not addressed in a way acceptable to you, make a fork, and correct the issue and move on with your day. We appreciate your input on the issue, but dont take it personally if the issue isnt addressed in the way you want.
But you appear to be unsatisfied with every single one of the remora projects, and every opensource cnc project in general. Maybe the Remora project needs to learn by example. Feel free to fork the projects and show us how it should be managed.
I look forward to testing out your new project thought. All the best, and I assume the documentation and instructions will clear and not misleading. I have faith you will retain interest for more than 1 month before moving on.
You shouldnt take it personally if we dont understand the issue you are having. If you dont like the way we conduct our selves, you are free to fork the project. This way, you do not need to feel like you are at the mercy of the author. No one needs to throw a tantrum, you can point out the issue, and if it is not addressed in a way acceptable to you, make a fork, and correct the issue and move on with your day. We appreciate your input on the issue, but dont take it personally if the issue isnt addressed in the way you want.
But you appear to be unsatisfied with every single one of the remora projects, and every opensource cnc project in general. Maybe the Remora project needs to learn by example. Feel free to fork the projects and show us how it should be managed.
I look forward to testing out your new project thought. All the best, and I assume the documentation and instructions will clear and not misleading. I have faith you will retain interest for more than 1 month before moving on.
Please Log in or Create an account to join the conversation.
Time to create page: 0.473 seconds