micro-ROS / micro-ROS-Agent

ROS 2 package using Micro XRCE-DDS Agent.
Apache License 2.0
104 stars 63 forks source link

Agent does not start on Pi 4 UART5 #64

Closed Arnatious closed 2 years ago

Arnatious commented 3 years ago

Issue template

Steps to reproduce the issue

Expected behavior

Starting micro_ros_agent using ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyAMA1 -v6 starts and connects the agent.

Alternatively, if configuration steps are missing,

[1620270716.773237] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1620270716.773929] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 6

or similar prints followed by an error message

Actual behavior

Agent produces no text output and never connects. Connection on the pico end times out.

Additional information

[1620270716.773237] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1620270716.773929] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 6

does appear if minicom is open in another window on the same port, but the device still never connects to the pico. Closing minicom reverts to the aforementioned behavior.

Configuration steps may be missing? I'm not terribly familiar with the steps for serial comms on Linux. It appears the agent defaults to using a baud of 115200, which is correct, and checking with stty -F /dev/ttyAMA1 shows this setting is set by minicom and persists after minicom closes, so the above behavior doesn't line up.

pablogs9 commented 3 years ago

Verify serial communication is occurring using minicom: minicom -b 115200 -o -D /dev/ttyAMA1 - can see micro ros comms

Can you share the output of this?

Arnatious commented 3 years ago

Verify serial communication is occurring using minicom: minicom -b 115200 -o -D /dev/ttyAMA1 - can see micro ros comms

Can you share the output of this?

@pablogs9 in hex output mode:

7e 00 00 10 00 80 00 00 00 02 01 08 00 00 09 ff fd 02 00 00 00 fc 12

Repeated until the ping times out.

pablogs9 commented 3 years ago

Try to remove:

rcl_ret_t ret = rmw_uros_ping_agent(timeout_ms, attempts);

    if (ret != RCL_RET_OK)
    {
        // Unreachable agent, exiting program.
        return ret;
    }

and just init the micro-ROS RCLC.

pablogs9 commented 3 years ago

Any update on that?

Arnatious commented 3 years ago

Update: the issue appears to be centered around minicom. While using minicom does work, it seems to not clean up after itself and will leave in such a state that the agent will not display any output and hang when attempting to access the device if started after minicom.

Using screen to view the device seems to be safe, and interestingly, will fix the device so the agent will subsequently start up like normal. This is a workaround, but does not address what minicom does that conflicts with the agent.