micro_ros_setup
micro_ros_setup copied to clipboard
Messages not being published or agent not running
Hello everyone!
I am trying to get started with Micro-ROS, so I got one of the officially supported boards, the Espressif ESP32-WROOM-32E.
Steps that led to the problem
I followed this tutorial, except they use the Olimex STM32-E407 evaluation board, so to create the firmware I used this line
ros2 run micro_ros_setup create_firmware_ws.sh freertos esp32
as they did here. I don't really need wireless communication, serial is fine for my application; so except for that line, I followed everything else according to that first tutorial.
Everything went well up to the part where you run the micro-ROS agent.
# Run a micro-ROS agent
ros2 run micro_ros_agent micro_ros_agent serial --dev [device]
I use this command to find my serial device name: ls /dev/serial/by-id/*
What I get is: /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_b20cb0bd8019ec11ad010fb5f01c6278-if00-port0
The problem
So I run the micro-ROS agent with the device name I got above. This is how it looks:
Then, I try to echo the topic in another window and as you can see in the image below, the topic is not published.
Expected behavior
While the messages stop for me after init and set_vebose_level, other tutorials show more steps, such as topic created, publisher created, etc. Here's a picture taken from the second tutorial I mentioned; although they use wifi there, so I'm not sure what to expect in my case, but probably something similar.
While echoing the topic, I would expect to see this:
Solutions I already tried but didn't solve the problem
First, trying to visualize the output with the flag -v6 didn't do much other than changing the verbose level shown.
Using ROS_DOMAIN_ID=30 also didn't change anything
I also followed this advice and unplugged the cable on both ends and within 2 seconds I ran:
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_b20cb0bd8019ec11ad010fb5f01c6278-if00-port0 -b 115200 -v6
But still, nothing changed nor it showed anything on rqt.
Here they also suggested pressing the reset button but that didn't work either.
Finally, I tried using the dockerized version of the micro-ROS Agent, as recommended here. Unfortunately, I still had the same problem. Images below.
As you can see, I've been trying to solve this issue for quite some time. If you have any more ideas or can detect something wrong with my approach, I'd appreciate your input.
Perhaps you guys have an idea about what's wrong? @Kakcalu13 @pablogs9 @nfry321 @MARLARCHAN
System information
- OS: Ubuntu 20.04.4
- ROS 2 Foxy
- ESP32-WROOM-32E
Please move to the ESP-IDF module for micro-ROS in order to develop ESP32 applications with micro-ROS: https://github.com/micro-ROS/micro_ros_espidf_component.
Please report if you find any problem using the module with ESP 32 serial transport.
Hello!
Sorry for the late update. I had to focus on other parts of the robot for a while. I started over the tutorials mentioned above and this time they worked fine. I didn't have any problems anymore. Perhaps it was a matter of flashing the firmware again.
Then I moved to the ESP-IDF module as @pablogs9 suggested and the example int32_publisher. (I am a newbie with ESP-IDF so this tutorial helped me get started). I then configured the WiFi settings and after executing idf.py monitor
it threw an error. These are the last lines printed on the terminal:
I (1592) wifi_station_netif: got ip:1XX.1XX.1XX.XX
I (1592) wifi_station_netif: connected to ap SSID:****** password:******
Failed status on line 54: 1. Aborting.
I actually want to communicate through UART instead of WiFi, so I moved on and went to change the transport method by idf.py menuconfig
and in micro-ROS Settings->micro-ROS network interface select
I changed it to Micro XRCE_DD over UART
. I noticed though that it also said: Check int32_publisher_custom_transport
. So I used the code in micro_ros_espidf_component/examples/int32_publisher_custom_transport
When building though, it fails. These are the last lines printed on terminal:
In file included from ../main/main.c:19:
../main/esp32_serial_transport.h:23:31: warning: 'struct uxrCustomTransport' declared inside parameter list will not be visible outside of this definition or declaration
bool esp32_serial_open(struct uxrCustomTransport * transport);
^~~~~~~~~~~~~~~~~~
../main/esp32_serial_transport.h:24:32: warning: 'struct uxrCustomTransport' declared inside parameter list will not be visible outside of this definition or declaration
bool esp32_serial_close(struct uxrCustomTransport * transport);
^~~~~~~~~~~~~~~~~~
../main/esp32_serial_transport.h:25:34: warning: 'struct uxrCustomTransport' declared inside parameter list will not be visible outside of this definition or declaration
size_t esp32_serial_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
^~~~~~~~~~~~~~~~~~
../main/esp32_serial_transport.h:26:33: warning: 'struct uxrCustomTransport' declared inside parameter list will not be visible outside of this definition or declaration
size_t esp32_serial_read(struct uxrCustomTransport* transport, uint8_t* buf, size_t len, int timeout, uint8_t* err);
^~~~~~~~~~~~~~~~~~
../main/main.c: In function 'app_main':
../main/main.c:97:2: error: #error micro-ROS transports misconfigured
#error micro-ROS transports misconfigured
^~~~~
At top level:
../main/main.c:83:15: warning: 'uart_port' defined but not used [-Wunused-variable]
static size_t uart_port = UART_NUM_0;
^~~~~~~~~
[1030/1039] Building C object esp-idf/lib...to_core/ed25519/ref10/ed25519_ref10.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
I'm not sure how to proceed. Any tips regarding this problem?
I am using Ubuntu 20.04 and ROS2 Foxy.
UPDATE: I realized this code is for Humble. I switched to Foxy and got this error. I'm looking into it.
I've been battling with this error for a while. At this point, I'm wondering: if this method works https://micro.ros.org//docs/tutorials/core/first_application_rtos/freertos/ what's the advantage of using this module https://github.com/micro-ROS/micro_ros_espidf_component ?
UPDATE: I realized this code is for Humble. I switched to Foxy and got this error. I'm looking into it.
The link is not leading to any error. As your error on Humble
looks related to a miss configuration on micro-ROS selected transport on our side, we will look into it.
what's the advantage of using this module.
micro_ros_setup
is going to be deprecated in favor of vendor specific build systems.
Thank you very much for your reply. I'm sorry for the wrong link, I corrected it. In that link I also posted the errors I had when trying to solve it. While the error is solved for foxy
, I'll use micro_ros_setup
in the meantime. Is it possible to do multitasking with micro_ros_setup
?