Closed MertAdak closed 1 year ago
Hello, your board is not connecting to the micro-ROS Agent. Have you tried to connect and reset your board?
Hello again, Yes I reconnected and reset the board but both didn't work. Even I flashed the binary file again nothing has changed. The steps I followed:
1) make -j$(nproc)
2) sudo lm4flash gcc/microros_tivac.bin
output:
3) I sourced the local_setup.bash in my micro-ros workspace seperated from the launchpad folder to use the micro-ros commands in the terminal
4) I run the following command: ros2 run micro_ros_agent micro_ros_agent serial --dev "/dev/serial/by-id/usb-Texas_Instruments_In-Circuit_Debug_Interface_0E236050-if00" --verbose 6
output:
5) I opened another terminal and sourced ros2 to run 'ros2 topic list' output:
Resetting, reconnecting, reflashing the binary file didn't work. Do you have any idea about my situation?
Thank you for your reply
I also get error about rsync even if it is already installed on my computer.
I believe generate_microros_library.sh
script does not run correctly. While it was running, terminal gives so many rsync error due to absence of some files. I believe, because of this problem, program creates a binary file without some properties for communication with the micro_ros_agent. The error on the terminal is the following
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/common_interfaces/common_interfaces" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/microcdr/microcdr" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/microxrcedds_client/microxrcedds_client" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rcl_logging_noop/rcl_logging_noop" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rclc/rclc" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rclc_lifecycle/rclc_lifecycle" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rclc_parameter/rclc_parameter" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rmw_implementation/rmw_implementation" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rmw_implementation_cmake/rmw_implementation_cmake" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rmw_microxrcedds/rmw_microxrcedds" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/ros2trace/ros2trace" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_adapter/rosidl_adapter" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_cli/rosidl_cli" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_cmake/rosidl_cmake" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_default_generators/rosidl_default_generators" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_default_runtime/rosidl_default_runtime" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_generator_c/rosidl_generator_c" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_generator_cpp/rosidl_generator_cpp" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_parser/rosidl_parser" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_runtime_cpp/rosidl_runtime_cpp" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_cpp/rosidl_typesupport_cpp" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_introspection_tests/rosidl_typesupport_introspection_tests" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_microxrcedds_c/rosidl_typesupport_microxrcedds_c" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_microxrcedds_c_tests/rosidl_typesupport_microxrcedds_c_tests" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_microxrcedds_cpp/rosidl_typesupport_microxrcedds_cpp" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_microxrcedds_cpp_tests/rosidl_typesupport_microxrcedds_cpp_tests" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/rosidl_typesupport_microxrcedds_test_msg/rosidl_typesupport_microxrcedds_test_msg" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/sensor_msgs_py/sensor_msgs_py" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/test_interface_files/test_interface_files" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/test_rmw_implementation/test_rmw_implementation" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/test_tracetools/test_tracetools" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/test_tracetools_launch/test_tracetools_launch" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/tracetools_launch/tracetools_launch" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/tracetools_read/tracetools_read" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/tracetools_test/tracetools_test" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/tracetools_trace/tracetools_trace" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]`
I also watched the ROS2 Embedded Working Group meeting #18 from youtube and I followed the steps of the launchpad from github and still can't be able to build and run correctly.
Can you please help me? If you want we can schedule a meeting and I can show you my screen and the steps I followed. Maybe we can quickly find the problem by doing this.
Thank you so much for your interest, Mert Adak
Are you sure that you are flashing correctly? Can you modify the source code to, for example, blink a led to ensure that your board is alive?
Hello again,
Yes I tried it. My board looks fine and alive. I also believe that I am flashing correctly. I can't see where the problem occurs.
Thank you for your support.
After flashing the blinky.bin from the examples that ti provided, led on the board started blinking. After flashing:
As you can see, board is alive. I believe some file operations in generate_microros_library.sh is not working properly for my computer but i'm still not sure. Is there anything you can think that i'm doing wrong?
Thank you, Mert Adak
Hello again, I want to share another errors:
I also got these errors (It was too long and all of them was same, that's why I copied some, not all):
./microros/generate_microros_library.sh: line 120: -ar: command not found mv: cannot stat '*': No such file or directory ./microros/generate_microros_library.sh: line 120: -ar: command not found mv: cannot stat '*': No such file or directory ./microros/generate_microros_library.sh: line 120: -ar: command not found mv: cannot stat '*': No such file or directory ./microros/generate_microros_library.sh: line 120: -ar: command not found mv: cannot stat '*': No such file or directory ./microros/generate_microros_library.sh: line 120: -ar: command not found mv: cannot stat '*': No such file or directory ./microros/generate_microros_library.sh: line 120: -ar: command not found
After end of this error block, I got this error:
cp: cannot stat 'libmicroros.a': No such file or directory ranlib: '/home/mert/micro_ros_tivac_launchpad_app/install/libmicroros.a': No such file
I can't figure out the problem, tried everything. I hope these error will give you an idea about my problem.
Thank you for your support, Mert Adak
There are some missing files and directories that you used to generate microros library in humble branch.
For example, in the generate_microros_library.sh, it clones the rcl_logging repository from github with humble branch. In the deeper parts of the script, it tries to use this repository but rcl_logging_log4cxx directory is not available for humble branch. So it gives an error like no such file or no such directory.
This is not the only missing folder. I think you should update this script for humble branch. Because of these missing files, project is not creating a binary file with the microros feature. As a result, I cannot communicate with the microros agent that I instantiated on the board.
I switched to the ROS2 Galactic on Ubuntu 20.04 and tried to build the project because the missing folders are available on galactic branch. I built the project successfully without the errors I posted above.
But still, when I create the microros agent on the microcontroller with the command: ros2 run micro_ros_agent micro_ros_agent serial --dev "/dev/serial/by-id/usb-Texas_Instruments_In-Circuit_Debug_Interface_0E236050-if00" --verbose 6
, there is no sign of communication happens on the terminal that I instantiated the agent. The terminal screenshot:
What should do to see whether I can communicate with the agent? Because I believe, agent creation is successful but agent stays idle. Is there any command to send a message to the agent instantiated on board?
Thank you, Mert Adak
I solved the issue, it was very simple.
Now I have a microros related problem. I trying to assign two publisher topics to my node but when I do that, program breaks. I did the following changes:
When I run the agent on the board it gives errors like this and node crushes (I cant see it when i write ros2 node list command on terminal):
I also changed the handles parameter of rclc_executer_init to 2 but it also didn't work for me. How can I solve this problem?
Build the library with the correct number of entities that you are going to use: https://github.com/micro-ROS/micro_ros_tivac_launchpad_app/blob/d9ec6fe0bbee9cddfd30112a93e83db87c486e4f/microros/colcon.meta#L46
Also in your rclc_executor_init
you are using 1 handles and then adding 2 timers. Please read the RCLC documentation: https://github.com/ros2/rclc/blob/442c4e84bf9ce9c819aa371b2d01e0c4e0835e06/rclc/include/rclc/executor.h#L135
Thank you for your reply. I made those changes and this time, when I instantiated micro-ROS agent on the board, my node and it's associated topics are created. But this time topics are not publishing anything. When I type ros2 topic echo /tivac_pub or /my_pub, there is nothing printed on the screen and the terminal that I instantiated the micro-ROS agent looks like this:
[1681478964.251445] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1681478964.251590] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
[1681478964.648326] info | Root.cpp | create_client | create | client_key: 0x0BF00356, session_id: 0x81
[1681478964.648358] info | SessionManager.hpp | establish_session | session established | client_key: 0x0BF00356, address: 0
[1681478964.648435] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1681478964.648946] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 16, data:
0000: 81 00 00 00 0E 01 08 00 05 00 00 00 80 B2 E6 0E
[1681478964.649030] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 32, data:
0000: 81 00 00 00 0F 01 18 00 34 55 39 64 08 8E AE 26 34 55 39 64 12 8C AE 26 05 00 00 00 80 B2 E6 0E
[1681478964.649966] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 40, data:
0000: 81 80 00 00 01 07 20 00 00 0A 00 01 01 03 00 00 12 00 00 00 00 01 ED FE 0A 00 00 00 61 64 61 73
0020: 5F 6E 6F 64 65 00 00 00
[1681478964.660443] info | ProxyClient.cpp | create_participant | participant created | client_key: 0x0BF00356, participant_id: 0x000(1)
[1681478964.660518] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 00 00 05 01 06 00 00 0A 00 01 00 00
[1681478964.660535] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 01 00 00 00 80
[1681478964.660932] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 01 00 00 00 80
[1681478964.661712] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 76, data:
0000: 81 80 01 00 01 07 42 00 00 0B 00 02 02 03 00 00 34 00 00 00 0D 00 00 00 72 74 2F 74 69 76 61 63
0020: 5F 70 75 62 00 00 01 00 1C 00 00 00 73 74 64 5F 6D 73 67 73 3A 3A 6D 73 67 3A 3A 64 64 73 5F 3A
0040: 3A 49 6E 74 33 32 5F 00 00 01 00 00
[1681478964.661813] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x0BF00356, topic_id: 0x000(2), participant_id: 0x000(1)
[1681478964.661870] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 01 00 05 01 06 00 00 0B 00 02 00 00
[1681478964.661886] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 02 00 00 00 80
[1681478964.662257] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 02 00 00 00 80
[1681478964.662473] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 24, data:
0000: 81 80 02 00 01 07 10 00 00 0C 00 03 03 03 00 00 02 00 00 00 00 00 00 01
[1681478964.662553] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x0BF00356, publisher_id: 0x000(3), participant_id: 0x000(1)
[1681478964.662576] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 02 00 05 01 06 00 00 0C 00 03 00 00
[1681478964.662587] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 03 00 00 00 80
[1681478964.663032] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 03 00 00 00 80
[1681478964.663345] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 36, data:
0000: 81 80 03 00 01 07 1C 00 00 0D 00 05 05 03 00 00 0E 00 00 00 00 02 01 00 02 00 01 00 05 00 00 00
0020: 00 00 00 03
[1681478964.663503] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x0BF00356, datawriter_id: 0x000(5), publisher_id: 0x000(3)
[1681478964.663535] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 03 00 05 01 06 00 00 0D 00 05 00 00
[1681478964.663555] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 04 00 00 00 80
[1681478964.663952] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 04 00 00 00 80
[1681478964.664734] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 76, data:
0000: 81 80 04 00 01 07 42 00 00 0E 00 12 02 03 00 00 34 00 00 00 0C 00 00 00 72 74 2F 61 64 61 73 5F
0020: 70 75 62 00 00 01 00 00 1C 00 00 00 73 74 64 5F 6D 73 67 73 3A 3A 6D 73 67 3A 3A 64 64 73 5F 3A
0040: 3A 49 6E 74 33 32 5F 00 00 01 00 00
[1681478964.664812] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x0BF00356, topic_id: 0x001(2), participant_id: 0x000(1)
[1681478964.664866] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 04 00 05 01 06 00 00 0E 00 12 00 00
[1681478964.664881] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 05 00 00 00 80
[1681478964.665286] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 05 00 00 00 80
[1681478964.665501] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 24, data:
0000: 81 80 05 00 01 07 10 00 00 0F 00 13 03 03 00 00 02 00 00 00 00 00 00 01
[1681478964.665538] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x0BF00356, publisher_id: 0x001(3), participant_id: 0x000(1)
[1681478964.665570] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 05 00 05 01 06 00 00 0F 00 13 00 00
[1681478964.665585] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 06 00 00 00 80
[1681478964.666053] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 06 00 00 00 80
[1681478964.666371] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 36, data:
0000: 81 80 06 00 01 07 1C 00 00 10 00 15 05 03 00 00 0E 00 00 00 00 12 01 00 03 00 01 00 0A 00 00 00
0020: 00 00 00 13
[1681478964.666513] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x0BF00356, datawriter_id: 0x001(5), publisher_id: 0x001(3)
[1681478964.666549] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 06 00 05 01 06 00 00 10 00 15 00 00
[1681478964.666563] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 07 00 00 00 80
[1681478964.666950] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 07 00 00 00 80
[1681478964.667759] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 76, data:
0000: 81 80 07 00 01 07 42 00 00 11 00 22 02 03 00 00 34 00 00 00 0C 00 00 00 72 74 2F 61 64 61 73 5F
0020: 73 75 62 00 00 01 00 00 1C 00 00 00 73 74 64 5F 6D 73 67 73 3A 3A 6D 73 67 3A 3A 64 64 73 5F 3A
0040: 3A 49 6E 74 33 32 5F 00 00 01 00 00
[1681478964.667832] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x0BF00356, topic_id: 0x002(2), participant_id: 0x000(1)
[1681478964.667857] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 07 00 05 01 06 00 00 11 00 22 00 00
[1681478964.667865] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 08 00 00 00 80
[1681478964.668329] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 08 00 00 00 80
[1681478964.668542] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 24, data:
0000: 81 80 08 00 01 07 10 00 00 12 00 04 04 03 00 00 02 00 00 00 00 00 00 01
[1681478964.668579] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x0BF00356, subscriber_id: 0x000(4), participant_id: 0x000(1)
[1681478964.668611] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 08 00 05 01 06 00 00 12 00 04 00 00
[1681478964.668624] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 09 00 00 00 80
[1681478964.669053] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 09 00 00 00 80
[1681478964.669379] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 40, data:
0000: 81 80 09 00 01 07 1D 00 00 13 00 06 06 03 00 00 0F 00 00 00 00 22 01 00 02 00 01 00 05 00 00 00
0020: 00 00 00 00 04 00 01 00
[1681478964.669593] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x0BF00356, datareader_id: 0x000(6), subscriber_id: 0x000(4)
[1681478964.669616] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 14, data:
0000: 81 80 09 00 05 01 06 00 00 13 00 06 00 00
[1681478964.669627] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 0A 00 00 00 80
[1681478964.670032] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x0BF00356, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 0A 00 00 00 80
And stops at that point, nothing will be printed to the terminal at that point. How can I solve this problem. I believe this is my last comment, thank you for your patience and collaboration.
I would need to see your micro-ROS code to check the problem
This is my whole code in my microros.c file.
#include "./config.h"
#include "./microros_usbcdc_transport.h"
#include "./microros_allocators.h"
#include <rcl/rcl.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <rmw_microros/rmw_microros.h>
#include <std_msgs/msg/int32.h>
#define CHECK_AND_CONTINUE(X) if (!ret || !(X)){ret = false;}
#define EXECUTE_EVERY_N_MS(MS, X) do { \
static volatile int64_t init = -1; \
if (init == -1) { init = uxr_millis();} \
if (uxr_millis() - init > MS) { X; init = uxr_millis();} \
} while (0)\
rcl_allocator_t allocator;
rclc_support_t support;
rcl_init_options_t init_options;
rcl_node_t node;
rclc_executor_t executor;
rcl_timer_t pub_timer;
rcl_publisher_t pub;
std_msgs__msg__Int32 msg = {0};
rcl_timer_t adas_pub_timer;
rcl_publisher_t adas_pub;
std_msgs__msg__Int32 adas_msg = {0};
rcl_subscription_t adas_sub;
std_msgs__msg__Int32 received_msg = {0};
void pub_timer_callback(rcl_timer_t * timer, int64_t last_call_time)
{
(void)! rcl_publish(&pub, &msg, NULL);
msg.data++;
}
void adas_pub_timer_callback(rcl_timer_t * timer, int64_t last_call_time)
{
(void)! rcl_publish(&adas_pub, &adas_msg, NULL);
adas_msg.data++;
}
void subscription_callback(const void * msgin)
{
const std_msgs__msg__Int32 * msg = (const std_msgs__msg__Int32 *)msgin;
printf("Received: %ld\n", msg->data);
}
bool init_microros_entites() {
bool ret = true;
uint8_t executor_handles = 0;
allocator = rcl_get_default_allocator();
init_options = rcl_get_zero_initialized_init_options();
CHECK_AND_CONTINUE(RCL_RET_OK == rcl_init_options_init(&init_options, allocator));
// create init_options
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator));
(void)! rcl_init_options_fini(&init_options);
// sync time
CHECK_AND_CONTINUE(RCL_RET_OK == rmw_uros_sync_session(1000.0));
// create node
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_node_init_default(&node, "adas_node", "", &support));
// create publishers
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_publisher_init_best_effort(&pub, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "tivac_pub"));
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_publisher_init_default(&adas_pub, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "adas_pub"));
// create subscriptions
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_subscription_init_best_effort(&adas_sub, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "adas_sub"));
executor_handles += 1;
// create timers
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_timer_init_default(&pub_timer, &support, RCL_MS_TO_NS(100), pub_timer_callback));
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_timer_init_default(&adas_pub_timer, &support, RCL_MS_TO_NS(1000), adas_pub_timer_callback));
executor_handles += 2;
// create executor
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_executor_init(&executor, &support.context, executor_handles, &allocator));
// add timers and subscriptions to executor
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_executor_add_timer(&executor, &pub_timer));
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_executor_add_timer(&executor, &adas_pub_timer));
CHECK_AND_CONTINUE(RCL_RET_OK == rclc_executor_add_subscription(&executor, &adas_sub, &received_msg, &subscription_callback, ON_NEW_DATA));
return ret;
}
bool fini_microros_entities() {
bool ret = true;
rmw_context_t * rmw_context = rcl_context_get_rmw_context(&support.context);
(void) rmw_uros_set_context_entity_destroy_session_timeout(rmw_context, 0);
(void)! rcl_publisher_fini(&pub, &node);
(void)! rcl_publisher_fini(&adas_pub, &node);
(void)! rcl_subscription_fini(&adas_sub, &node);
(void)! rcl_timer_fini(&pub_timer);
(void)! rcl_timer_fini(&adas_pub_timer);
(void)! rclc_executor_fini(&executor);
(void)! rcl_node_fini(&node);
(void)! rclc_support_fini(&support);
free_all_heap();
return ret;
}
void microros_app(void * arg)
{
allocator = rcutils_get_zero_initialized_allocator();
allocator.allocate = custom_allocate;
allocator.deallocate = custom_deallocate;
allocator.reallocate = custom_reallocate;
allocator.zero_allocate = custom_zero_allocate;
(void)! rcutils_set_default_allocator(&allocator);
rmw_uros_set_custom_transport(
true,
(void *) NULL,
tivac_usbcdc_transport_open,
tivac_usbcdc_transport_close,
tivac_usbcdc_transport_write,
tivac_usbcdc_transport_read
);
enum states {
WAITING_AGENT,
AGENT_AVAILABLE,
AGENT_CONNECTED,
AGENT_DISCONNECTED
} state = WAITING_AGENT;
while(1) {
switch (state) {
case WAITING_AGENT:
EXECUTE_EVERY_N_MS(500, state = (RMW_RET_OK == rmw_uros_ping_agent(100, 1)) ? AGENT_AVAILABLE : WAITING_AGENT;);
break;
case AGENT_AVAILABLE:
state = (true == init_microros_entites()) ? AGENT_CONNECTED : WAITING_AGENT;
if (state == WAITING_AGENT) {
fini_microros_entities();
};
break;
case AGENT_CONNECTED:
EXECUTE_EVERY_N_MS(200, state = (RMW_RET_OK == rmw_uros_ping_agent(100, 1)) ? AGENT_CONNECTED : AGENT_DISCONNECTED;);
if (state == AGENT_CONNECTED) {
rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100));
}
break;
case AGENT_DISCONNECTED:
fini_microros_entities();
state = WAITING_AGENT;
break;
default:
break;
}
}
}
Can you make sure that your rclc_executor_spin_some
is being executed?
When I remove the extra publisher and subscriber and left only one publisher active at a time, it works correctly. But at this point, I am not sure whether it is being executed.
Could you share the agent output in the case that it works?
Yes of course. The output is following and it keeps going until I terminate the process.
[1681480657.671372] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x680E6C21, len: 36, data:
0000: 81 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1681480657.681245] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 01 12 00 07 01 08 00 00 20 00 05 12 00 00 00
[1681480657.681327] debug | DataWriter.cpp | write | [** <<DDS>> **] | client_key: 0x00000000, len: 4, data:
0000: 12 00 00 00
[1681480657.781173] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 01 13 00 07 01 08 00 00 21 00 05 13 00 00 00
[1681480657.781260] debug | DataWriter.cpp | write | [** <<DDS>> **] | client_key: 0x00000000, len: 4, data:
0000: 13 00 00 00
[1681480657.881268] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 01 14 00 07 01 08 00 00 22 00 05 14 00 00 00
[1681480657.881311] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1681480657.881402] debug | DataWriter.cpp | write | [** <<DDS>> **] | client_key: 0x00000000, len: 4, data:
0000: 14 00 00 00
[1681480657.881492] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x680E6C21, len: 36, data:
0000: 81 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1681480657.981235] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 01 15 00 07 01 08 00 00 23 00 05 15 00 00 00
[1681480657.981324] debug | DataWriter.cpp | write | [** <<DDS>> **] | client_key: 0x00000000, len: 4, data:
0000: 15 00 00 00
[1681480658.081148] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 01 16 00 07 01 08 00 00 24 00 05 16 00 00 00
[1681480658.081270] debug | DataWriter.cpp | write | [** <<DDS>> **] | client_key: 0x00000000, len: 4, data:
0000: 16 00 00 00
[1681480658.091106] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x680E6C21, len: 16, data:
0000: 81 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1681480658.091258] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x680E6C21, len: 36, data:
0000: 81 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
Does it works if you configure the 2 publishers and the subscriber as best effort?
I actually didnt try it but it makes sense. I left the lab now, I will try it next week and share the results with you. Thank you for your collaboration and patience!
Changing the publisher creation method to best_effort didn't solve my problem. Publishers are still publishing nothing. Sorry for bothering again :(
Does it work if you set both writers on the same timer?
Hello again,
I set both publishers on the same timer. Then tried following scenarios:
1- I made both publishers publish on the same timer and let both publishers to publish message but this didn't work. They both started publishing nothing again. (The same problem I mentioned above)
2- I created 2 publishers and added them to same timer but I let only on of the publisher to publish. Again this situation also didn't work. The publisher I let it publish was publishing nothing. The situation solved when I removed the line that I created the publisher -> CHECK_AND_CONTINUE(RCL_RET_OK == rclc_publisher_init_best_effort(&adas_pub, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "adas_pub"));
3- When the program is working with only one publisher, if I add a subscription, publisher starts publishing nothing again. I tried 2 scenarios creating subscription: Without adding it to executor and adding it to executor. Both crushed the program again, publisher started publishing nothing again.
I cannot understand why this is happening because everything looks fine and logical. Sorry for bothering you again.
@Acuadros95 can you please help me. I'm stuck at that point and waiting an answer from you for a week. I would be appreciated if you help me. Thank you for your collaboration.
Hi @MertAdak,
I managed to build micro-ROS on humble without errors, some details:
I also got these errors (It was too long and all of them was same, that's why I copied some, not all): ./microros/generate_microros_library.sh: line 120: -ar: command not found mv: cannot stat '*': No such file or directory
This error happens because the compiler could not be found, this should happen both on humble and galactic. Did you change anything on the SDK or your host enviroment to fix this?
but rcl_logging_log4cxx directory is not available for humble branch. So it gives an error like no such file or no such directory.
Indeed, we will remove this line from the build script. But this error is actually harmless from the build process, just
rsync: [sender] change_dir "/home/micro_ros_tivac_launchpad_app/microros/install/include/tracetools_trace/tracetools_trace" failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]`
Same as before, this errors can be treated as warnings and they don't affect the build process.
Please give another try to the humble branch, with the same environment you used to build on galactic.
I am also going to check what is going on with the micro-ROS code.
Looks like this is related to Heap/Stack memory size, try to increase the configured values on your config.h
file:
https://github.com/micro-ROS/micro_ros_tivac_launchpad_app/blob/599ffba44772eba8607672e02ba319d5af29f5d7/src/config.h#L4-L5
Thank you very much for your help. Multiple publisher problem is fixed on Humble branch by making modification on stack and heap size. Now everything works without any problem.
Thank you @pablogs9 and @Acuadros95 for helping me to build the launchpad all the way,
Hello, I have a microros workspace seperated from launchpad folder. I source my microros in that folder by writing:
source install/local_setup.bash
And then, I run the microros agent in the same terminal by typing:
ros2 run micro_ros_agent micro_ros_agent serial --dev "/dev/serial/by-id/usb-Texas_Instruments_In-Circuit_Debug_Interface_0E236050-if00" --verbose 6
microros agent runs succesfully and then I open another terminal to see the topics that are running and type:
ros2 topic list
but it prints only the/rosout
and/parameter_events
topics.Also, after flashing the binary file to the device, there is nothig visually happens on the card, is it normal? Can you help me integrating the microros and the microcontroller on my computer. I also added the screenshot of 2 terminals I talked about above.
Best regards, Mert Adak