Hello Guest it is December 03, 2024, 03:16:33 AM

Author Topic: How fast can you send G90 and get accurate feedback on the current XYZ position  (Read 7774 times)

0 Members and 1 Guest are viewing this topic.

This is a situation that really requires you to have access to the realtime layer of the control.  (like guts of the ess)

Linuxcnc you can sense -> model -> act a _minimum_ of 1000 times a second.  (1ms) Because the realtime bits are actually in the computer - you can do this.

Or re-invent the wheel with an arduino or such.

sam
Hi skunkworks,
my apologies to OP if this is off topic.

skunkworks:
I have seen that Linux CNC uses RealTime Extensions to achieve realtime performance. I also saw a video where at the end of the
installation of the Linux distro (with the RTE's) to test the realtime performance. The video of the system under test reported
'a jitter of 23ms'. This was reported to be normal and adequate for LinuxCNC.

Can you clarify what it was that I saw, I would not have thought that a communication loop which included 23ms jitter would have been
anything like sufficient for a realtime feedback controller?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
23ms jitter would be bad...  (Unusable). My guess is that it was actually 23us of jitter.  This would be a average jitter for rtai real-time extensions.

Sam


Hi skunkworks,
my apologies to OP if this is off topic.

skunkworks:
I have seen that Linux CNC uses RealTime Extensions to achieve realtime performance. I also saw a video where at the end of the
installation of the Linux distro (with the RTE's) to test the realtime performance. The video of the system under test reported
'a jitter of 23ms'. This was reported to be normal and adequate for LinuxCNC.

Can you clarify what it was that I saw, I would not have thought that a communication loop which included 23ms jitter would have been
anything like sufficient for a realtime feedback controller?

Craig
Hi Sam,

Quote
My guess is that it was actually 23us of jitter
Yeah, that sounds better, I came away from watching that video a bit confused.....23ms jitter is rubbish, Mach4 and my ESS can beat that hands down
and even that is not fast enough for many applications.

Thanks for your reply.

My problem is that I don't really know anything about Linux thus much of the capabilities and flexibility of Linux and therefore LinuxCNC are beyond me.
I have a spare laptop and could be persuaded to install a Linux distro 'just for fun'.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
An update from this weekend.

I had originally ordered this rotary encoder https://www.robotshop.com/en/6mm-rotary-encoder-1024-p-r.html
For some reason the order failed to go through so I ended up ordering this one from Amazon. It's half the resolution but I just needed it for testing.
https://www.amazon.com/Signswise-Incremental-Encoder-Dc5-24v-Voltage/dp/B00UTIFCVA/ref=sr_1_1?s=hi&ie=UTF8&qid=1535373946&sr=8-1&keywords=Signswise+600&dpID=41%252BwuyVZcKL&preST=_SX300_QL70_&dpSrc=srch

I tried to use this IO board assuming it would work with the encoder
https://numato.com/product/8-channel-usb-gpio-module-with-analog-inputs

The Numato GPIO isn't nearly fast enough to keep up with the encoder and it was skipping ticks (readings or whatever).

I had a Arduino Uno that I ordered for another project but never used. I've never used Arduino and just assumed it would be super slow. I mean how fast can a $11 microcontroller be? Well, a heck of a lot faster than the Numato GPIO it turns out.
I used a couple of 10k resistors used the digitalWriteFast library found at https://code.google.com/archive/p/digitalwritefast/downloads and I was able to read every tick of the encoder without issue no matter how fast I turned it. I should have started off using the Arduino to begin with.[/img][/img]

My next problem was trying to get a gear that matched my rack (20 pitch, 20 pressure angle) with a 6mm bore. I know nothing about gears and assumed this would be easy, it wasn't. Even finding a gear that fit the rack was ridiculously hard. There's way more options to how a gear fits to another gear or rack than I imagined.  The only one I could find was on Amazon and it was out of stock. So I tried to order a gear from Grainger with a 20 pitch but a 14.5 pressure angle with an 8mm bore and hoped I could rig it up. Well, they sent the right box but the gear was wrong. I guess someone switch them or something so I was stuck.  

I thought I have a CNC why not just make one? Well, this turned out to be REALLY hard because its not straight forward. I ended up finding the site https://geargenerator.com/#200,200,100,6,1,0,0,4,1,8,2,4,27,-90,0,0,16,4,4,27,-60,1,1,12,1,12,20,-60,2,0,60,5,12,20,0,0,0,2,-563

I paid the $2, downloaded the svg. Converted it to EPS and imported it into ArtCam and cut it out of 1/2" polycarbonate. This turned out perfect, I get 0.005" resolution with it. I should have done this begin with. It would have saved me $25 from Grainger and numerous hours of research. Hind-sight is 20/20 though.

So that's all I was able to do this weekend. I'm going to try and find time next weekend. I'm pretty busy at work these days.


Encoder Gear:
https://drive.google.com/open?id=1FmpiZ8SHy31yYGcKkz6RTFFB5bpI9Ock
https://drive.google.com/open?id=1hm1z2rrhRfzgw8T3IWZb5HrzzyN9TS00
« Last Edit: August 27, 2018, 09:31:19 AM by stevesy »
Here's the Arduino Sketch for the encoder. Maybe someone might find it useful.
Code: [Select]

#include <digitalWriteFast.h>  // library for high performance reads and writes by jrraines
                               // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0
                               // and http://code.google.com/p/digitalwritefast/
 

// Quadrature encoder
#define c_EncoderPinA 8
#define c_EncoderPinB 7
volatile bool _EncoderASet;
volatile bool _EncoderBSet;
volatile long _EncoderTicks = 0;
volatile bool _lastATick;
volatile bool _lastBTick;

void setup()
{
  Serial.begin(115200);
 
  pinMode(c_EncoderPinA, INPUT);      // sets pin A as input
  digitalWrite(c_EncoderPinA, LOW);  // turn on pullup resistors
  pinMode(c_EncoderPinB, INPUT);      // sets pin B as input
  digitalWrite(c_EncoderPinB, LOW);  // turn on pullup resistors
 
}
 
void loop()
{
  _EncoderASet = digitalReadFast(c_EncoderPinA);   // read the input pin
  _EncoderBSet = digitalReadFast(c_EncoderPinB);   // read the input pin

 
   // If the previous and the current state of the outputA are different, that means a Pulse has occured
   if (_EncoderASet != _lastATick)
   {     
     // If the outputB state is different to the outputA state, that means the encoder is rotating clockwise
     if (_EncoderBSet != _EncoderASet) {
       _EncoderTicks ++;
     }
     else
     {
       _EncoderTicks --;
     }
     _lastATick = _EncoderASet;
     _lastBTick = _EncoderBSet;
     Serial.print(_EncoderTicks);
     Serial.print("\n");
   } 
}