arjav1528 opened a new pull request, #3521: URL: https://github.com/apache/nuttx-apps/pull/3521
## Summary Phase 7 of the micro-ROS on NuttX integration. Adds `apps/examples/microros_sub`, a minimal Int32 subscriber that mirrors the `microros_pub` example merged in [#3512](https://github.com/apache/nuttx-apps/pull/3512) for the receive direction. The example creates a `nuttx_sub_node`, subscribes to `/nuttx_sub` with `std_msgs/msg/Int32`, registers a callback via `rclc_executor_add_subscription`, and enters `rclc_executor_spin`. Each received value is printed via NSH. It exercises the rclc_executor + subscription callback path on top of the NuttX-native `microros_transport` library that was wired up in Phase 6. Depends on: - apache/nuttx-apps#3512 (transport + pub example) — merged - apache/nuttx#19001 (CMake plumbing) — merged ## Impact - **User**: new opt-in `EXAMPLES_MICROROS_SUB` Kconfig entry under `Application Configuration > Examples`, gated on `SYSTEM_MICROROS`. Default `n`; existing configs are unaffected. - **Build**: no changes to the libmicroros build pipeline; reuses the existing `microros_transport` library and `SYSTEM_MICROROS` include layout. - **Hardware**: none. Sim and any board with the existing micro-ROS transport enabled (UDP via NuttX sockets or serial via TERMIOS) can run the example. - **Docs / security / compatibility**: none. ## Testing Host: Ubuntu 22.04.5 LTS (jammy), x86_64, Linux 6.8.0-1055-aws, gcc 11.4.0, AWS EC2 m7i-flex.large (2 vCPU, 7.6 GB RAM). Target: NuttX `sim:nsh` on Linux, UDP transport over TAP. ### 1. checkpatch ``` $ ./tools/checkpatch.sh -f ../apps/examples/microros_sub/microros_sub_main.c (clean) ``` ### 2. Build with pub + sub both enabled ``` $ tools/configure.sh sim:nsh $ cat ~/microros_extra_config >> .config $ make olddefconfig $ make -j2 ... LD: nuttx SIM elf with dynamic libs archive in nuttx.tgz ``` Result: `nuttx` ELF produced, both `microros_pub_main` and `microros_sub_main` linked. ### 3. Sub-only build (pub disabled) Verifies the new example does not regress when the existing publisher example is turned off and that `microros_transport` still links cleanly with just the subscriber as a consumer. ``` $ kconfig-tweak --disable EXAMPLES_MICROROS_PUB $ kconfig-tweak --enable EXAMPLES_MICROROS_SUB $ make olddefconfig && make -j2 ... LD: nuttx SIM elf with dynamic libs archive in nuttx.tgz $ nm nuttx | grep -E 'microros_sub_main|sub_callback' 00000000400a9d89 T microros_sub_main 00000000400a9d30 t sub_callback ``` ### 4. End-to-end runtime against a micro-ROS agent Agent (host, separate terminal): ``` $ docker run -it --rm --network host microros/micro-ros-agent:jazzy \ udp4 --port 8888 [INFO] [Root.Agent]: Running. ``` NuttX sim: ``` nsh> ifconfig eth0 Link encap:Ethernet HWaddr 42:0a:bc:cd:ef:02 at UP inet addr:192.168.10.2 DRaddr:192.168.10.1 Mask:255.255.255.0 nsh> microros_sub & microros_sub: starting microros_sub: spinning on /nuttx_sub ``` Host publishes (in another terminal): ``` $ ros2 topic pub --once /nuttx_sub std_msgs/msg/Int32 "{data: 42}" $ for v in 100 200 300 400 500; do ros2 topic pub --once /nuttx_sub std_msgs/msg/Int32 "{data: $v}"; done ``` NuttX sim output: ``` microros_sub: got 42 microros_sub: got 42 microros_sub: got 42 microros_sub: got 42 microros_sub: got 42 microros_sub: got 42 microros_sub: got 42 microros_sub: got 100 microros_sub: got 200 microros_sub: got 300 microros_sub: got 400 microros_sub: got 500 ``` All values delivered in order to the registered callback via `rclc_executor_spin`, confirming the agent → client direction of the NuttX-native transport plus the rclc_executor subscription path works end-to-end. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
