f1tenth / vesc

Repository for the VESC Controller (ROS1 and ROS2)
BSD 3-Clause "New" or "Revised" License
53 stars 77 forks source link

[Bug Fix] Use synchronous serial read #20

Closed HaoruXue closed 2 years ago

HaoruXue commented 2 years ago

As discovered by Mitsudome, the vesc state report and IMU report framerate is not stable. I find this to be related to how the serial driver in ROS2 transport driver handles async serial receive in which there are corrupted buffer data. This fix switches to sync receive and use the size of data received for copying into buffer. Framerate is tested to be stable at 50Hz for both IMU and vesc state.

This fix also brings back the old error handler in ROS1 version of the driver to signal transmission issues.

Also fixed:

mitsudome-r commented 2 years ago

It looks good to me. I have also tested with the real hardware and confirmed that the topic is now published at 50hz. I will leave @JWhitleyWork for the final code review

image