Closed amilcarlucas closed 2 years ago
I have replicated your use case with correct results, at the end I have the binary: https://asciinema.org/a/ECQ3Is1P9SvgiuWLaZNmX5ViO
Maybe the only difference is this part:
cd micro_ros_mbed
echo https://github.com/ARMmbed/mbed-os/\#mbed-os-6.10.0 > mbed-os.lib
mbed-tools deploy
mbed-tools compile -m DISCO_L475VG_IOT01A -t GCC_ARM
But I guess that this is part of mbed installation process. Let us know if it works and we can update the README.md
I did the changes you suggested but I get:
CMake Warning (dev) at /opt/ros/galactic/share/rosidl_typesupport_cpp/cmake/rosidl_typesupport_cpp_generate_interfaces.cmake:84 (add_library):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
Call Stack (most recent call first):
/micro_ros_mbed/micro_ros_dev/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
/micro_ros_mbed/micro_ros_src/install/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:16 (rosidl_generate_interfaces)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "3.5")
Call Stack (most recent call first):
/usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.19/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/opt/ros/galactic/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:133 (find_package)
/opt/ros/galactic/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:23 (find_package)
/micro_ros_mbed/micro_ros_dev/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
/micro_ros_mbed/micro_ros_src/install/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:16 (rosidl_generate_interfaces)
I do have python3 and python3-dev installed (3.8)
Make sure that your ROS 2 is not sourced. Also, make sure that you are not sourcing your ROS 2 installation in your .bashrc
.
Un-sourcing ROS2 did the trick:
unset ROS_VERSION
unset ROS_PYTHON_VERSION
unset AMENT_PREFIX_PATH
unset PYTHONPATH
unset LD_LIBRARY_PATH
unset ROS_LOCALHOST_ONLY
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
unset ROS_DISTRO
Thanks for the tip.
Can I ignore this error in the end:
[291/291] Linking CXX executable micro_ros_mbed.elf
-- built: /micro_ros_mbed/cmake_build/PORTENTA_H7_M7/develop/GCC_ARM/micro_ros_mbed.bin
-- built: /micro_ros_mbed/cmake_build/PORTENTA_H7_M7/develop/GCC_ARM/micro_ros_mbed.hex
| Module | .text | .data | .bss |
|--------------------|---------------|-------------|---------------|
| [fill] | 124(+124) | 7(+7) | 47(+47) |
| [lib]/c.a | 9880(+9880) | 2116(+2116) | 60(+60) |
| [lib]/gcc.a | 920(+920) | 0(+0) | 0(+0) |
| [lib]/microros.a | 44316(+44316) | 160(+160) | 9803(+9803) |
| [lib]/misc | 248(+248) | 4(+4) | 28(+28) |
| main.cpp.obj | 396(+396) | 0(+0) | 8(+8) |
| mbed-os/cmsis | 6998(+6998) | 168(+168) | 22112(+22112) |
| mbed-os/drivers | 1696(+1696) | 0(+0) | 0(+0) |
| mbed-os/hal | 1636(+1636) | 8(+8) | 114(+114) |
| mbed-os/platform | 6302(+6302) | 276(+276) | 464(+464) |
| mbed-os/rtos | 226(+226) | 0(+0) | 0(+0) |
| mbed-os/targets | 19408(+19408) | 13(+13) | 1564(+1564) |
| transports.cpp.obj | 462(+462) | 0(+0) | 2208(+2208) |
| Subtotals | 92612(+92612) | 2752(+2752) | 36408(+36408) |
Total Static RAM memory (data + bss): 39160(+39160) bytes
Total Flash memory (text + data): 95364(+95364) bytes
ERROR: No Mbed enabled devices found.
Well, I guess that ERROR: No Mbed enabled devices found.
means that it is not able to flash any device because the device is not recognized or the device is not connected.
Thanks. This can be closed now
Two small questions:
Two small questions:
- is CMake 3.19 really required? It is not available in any stable Ubuntu release.
If I remember well it is a mbed requirement, I should check. But micro-ROS do not need CMake 3.19. Let us know if you give a try.
- is there a technical reason why Ethernet transport is not supported on the PORTENTA_H7_M7 target? I would like to implement it, but if there is a technical reason why it will not work, then I would like to not waist my time.
No, there is not. We just implement serial transport for simplicity. You can implement networking transport using the mbed networking API. Here you have some info about micro-ROS external transports: https://micro.ros.org/docs/tutorials/advanced/create_custom_transports/ . In this case, you just need to implement a UDP transport in the client side because agent already supports UDP.
It would be super nice if you can contribute this work to this repo so other users can use mbed with micro-ROS network transports. Do not hesitate to open a new issue if you have any problem developing it.
BTW with network transport, you will need to disable the framing interface when setting the transport callbacks.
edit: more info here https://micro-xrce-dds.docs.eprosima.com/en/latest/transport.html
Issue template
Steps to reproduce the issue
On a Clean Ubuntu 20.04 LTS:
Expected behavior
Compiles with no errors
Actual behavior