ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Arduino rosserial - Long action results in: lost sync with device

asked 2022-06-03 09:40:30 -0500

SH gravatar image

I would like my Arduino Mega 2560 to subscribe to a topic that outputs coordinates. The Arduino controls a stepper motor, (NEMA17 + A4988) that then moves a platform to that coordinate.

I have noticed that the task of moving the platform takes too long, resulting in the error:

"Lost sync with device, restarting..."

I found that a delay(15000) is enough to give such an error. Similar questions regarding the error said that the spinOnce() is not called often enough. Does that mean that no action longer than 15 seconds can be performed by the Arduino?

Is this error ignorable? The connection is re-established after the task is finished.

Should I control the stepper in another way?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-06-04 23:33:56 -0500

videh_25 gravatar image

Well, if you keep serial_node waiting for some time, it will consider a sync loss since no information is received from the Arduino. You can of course perform tasks more than 15 seconds long, but just make sure to call spinOnce() in between, to ensure that serial_node stays in the loop. For example, if the stepper motor takes 15 secs to go from 0 deg to 150 deg, you can break the command into segments of 10 deg and add a spinOnce() in between. I don't think it will anyhow show up on the hardware, considering the spinOnce() call to be fast enough,

The answer to this post might help https://answers.ros.org/question/1123....

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-06-03 09:40:30 -0500

Seen: 124 times

Last updated: Jun 03 '22