-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serial port baud rates are dependent and restricted by the version of asio #2014
Comments
I'd rather not to reinvent the wheel with that termios (as it were here at early days...). |
That is true, but what is the alternative if we have to deal with hardcoded baud rates in ASIO? It worked well for me until now.
Ardupilot specifies literaly "Most stm32-based boards can support rates of up to 1500". Hardware-wise serial ports on modern controllers might work at 12.5 MBaud/s in PPP mode. On my end 1500000 bps and 2000000 bps work fine even with finicky cables. |
Well, you can just package up fresh version of the ASIO, or make a patched version. |
I would agree with @vooon that it's better not to re-write this all from scratch. The asio libraries are well optimised, it would be disservice to start from scratch. I would propose three options:
|
I feel there is a misunderstanding. No reason to start anything from scratch. ASIO does not aim to handle every aspect of serial communication, which is why it provides the native_handle() method for such things. BR, |
Issue details
Serial port baud rates are dependent and restricted by the version of asio. Particularly, in the serial_port_base.ipp some baud rates might be missing but still supported by the OS with termios/termios2/ioctl. In my case, it is the 1500000 baud rate which throws the Device exceptio within MAVROS but works fine if set manually. In the latest asio master it is still missing.
https://github.com/chriskohlhoff/asio/blob/62481a25be6cf78cbe714419a4462fd89bd84ab9/asio/include/asio/impl/serial_port_base.ipp#L93C8-L101C40
A proposed solution might be to split the try-catch in the serial device constructor into sections and try one more time with serial_dev.native_handle() and ioctl if the baud rate option causes an exception.
MAVROS version and platform
Mavros: N/A
ROS: N/A
Ubuntu: 22.04
Best regards,
Alex
The text was updated successfully, but these errors were encountered: