Jump to content
OMRON Forums

Position reporting at 1 kHz


abhi

Recommended Posts

In Power Clipper, I want to report motor position to ethernet port / RS485 port at the rate of exactly 1000 samples per second in real time.

 

I suppose I can use internal timers for getting the exact time and use the commands "send" followed by "sendall" to ensure that the string is transmitted.

 

Is this the right way to do it ?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Ethernet and serial port access is not very deterministic, and the typical use case is writing your data to the port through a background C app. Even if you put your code in a 1kHz RTI (not recommended) you cannot achieve "exactly" 1kHz update; there will always be some small amount of jitter. The question is how much jitter is acceptable to you.

 

On previous projects I did some Ethernet benchmarking and was able to transfer 4k bytes of data using a TCP connection and the I/O time was roughly 0.6ms (observed jitter was +/- 0.1ms).

 

You can write a simple test by creating a background C application that opens a socket and writes your motor position to the socket every 1ms (use the usleep() function to wait 1ms between each loop iteration). If you are only sending a small amount of data on each write you may need to disable Nagle's algorithm using the setsockopt() function (see this link for more info: http://www.unixguide.net/network/socketfaq/2.16.shtml).

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...