Open DaFray31 opened 1 year ago
Hello,
I am trying to connect my pi pico w, with the docker agent in udp4 (using micro-ros + pico sdk).
Unfortunately using : rmw_uros_options_set_udp_address(), it fails to reach the agent (I run the container from wsl 2)
rmw_uros_options_set_udp_address()
So I try to use the rmw_uros_discover_agent() function as in the example here
rmw_uros_discover_agent()
Unfortunately this function does not exist. Is this normal?
Thanks in advance
Here are my different codes: Docker agent : docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:humble udp4 -p 9999 -d
docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:humble udp4 -p 9999 -d
file.cpp with trying to use rmw_uros_discover_agent()
file.cpp
#include <stdio.h> #include <rcl/rcl.h> #include <rcl/error_handling.h> #include <rclc/rclc.h> #include <rclc/executor.h> #include <std_msgs/msg/int32.h> #include <rmw_microros/rmw_microros.h> #include "pico/stdlib.h" #include "pico_uart_transports.h" #include "pico/cyw43_arch.h" [...] rcl_init_options_t init_options = rcl_get_zero_initialized_init_options(); rmw_init_options_t* rmw_options = rcl_init_options_get_rmw_init_options(&init_options); if(rmw_uros_discover_agent(rmw_options) != RCL_RET_OK){ printf("micro-ROS agent not found\n"); return 1; } printf("Agent found");
CMakeLists.txt :
CMakeLists.txt
cmake_minimum_required(VERSION 3.12) include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) project(pico_micro_ros_example C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) set(PICO_BOARD "pico_w") pico_sdk_init() link_directories(libmicroros) add_executable(pico_micro_ros_example pico_micro_ros_example.c pico_uart_transport.c ) target_link_libraries(pico_micro_ros_example pico_stdlib microros pico_cyw43_arch_lwip_poll ) target_include_directories(pico_micro_ros_example PUBLIC libmicroros/include ) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") # Configure Pico pico_enable_stdio_usb(pico_micro_ros_example 1) pico_enable_stdio_uart(pico_micro_ros_example 0) add_compile_definitions(PICO_UART_ENABLE_CRLF_SUPPORT=0) add_compile_definitions(PICO_STDIO_ENABLE_CRLF_SUPPORT=0) add_compile_definitions(PICO_STDIO_DEFAULT_CRLF=0) # Generate UF2 pico_add_extra_outputs(pico_micro_ros_example)
file.cpp trying to use rmw_uros_options_set_udp_address() :
[...] rcl_init_options_t init_options = rcl_get_zero_initialized_init_options(); rmw_init_options_t* rmw_options = rcl_init_options_get_rmw_init_options(&init_options); if(rmw_uros_options_set_udp_address("172.16.180.236","9999", rmw_options) != RMW_RET_OK){ printf("micro-ROS agent not found\n"); cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); sleep_ms(1000); cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); sleep_ms(1000); cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); sleep_ms(1000); cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); return 1; } printf("Agent found");
Hi @DaFray31, if you want to wirelessly connect with RPi Pico W using micro-ROS, check out these repos. I hope it will help :wink:
Hello,
I am trying to connect my pi pico w, with the docker agent in udp4 (using micro-ros + pico sdk).
Unfortunately using :
rmw_uros_options_set_udp_address()
, it fails to reach the agent (I run the container from wsl 2)So I try to use the
rmw_uros_discover_agent()
function as in the example hereUnfortunately this function does not exist. Is this normal?
Thanks in advance
Here are my different codes: Docker agent :
docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:humble udp4 -p 9999 -d
file.cpp
with trying to usermw_uros_discover_agent()
CMakeLists.txt
:file.cpp
trying to usermw_uros_options_set_udp_address()
: