Skip to content

Unexpected behavior of reconnection example #912

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

Closed
Johannap1 opened this issue Apr 3, 2022 · 7 comments
Closed

Unexpected behavior of reconnection example #912

Johannap1 opened this issue Apr 3, 2022 · 7 comments

Comments

@Johannap1
Copy link

  • Hardware description: ESP32dev
  • microros arduino + platformio
  • Version or commit hash: ROS2 foxy

Hello,

I tried out the reconnection example because I want to use something similar for my application, but it is not working as I would expect it to work.

What is happening for me is that rmw_uros_ping_agent only returns RMW_RET_OK when the entities have not yet been created. As soon as I create the entities, rmw_uros_ping_agent returns an error, even thought the agent is still running. Running the example this way causes just a continuous creation and destruction of the entities and the system never starts spinning the executor.

What I would expect is that rmw_uros_ping_agent returns a true value as long as the agent is connected, then creates the entities once and at each later iteration spins the executor. The entities should only be destroyed once the connection to the agent is actually lost.

Please let me know if I understand correct that this behavior is not desired and if you have any ideas on how to fix this issue. I already tried increasing the timeout and number of connection tries but that does not change the behavior. I also tried modifying the colcon.meta as suggested here , but that also did not change anything.

Thanks!

@pablogs9
Copy link
Member

pablogs9 commented Apr 4, 2022

Which version of the library and the agentt are you using?
Make sure that you are using the latest commit of this library and also that you are using the latest version of the agent.

@Johannap1
Copy link
Author

Johannap1 commented Apr 4, 2022

I just updated my version of the agent. For the library, I import it using platformio as it is also stated on the README of this repository:

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
board = esp32dev
framework = arduino
lib_deps =
    https://github.com/micro-ROS/micro_ros_arduino.git
build_flags =
    -L ./.pio/libdeps/esp32dev/micro_ros_arduino/src/esp32/
    -l microros
    -D ESP32

platform_packages =
  toolchain-xtensa32 @ ~2.80400.0
  framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.2

I also just tried creating a new blank project and then adding the reconnection example code, but the issue remains.

Could it be related to the fact that we are using ROS2 foxy and not galactic?

@pablogs9
Copy link
Member

pablogs9 commented Apr 4, 2022

no, but make sure that you are using the latest commit of the foxy branch.

@Acuadros95 does the last release (2.0.4) includes the modifications on the XRCE ping behavior?

@Johannap1
Copy link
Author

Yes, I checked that we are using the latest commit so that should not be the issue, see below:

image

@pablogs9
Copy link
Member

pablogs9 commented Apr 4, 2022

Can you give a try to this reimplementation of the reconnection example? #913

I have tried both (old and #913) using serial transport, a Teensy 4 and launching the agent with:

docker run -it --rm -v /dev:/dev --privileged microros/micro-ros-agent:foxy serial --dev /dev/serial/by-id/usb-Teensyduino_USB_Serial_8224100-if00 -b 115200 -v6

And both works, can you test this?

@Johannap1
Copy link
Author

Thanks, this works now for me. Also with both the old and new version of it. So I think it is the way that I started up the agent

normally I just run it without the docker using

ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0

Can you tell me what the difference is, please?

@pablogs9
Copy link
Member

pablogs9 commented Apr 4, 2022

Well, using this command you are using a local workspace where the agent is built. Probably you need to recreate the micro-ROS Agent and rebuild it in order to have the latest version.

The docker usually has the latest version precompiled.

I'm closing please reopen if you have any other questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants