ros_ethercat
ros_ethercat copied to clipboard
separate hardware read and write
There is a function void EthercatHardware::update(bool reset, bool halt) that does both read and write in Ethercat. The real-time loop should be:
while(true) { read from sensors update controllers write to actuators wait until 1 msec has passed }
But what happens instead is
while(true) { read from sensors write to actuators update controllers wait until 1 msec has passed }
That means when a discrete-time PID controller is tuned it must assume a sample-period of 1msec and a latency of 1msec. That's because the controller action calculated for current sensor readings will actually be applied in the next iteration. That means the tuning has to be less aggressive (less responsive control) compared to almost zero latency. Split the EthercatHardware::update to read and write function.