鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    动手学ros2第5章进阶篇-控制OLED-自定义消息接口

    已定时 已固定 已锁定 已移动 未解决
    ROS 2相关问题
    ros2 humble ros2 添加接口
    11
    51
    8.6k
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 8421452488
      likesingjumprap @小鱼
      最后由 编辑

      @小鱼 示例也不行

       *  Executing task: platformio run 
      
      Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino)
      ---------------------------------------------------------------------------------------------------------------------------------------------------
      Library Manager: Installing git+https://gitee.com/ohhuo/micro_ros_platformio.git
      git version 2.34.1
      Cloning into '/home/nzb/.platformio/.cache/tmp/pkg-installing-mkfoxl4p'...
      remote: Enumerating objects: 5773, done.
      remote: Counting objects: 100% (5773/5773), done.
      remote: Compressing objects: 100% (2618/2618), done.
      remote: Total 5773 (delta 2905), reused 5732 (delta 2883), pack-reused 0
      Receiving objects: 100% (5773/5773), 19.12 MiB | 5.79 MiB/s, done.
      Resolving deltas: 100% (2905/2905), done.
      Library Manager: micro_ros_platformio@0.0.1+sha.085c5dd has been installed!
      Library Manager: Installing adafruit/Adafruit SSD1306 @ ^2.5.7
      Unpacking  [####################################]  100%
      Library Manager: Adafruit SSD1306@2.5.7 has been installed!
      Library Manager: Resolving dependencies...
      Library Manager: Installing Adafruit GFX Library
      Unpacking  [####################################]  100%
      Library Manager: Adafruit GFX Library@1.11.8 has been installed!
      Library Manager: Resolving dependencies...
      Library Manager: Installing Adafruit BusIO
      Unpacking  [####################################]  100%
      Library Manager: Adafruit BusIO@1.14.4 has been installed!
      Verbose mode can be enabled via `-v, --verbose` option
      CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html
      PLATFORM: Espressif 32 (5.2.0) > Adafruit ESP32 Feather
      HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
      DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
      PACKAGES: 
       - framework-arduinoespressif32 @ 3.20005.220925 (2.0.5) 
       - tool-esptoolpy @ 1.40201.0 (4.2.1) 
       - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
      LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
      LDF Modes: Finder ~ chain, Compatibility ~ soft
      Installing pyyaml with pip at PlatformIO environment
      /home/nzb/.platformio/penv/bin/python -m pip install pyyaml
      Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
      Requirement already satisfied: pyyaml in /home/nzb/.platformio/penv/lib/python3.10/site-packages (6.0)
      
      [notice] A new release of pip available: 22.3.1 -> 23.2.1
      [notice] To update, run: pip install --upgrade pip
      Installing markupsafe==2.0.1 with pip at PlatformIO environment
      /home/nzb/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
      Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
      Requirement already satisfied: markupsafe==2.0.1 in /home/nzb/.platformio/penv/lib/python3.10/site-packages (2.0.1)
      
      [notice] A new release of pip available: 22.3.1 -> 23.2.1
      [notice] To update, run: pip install --upgrade pip
      Configuring featheresp32 with transport serial
      micro-ROS already built
      Found 36 compatible libraries
      Scanning dependencies...
      Dependency Graph
      |-- micro_ros_platformio @ 0.0.1+sha.085c5dd
      |-- Adafruit SSD1306 @ 2.5.7
      |-- Wire @ 2.0.0
      |-- Adafruit GFX Library @ 1.11.8
      Building in release mode
      Compiling .pio/build/featheresp32/src/main.cpp.o
      Building .pio/build/featheresp32/bootloader.bin
      Generating partitions .pio/build/featheresp32/partitions.bin
      esptool.py v4.2.1
      Creating esp32 image...
      Merged 1 ELF section
      Successfully created esp32 image.
      src/main.cpp:13:10: fatal error: fishbot_interfaces/srv/oled_control.h: No such file or directory
       #include <fishbot_interfaces/srv/oled_control.h> // 添加接口
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      Compiling .pio/build/featheresp32/lib61f/micro_ros_platformio/platform_code/arduino/clock_gettime.cpp.o
      Compiling .pio/build/featheresp32/lib61f/micro_ros_platformio/platform_code/arduino/serial/micro_ros_transport.cpp.o
      Compiling .pio/build/featheresp32/lib31c/Wire/Wire.cpp.o
      Compiling .pio/build/featheresp32/lib271/SPI/SPI.cpp.o
      Compiling .pio/build/featheresp32/libaae/Adafruit BusIO/Adafruit_BusIO_Register.cpp.o
      *** [.pio/build/featheresp32/src/main.cpp.o] Error 1
      =========================================================== [FAILED] Took 16.30 seconds ===========================================================
      
       *  The terminal process "platformio 'run'" terminated with exit code: 1. 
       *  Terminal will be reused by tasks, press any key to close it. 
      
      小鱼小 1 条回复 最后回复 回复 引用 0
      • 小鱼小
        小鱼 技术大佬 @842145248
        最后由 编辑

        @842145248 需要重新构建microros库,按照你之前的流程,或者把extra_pkgs 替换下

        新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

        8421452488 1 条回复 最后回复 回复 引用 0
        • 8421452488
          likesingjumprap @小鱼
          最后由 842145248 编辑

          @小鱼 鱼哥,还是不行😭 ,libmicroros 删除了,重新编译,终端打印编译过程没报错,也通过了,但是中间报这种影响吗?

          17e49679-1fb1-470c-9c0c-c0092bfdb7eb-image.png

          c1fd2f5f-b8d3-4dcb-ba2e-58c8e41f4eb9-image.png

          看 libmicroros 目录下也有那个fishbot_interfaces了
          026f6e6c-f8bd-4017-9d44-7ea835beffdc-image.png

          执行ros2 service call /oled_control fishbot_interfaces/srv/OledControl "{px: 0, py: 0, data: 'nihao'}" 报错还是之前这个:

          Traceback (most recent call last):
            File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support
              return importlib.import_module(module_name, package=pkg_name)
            File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
              return _bootstrap._gcd_import(name[level:], package, level)
            File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
            File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
            File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
          ModuleNotFoundError: No module named 'fishbot_interfaces.fishbot_interfaces_s__rosidl_typesupport_c'
          
          During handling of the above exception, another exception occurred:
          
          Traceback (most recent call last):
            File "/opt/ros/humble/bin/ros2", line 33, in <module>
              sys.exit(load_entry_point('ros2cli==0.18.7', 'console_scripts', 'ros2')())
            File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 89, in main
              rc = extension.main(parser=parser, args=args)
            File "/opt/ros/humble/lib/python3.10/site-packages/ros2service/command/service.py", line 41, in main
              return extension.main(args=args)
            File "/opt/ros/humble/lib/python3.10/site-packages/ros2service/verb/call.py", line 58, in main
              return requester(
            File "/opt/ros/humble/lib/python3.10/site-packages/ros2service/verb/call.py", line 86, in requester
              cli = node.create_client(srv_module, service_name)
            File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1413, in create_client
              check_is_valid_srv_type(srv_type)
            File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/type_support.py", line 51, in check_is_valid_srv_type
              check_for_type_support(srv_type)
            File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/type_support.py", line 29, in check_for_type_support
              msg_or_srv_type.__class__.__import_type_support__()
            File "/home/nzb/vscode_project/cplus_demo/ros2_demo/chat13/example14_custom_interfaces/extra_packages/install/fishbot_interfaces/local/lib/python3.10/dist-packages/fishbot_interfaces/srv/_oled_control.py", line 303, in __import_type_support__
              module = import_type_support('fishbot_interfaces')
            File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_support
              raise UnsupportedTypeSupport(pkg_name)
          rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'fishbot_interfaces'
          
          
          小鱼小 1 条回复 最后回复 回复 引用 0
          • 小鱼小
            小鱼 技术大佬 @842145248
            最后由 编辑

            @842145248 在 动手学ros2第5章进阶篇-控制OLED-自定义消息接口 中说:

            ros2 service call /oled_control fishbot_interfaces/srv/OledControl "{px: 0, py: 0, data: 'nihao'}"

            真是奇怪了,你在extra_pkgs下依次运行下面的指令,把结果反馈出来看看

            rm -rf build install log
            colcon build
            source install/setup.bash
            ros2 serivice list
            ros2 interface list | grep fishbot
            ros2 service call /oled_control fishbot_interfaces/srv/OledControl "{px: 0, py: 0, data: 'nihao'
            

            新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

            8421452488 1 条回复 最后回复 回复 引用 0
            • 8421452488
              likesingjumprap @小鱼
              最后由 编辑

              @小鱼
              rm -rf build install log && colcon build --packages-up-to fishbot_interfaces && source install/setup.bash

              [0.467s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/nzb/vscode_project/cplus_demo/ros2_demo/chat13/example14_custom_interfaces/extra_packages/install/fishbot_interfaces' in the environment variable AMENT_PREFIX_PATH doesn't exist
              [0.468s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/nzb/vscode_project/cplus_demo/ros2_demo/chat13/example14_custom_interfaces/extra_packages/install/fishbot_interfaces' in the environment variable CMAKE_PREFIX_PATH doesn't exist
              Starting >>> fishbot_interfaces
              Finished <<< fishbot_interfaces [5.13s]                     
              
              Summary: 1 package finished [5.37s]
              

              ros2 service list && ros2 interface list | grep fish

              /oled_control
              fishbot_interfaces/srv/OledControl
              
              

              ros2 service call /oled_control fishbot_interfaces/srv/OledControl "{px: 0, py: 0, data: 'nihao'}"

              Traceback (most recent call last):
                File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support
                  return importlib.import_module(module_name, package=pkg_name)
                File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
                  return _bootstrap._gcd_import(name[level:], package, level)
                File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
                File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
                File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
              ModuleNotFoundError: No module named 'fishbot_interfaces.fishbot_interfaces_s__rosidl_typesupport_c'
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/opt/ros/humble/bin/ros2", line 33, in <module>
                  sys.exit(load_entry_point('ros2cli==0.18.7', 'console_scripts', 'ros2')())
                File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 89, in main
                  rc = extension.main(parser=parser, args=args)
                File "/opt/ros/humble/lib/python3.10/site-packages/ros2service/command/service.py", line 41, in main
                  return extension.main(args=args)
                File "/opt/ros/humble/lib/python3.10/site-packages/ros2service/verb/call.py", line 58, in main
                  return requester(
                File "/opt/ros/humble/lib/python3.10/site-packages/ros2service/verb/call.py", line 86, in requester
                  cli = node.create_client(srv_module, service_name)
                File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1413, in create_client
                  check_is_valid_srv_type(srv_type)
                File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/type_support.py", line 51, in check_is_valid_srv_type
                  check_for_type_support(srv_type)
                File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/type_support.py", line 29, in check_for_type_support
                  msg_or_srv_type.__class__.__import_type_support__()
                File "/home/nzb/vscode_project/cplus_demo/ros2_demo/chat13/example14_custom_interfaces/extra_packages/install/fishbot_interfaces/local/lib/python3.10/dist-packages/fishbot_interfaces/srv/_oled_control.py", line 303, in __import_type_support__
                  module = import_type_support('fishbot_interfaces')
                File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_support
                  raise UnsupportedTypeSupport(pkg_name)
              rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'fishbot_interfaces'
              
              小鱼小 1 条回复 最后回复 回复 引用 0
              • 小鱼小
                小鱼 技术大佬 @842145248
                最后由 编辑

                @842145248 在 动手学ros2第5章进阶篇-控制OLED-自定义消息接口 中说:

                --packages-up-to fishbot_interfaces

                不要加这个

                新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                8421452488 1 条回复 最后回复 回复 引用 0
                • 8421452488
                  likesingjumprap @小鱼
                  最后由 编辑

                  @小鱼 一样的报错,那个是我测试加上的,刚刚我删了重新编译了下,还是上面报错😭 ,人都要麻了

                  8421452488 1 条回复 最后回复 回复 引用 0
                  • 8421452488
                    likesingjumprap @842145248
                    最后由 编辑

                    @842145248 我环境跟教程一样的22.04,humble

                    小鱼小 1 条回复 最后回复 回复 引用 0
                    • 小鱼小
                      小鱼 技术大佬 @842145248
                      最后由 编辑

                      @842145248 我在我这里测试了一下,没有问题:
                      2b58af41-fd69-451d-955f-078f3c3392c5-image.png

                      测试指令:

                      cd ~
                      git clone git@github.com:fishros/example_micoros_board.git
                      cd example_micoros_board/example14_custom_interface/extra_packages/
                      rm -rf build install log
                      colcon build
                      source install/setup.bash
                      ros2 serivice list
                      ros2 interface list | grep fishbot
                      ros2 service call /oled_control fishbot_interfaces/srv/OledControl "{px: 0, py: 0, data: 'nihao'}"
                      

                      新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                      8421452488 2 条回复 最后回复 回复 引用 0
                      • 8421452488
                        likesingjumprap @小鱼
                        最后由 编辑

                        @小鱼

                        b97b2ca0-c8f5-4624-9b28-7a5293830beb-image.png

                        8421452488 1 条回复 最后回复 回复 引用 0
                        • 8421452488
                          likesingjumprap @842145248
                          最后由 编辑

                          @842145248 这demo也没啥什么环境变量影响啊,咋就不行了呢😢

                          小鱼小 1 条回复 最后回复 回复 引用 0
                          • 小鱼小
                            小鱼 技术大佬 @842145248
                            最后由 编辑

                            @842145248 代码一样你的系统是多少的,不幸就换个系统试试

                            新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                            8421452488 1 条回复 最后回复 回复 引用 0
                            • 8421452488
                              likesingjumprap @小鱼
                              最后由 编辑

                              @小鱼
                              嗯嗯,我再找找看,非常感谢大佬的支持

                              No LSB modules are available.
                              Distributor ID:	Ubuntu
                              Description:	Ubuntu 22.04.3 LTS
                              Release:	22.04
                              Codename:	jammy
                              
                              
                              Linux lenovo 5.15.0-82-generic #91-Ubuntu SMP Mon Aug 14 14:14:14 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
                              
                              
                              1 条回复 最后回复 回复 引用 0
                              • 8421452488
                                likesingjumprap @小鱼
                                最后由 编辑

                                @小鱼
                                大佬,你电脑编完后的这个目录下的文件能截个图给我吗
                                extra_packages/install/fishbot_interfaces/local/lib/python3.10/dist-packages/fishbot_interfaces

                                小鱼小 1 条回复 最后回复 回复 引用 0
                                • 小鱼小
                                  小鱼 技术大佬 @842145248
                                  最后由 编辑

                                  @842145248

                                  fishros@fishros-linux:~/example_micoros_board/example14_custom_interface/extra_packages/install/fishbot_interfaces/local/lib/python3.10/dist-packages/fishbot_interfaces$ ll
                                  ---
                                  总计 136
                                  drwxr-xr-x 4 fishros fishros  4096 10月 14 16:44 ./
                                  drwxrwxr-x 4 fishros fishros  4096 10月 14 16:44 ../
                                  -rw-r--r-- 1 fishros fishros 11776 10月 14 16:44 _fishbot_interfaces_s.ep.rosidl_typesupport_c.c
                                  -rw-r--r-- 1 fishros fishros 11785 10月 14 16:44 _fishbot_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c
                                  -rw-r--r-- 1 fishros fishros 11790 10月 14 16:44 _fishbot_interfaces_s.ep.rosidl_typesupport_introspection_c.c
                                  -rw-r--r-- 1 fishros fishros 17632 10月 14 16:44 fishbot_interfaces_s__rosidl_typesupport_c.cpython-310-x86_64-linux-gnu.so
                                  -rw-r--r-- 1 fishros fishros 17648 10月 14 16:44 fishbot_interfaces_s__rosidl_typesupport_fastrtps_c.cpython-310-x86_64-linux-gnu.so
                                  -rw-r--r-- 1 fishros fishros 17664 10月 14 16:44 fishbot_interfaces_s__rosidl_typesupport_introspection_c.cpython-310-x86_64-linux-gnu.so
                                  -rw-r--r-- 1 fishros fishros     0 10月 14 16:44 __init__.py
                                  -rw-r--r-- 1 fishros fishros 21392 10月 14 16:44 libfishbot_interfaces__rosidl_generator_py.so
                                  drwxrwxr-x 2 fishros fishros  4096 10月 14 16:44 __pycache__/
                                  drwxr-xr-x 3 fishros fishros  4096 10月 14 16:44 srv/
                                  
                                  

                                  新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                  8421452488 1 条回复 最后回复 回复 引用 0
                                  • 8421452488
                                    likesingjumprap @小鱼
                                    最后由 编辑

                                    @小鱼

                                    果然,我编译出来的是*cpython-36m-x86_64-*.so
                                    大佬,你系统里面还有python3.6吗,我尝试卸载,卸不干净😢 ,为什么会编python3.6啊,humble明明自带的python3.10

                                    total 136
                                    drwxr-xr-x 4 nzb nzb  4096 10月 15 13:40 ./
                                    drwxrwxr-x 4 nzb nzb  4096 10月 15 13:40 ../
                                    -rw-r--r-- 1 nzb nzb 11776 10月 15 13:40 _fishbot_interfaces_s.ep.rosidl_typesupport_c.c
                                    -rw-r--r-- 1 nzb nzb 11785 10月 15 13:40 _fishbot_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c
                                    -rw-r--r-- 1 nzb nzb 11790 10月 15 13:40 _fishbot_interfaces_s.ep.rosidl_typesupport_introspection_c.c
                                    -rw-r--r-- 1 nzb nzb 17632 10月 15 13:40 fishbot_interfaces_s__rosidl_typesupport_c.cpython-36m-x86_64-linux-gnu.so
                                    -rw-r--r-- 1 nzb nzb 17648 10月 15 13:40 fishbot_interfaces_s__rosidl_typesupport_fastrtps_c.cpython-36m-x86_64-linux-gnu.so
                                    -rw-r--r-- 1 nzb nzb 17664 10月 15 13:40 fishbot_interfaces_s__rosidl_typesupport_introspection_c.cpython-36m-x86_64-linux-gnu.so
                                    -rw-r--r-- 1 nzb nzb     0 10月 15 13:40 __init__.py
                                    -rw-r--r-- 1 nzb nzb 21392 10月 15 13:40 libfishbot_interfaces__rosidl_generator_py.so
                                    drwxrwxr-x 2 nzb nzb  4096 10月 15 13:40 __pycache__/
                                    drwxr-xr-x 3 nzb nzb  4096 10月 15 13:40 srv/
                                    
                                    
                                    小鱼小 1 条回复 最后回复 回复 引用 0
                                    • 小鱼小
                                      小鱼 技术大佬 @842145248
                                      最后由 小鱼 编辑

                                      @842145248 python --verion 你的显示什么

                                      python3 --version

                                      新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                      8421452488 1 条回复 最后回复 回复 引用 0
                                      • 8421452488
                                        likesingjumprap @小鱼
                                        最后由 编辑

                                        @小鱼
                                        显示的python3.10

                                        刚刚我又卸载了一遍,卸载成功了,之前还剩个python3.6-minimal没卸载掉,显示的可执行文件是/usr/bin/python3.6m, 疑惑我半天,卸载的时候没用通配符,我还以为系统自带的卸载不了。

                                        终于可以正常编译了跑起来了😭 ,非常感谢大佬的支持🌷 🌷 🌷

                                        小鱼小 1 条回复 最后回复 回复 引用 0
                                        • 小鱼小
                                          小鱼 技术大佬 @842145248
                                          最后由 编辑

                                          @842145248 👍

                                          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                          12818578961 1 条回复 最后回复 回复 引用 0
                                          • 12818578961
                                            1281857896 @小鱼
                                            最后由 编辑

                                            @小鱼 dfc47842-4cb9-4fd3-b710-e80c59f7db0a-image.png
                                            编译一直是这个问题,不知道怎么解决

                                            小鱼小 1 条回复 最后回复 回复 引用 0
                                            • 第一个帖子
                                              最后一个帖子
                                            皖ICP备16016415号-7
                                            Powered by NodeBB | 鱼香ROS