Lost sync with device, restarting

Hello Diego,

In your code, You increased main loop time to 100ms, it is too long delay for processing incoming messages.

The line:

nh.spinOnce();

causes Core2 to process all incoming messages, this means read all messages and empty incoming buffer. If it is called less frequent, the serial buffer may get overflown and in consequence connection will break.

You have to options to choose, first is to decrease the loop time to 10ms, second option is to limit frequency of velocity command publisher.

Regards,
Łukasz