Skip to content
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

rclc_parameter_server_init_default returns RCL_RET_ERROR #85

Open
ALUIS97 opened this issue Jan 11, 2023 · 8 comments
Open

rclc_parameter_server_init_default returns RCL_RET_ERROR #85

ALUIS97 opened this issue Jan 11, 2023 · 8 comments

Comments

@ALUIS97
Copy link

ALUIS97 commented Jan 11, 2023

image

I am trying to set a parameter server with a nucleo stm32f4 board , I already changed the values in colcon.meta (as said here https://micro.ros.org/docs/tutorials/programming_rcl_rclc/parameters/#callback) but the function is returning an error, although my program can continue rc = rclc_executor_spin(&executor); also returns RCL_RET_ERROR and goes out and I can not see the parameters of my micro ros app from the command ros2 param list .
I am using the FOXY distribution

@pablogs9
Copy link
Member

Could you share your colcon.meta and rmw_microxrcedds/config.h?

@ALUIS97
Copy link
Author

ALUIS97 commented Jan 11, 2023

config_h.txt
colcon_meta.txt
By the way I set up my environment with static library IDE and DMA transport for serial comunication

@pablogs9
Copy link
Member

Could you share the micro-ROS Agent output with the flag -v6?

@ALUIS97
Copy link
Author

ALUIS97 commented Jan 12, 2023

micro_ros_agent_v6.txt
here it is

@pablogs9
Copy link
Member

An finally, can you share you micro-ROS client code?

@ALUIS97
Copy link
Author

ALUIS97 commented Jan 14, 2023

micro_ros_client.txt

@zijian-x
Copy link

zijian-x commented Nov 1, 2024

Is there a fix/update on this? I'm having this issue as well trying to add a parameter server on the f767zi nucleo board.

@zijian-x
Copy link

zijian-x commented Nov 1, 2024

[1] ⤷ cat micro_ros_stm32cubemx_utils/microros_static_library/library_generation/colcon.meta
{
    "names": {
        "tracetools": {
            "cmake-args": [
                "-DTRACETOOLS_DISABLED=ON",
                "-DTRACETOOLS_STATUS_CHECKING_TOOL=OFF"
            ]
        },
        "rosidl_typesupport": {
            "cmake-args": [
                "-DROSIDL_TYPESUPPORT_SINGLE_TYPESUPPORT=ON"
            ]
        },
        "rcl": {
            "cmake-args": [
                "-DBUILD_TESTING=OFF",
                "-DRCL_COMMAND_LINE_ENABLED=OFF",
                "-DRCL_LOGGING_ENABLED=OFF"
            ]
        },
        "rcutils": {
            "cmake-args": [
                "-DENABLE_TESTING=OFF",
                "-DRCUTILS_NO_FILESYSTEM=ON",
                "-DRCUTILS_NO_THREAD_SUPPORT=ON",
                "-DRCUTILS_NO_64_ATOMIC=ON",
                "-DRCUTILS_AVOID_DYNAMIC_ALLOCATION=ON"
            ]
        },
        "microxrcedds_client": {
            "cmake-args": [
                "-DUCLIENT_PIC=OFF",
                "-DUCLIENT_PROFILE_UDP=OFF",
                "-DUCLIENT_PROFILE_TCP=OFF",
                "-DUCLIENT_PROFILE_DISCOVERY=OFF",
                "-DUCLIENT_PROFILE_SERIAL=OFF",
                "-UCLIENT_PROFILE_STREAM_FRAMING=ON",
                "-DUCLIENT_PROFILE_CUSTOM_TRANSPORT=ON"
            ]
        },
        "rmw_microxrcedds": {
            "cmake-args": [
                "-DRMW_UXRCE_MAX_NODES=1",
                "-DRMW_UXRCE_MAX_PUBLISHERS=10",
                "-DRMW_UXRCE_MAX_SUBSCRIPTIONS=8",
                "-DRMW_UXRCE_MAX_SERVICES=5",
                "-DRMW_UXRCE_MAX_CLIENTS=1",
                "-DRMW_UXRCE_MAX_HISTORY=4",
                "-DRMW_UXRCE_TRANSPORT=custom"
            ]
        }
    }
}

[1] ⤷ cat micro_ros_stm32cubemx_utils/microros_static_library/libmicroros/microros_include/rmw_microxrcedds_c/config.h
#ifndef RMW_MICROXRCEDDS_CONFIG_H
#define RMW_MICROXRCEDDS_CONFIG_H

#include <uxr/client/config.h>

/* #undef RMW_UXRCE_TRANSPORT_UDP */
/* #undef RMW_UXRCE_TRANSPORT_TCP */
/* #undef RMW_UXRCE_TRANSPORT_SERIAL */
#define RMW_UXRCE_TRANSPORT_CUSTOM
/* #undef RMW_UXRCE_TRANSPORT_IPV4 */
/* #undef RMW_UXRCE_TRANSPORT_IPV6 */
/* #undef RMW_UXRCE_USE_REFS */
/* #undef RMW_UXRCE_ALLOW_DYNAMIC_ALLOCATIONS */
/* #undef RMW_UXRCE_GRAPH */
/* #undef RMW_UROS_ERROR_HANDLING */

#ifdef RMW_UXRCE_TRANSPORT_UDP
    #define RMW_UXRCE_MAX_TRANSPORT_MTU UXR_CONFIG_UDP_TRANSPORT_MTU
    #define RMW_UXRCE_DEFAULT_IP ""
    #define RMW_UXRCE_DEFAULT_PORT ""
#elif defined(RMW_UXRCE_TRANSPORT_TCP)
    #define RMW_UXRCE_MAX_TRANSPORT_MTU UXR_CONFIG_TCP_TRANSPORT_MTU
    #define RMW_UXRCE_DEFAULT_IP ""
    #define RMW_UXRCE_DEFAULT_PORT ""
#elif defined(RMW_UXRCE_TRANSPORT_SERIAL)
    #define RMW_UXRCE_MAX_TRANSPORT_MTU UXR_CONFIG_SERIAL_TRANSPORT_MTU
    #define RMW_UXRCE_DEFAULT_SERIAL_DEVICE ""
#elif defined(RMW_UXRCE_TRANSPORT_CUSTOM)
    #define RMW_UXRCE_MAX_TRANSPORT_MTU UXR_CONFIG_CUSTOM_TRANSPORT_MTU
#endif

#define RMW_UXRCE_ENTITY_CREATION_TIMEOUT 1000
#define RMW_UXRCE_ENTITY_DESTROY_TIMEOUT 1000

/* #undef RMW_UXRCE_STREAM_HISTORY_INPUT */
/* #undef RMW_UXRCE_STREAM_HISTORY_OUTPUT */
#if defined(RMW_UXRCE_STREAM_HISTORY_INPUT) && defined(RMW_UXRCE_STREAM_HISTORY_OUTPUT)
#undef RMW_UXRCE_STREAM_HISTORY_INPUT
#undef RMW_UXRCE_STREAM_HISTORY_OUTPUT
#define RMW_UXRCE_STREAM_HISTORY_INPUT
#define RMW_UXRCE_STREAM_HISTORY_OUTPUT
#else
#define RMW_UXRCE_STREAM_HISTORY_INPUT 4
#define RMW_UXRCE_STREAM_HISTORY_OUTPUT 4
#endif

#define RMW_UXRCE_PUBLISH_RELIABLE_TIMEOUT 1000

#define RMW_UXRCE_MAX_HISTORY 4
#define RMW_UXRCE_MAX_INPUT_BUFFER_SIZE (RMW_UXRCE_MAX_TRANSPORT_MTU * RMW_UXRCE_STREAM_HISTORY_INPUT)
#define RMW_UXRCE_MAX_OUTPUT_BUFFER_SIZE (RMW_UXRCE_MAX_TRANSPORT_MTU * RMW_UXRCE_STREAM_HISTORY_OUTPUT)

#define RMW_UXRCE_MAX_SESSIONS 1
#define RMW_UXRCE_MAX_OPTIONS RMW_UXRCE_MAX_SESSIONS*3
#define RMW_UXRCE_MAX_NODES 1
#define RMW_UXRCE_MAX_PUBLISHERS 10
#define RMW_UXRCE_MAX_SUBSCRIPTIONS 8
#define RMW_UXRCE_MAX_SERVICES 5
#define RMW_UXRCE_MAX_CLIENTS 1
#define RMW_UXRCE_MAX_TOPICS -1
#define RMW_UXRCE_MAX_WAIT_SETS 4
#define RMW_UXRCE_MAX_GUARD_CONDITION 4

#if RMW_UXRCE_MAX_TOPICS == -1
#define RMW_UXRCE_MAX_TOPICS_INTERNAL RMW_UXRCE_MAX_PUBLISHERS + RMW_UXRCE_MAX_SUBSCRIPTIONS
#else
#define RMW_UXRCE_MAX_TOPICS_INTERNAL RMW_UXRCE_MAX_TOPICS
#endif

#define RMW_UXRCE_NODE_NAME_MAX_LENGTH 60
#define RMW_UXRCE_TOPIC_NAME_MAX_LENGTH 60
#define RMW_UXRCE_TYPE_NAME_MAX_LENGTH 100

#define RMW_UXRCE_ENTITY_NAMING_BUFFER_LENGTH 100

#endif  // RMW_MICROXRCEDDS_CONFIG_H

transport:


bool cubemx_transport_open(struct uxrCustomTransport* transport);
bool cubemx_transport_close(struct uxrCustomTransport* transport);
size_t cubemx_transport_write(struct uxrCustomTransport* transport,
                              const uint8_t* buf, size_t len, uint8_t* err);
size_t cubemx_transport_read(struct uxrCustomTransport* transport, uint8_t* buf,
                             size_t len, int timeout, uint8_t* err);

void* microros_allocate(size_t size, void* state);
void microros_deallocate(void* pointer, void* state);
void* microros_reallocate(void* pointer, size_t size, void* state);
void* microros_zero_allocate(size_t number_of_elements, size_t size_of_element,
                             void* state);

static rcl_node_t node;
static rcl_allocator_t allocator;
static rclc_support_t support;

void init(void* arg) {
  UART_HandleTypeDef* huart3 = (UART_HandleTypeDef*)arg;
  rmw_uros_set_custom_transport(true, (void*)huart3, cubemx_transport_open,
                                cubemx_transport_close, cubemx_transport_write,
                                cubemx_transport_read);

  rcl_allocator_t freeRTOS_allocator = rcutils_get_zero_initialized_allocator();
  freeRTOS_allocator.allocate = microros_allocate;
  freeRTOS_allocator.deallocate = microros_deallocate;
  freeRTOS_allocator.reallocate = microros_reallocate;
  freeRTOS_allocator.zero_allocate = microros_zero_allocate;

  if (!rcutils_set_default_allocator(&freeRTOS_allocator))
    printf("Error on default allocators (line %d)\n", __LINE__);

  allocator = rcl_get_default_allocator();
  rclc_support_init(&support, 0, NULL, &allocator);
  rclc_node_init_default(&node, "micro_ros_node", "", &support);
}


static library is compiled via docker in the newest jazzy branch with tag 5.0.1

RCL_RET_ERROR at:

rclc_parameter_server_t param_server;
rclc_parameter_server_init_default(&param_server, node);

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

3 participants