eProsima / Micro-XRCE-DDS-Agent

Micro XRCE-DDS Agent respository. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
102 stars 72 forks source link

Baud rate is not set in SerialAgent on macOS #340

Open srmainwaring opened 10 months ago

srmainwaring commented 10 months ago

Overview

The Micro-XRCE-DDS-Agent does not support a hardware serial transport on macOS because the baudrate is not set correctly due to the linux specific conditional compilation flags:

which are set in:

https://github.com/eProsima/Micro-XRCE-DDS-Agent/blob/40954c2379dfcb2bfa9f6ba22146c57c6742b5b7/include/uxr/agent/utils/ArgumentParser.hpp#L1071-L1076

https://github.com/eProsima/Micro-XRCE-DDS-Agent/blob/40954c2379dfcb2bfa9f6ba22146c57c6742b5b7/src/cpp/transport/serial/MultiTermiosAgentLinux.cpp#L88-L93

https://github.com/eProsima/Micro-XRCE-DDS-Agent/blob/40954c2379dfcb2bfa9f6ba22146c57c6742b5b7/src/cpp/transport/serial/TermiosAgentLinux.cpp#L105-L110

The macOS implementation of termios.h does not define _HAVE_STRUCT_TERMIOS_C_ISPEED etc. One fix would be to modify the #if #endif check to:

#if _HAVE_STRUCT_TERMIOS_C_ISPEED || __APPLE__
            cfsetispeed(&new_attrs, termios_attrs_.c_ispeed);
#endif
#if _HAVE_STRUCT_TERMIOS_C_OSPEED || __APPLE__
            cfsetospeed(&new_attrs, termios_attrs_.c_ospeed);
#endif

Issue template

Steps to reproduce the issue

Expected behavior

Actual behavior

Additional information

pablogs9 commented 10 months ago

Hello Micro XRCE-DDS Agent does not provide support for macOS: https://micro-xrce-dds.docs.eprosima.com/en/latest/agent.html

If this is a small fix, please open a PR with your required changes, but we do not have plans for maintaining macOS platform.

srmainwaring commented 10 months ago

If this is a small fix, please open a PR with your required changes

Will do, it's a small change to the three files listed above.

but we do not have plans for maintaining macOS platform.

It's not a great deal of work to run the entire eProsima suite on macOS (micro-ROS agent, integration services, fast-dds spy etc). Mostly small fixes here and there such as https://github.com/eProsima/Integration-Service/pull/196. I have working branches with the required changes which I'd be happy to contribute.

pablogs9 commented 10 months ago

which I'd be happy to contribute.

That would be nice thanks!

srmainwaring commented 10 months ago

That would be nice thanks!

I've posted PRs for fixes to support Fast DDS spy and Fast DDS monitor on macOS. It's very useful to have the tools available natively on macs as docker networking is complicated to set up on macOS (because there is an extra VM involved).