Open DwayneGit opened 1 year ago
Hello @DwayneGit multithreading is not supported in RPi Pico SDK, you need to implement lockings in middleware here: https://github.com/eProsima/Micro-XRCE-DDS-Client/blob/master/src/c/profile/multithread/multithread.c and rebuild the library with UCLIENT_PROFILE_MULTITHREAD
enabled in colcon.meta for Micro XRCE-DDS Client.
@pablogs9 Thanks for the reply! Not sure what you mean by "you need to implement lockings in middleware". Is there more that this file needs or is it just copying the file into my project since it seems that the library already has some connection to it like here: https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk/blob/humble/libmicroros/include/uxr/client/profile/multithread/multithread.h
In this file only locks for PLATFORM_NAME_FREERTOS
, UCLIENT_PLATFORM_ZEPHYR
, and UCLIENT_PLATFORM_POSIX
are implemented. Does your platform support creating mutex somehow?
Yes. looks like the pico sdk does support mutex, lock and semaphore https://raspberrypi.github.io/pico-sdk-doxygen/group__pico__sync.html. So i guess i need to implement the contents of the multithread.c using the pico sdk library?
That's it, it would be great if you open a PR to Micro XRCE-DDS Client with your changes
Sure, I'll get on that
Hello,
I am pretty new to micro-ROS and trying to create two nodes on separate cores.
I have been over the examples of of multi-threading and multiple nodes from the micro-ros demo examples but i have not seen anything on using those libraries here and there is nothing for this specific application.
I have managed to create the code below. it creates two nodes on the main thread and passes one node, the support, and allocator to core1 via queue to handle all the none shared initializations.
This is the closes i come to a working setup. the nodes seem to work fine except that you can not initialize subscribers or publishers on both nodes. so i would need to comment out
rclc_timer_init_default
forrclc_publisher_init_default
to work. timers dont seem to be effect by this. It will abort with aRCL_RET_ERROR
if both are attempted.Please let me know what i am doing wrong or if this is even possible or if something isn't clear. Thank you
PS. I already recompiled the library with
#define RMW_UXRCE_MAX_NODES 2