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

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

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

      @847718956 搞定了,更新了代码,已有工程解决方案如下:

      打开工程,删除目录.pio/libdeps/featheresp32/micro_ros_platformio

      接着重新点击编译即可。

      rocessing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino)
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      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/fishros/.platformio/penv/bin/python -m pip install pyyaml
      Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
      Requirement already satisfied: pyyaml in /home/fishros/.platformio/penv/lib/python3.10/site-packages (6.0)
      
      [notice] A new release of pip available: 22.3.1 -> 23.0
      [notice] To update, run: pip install --upgrade pip
      Installing markupsafe==2.0.1 with pip at PlatformIO environment
      /home/fishros/.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/fishros/.platformio/penv/lib/python3.10/site-packages (2.0.1)
      
      [notice] A new release of pip available: 22.3.1 -> 23.0
      [notice] To update, run: pip install --upgrade pip
      Configuring featheresp32 with transport custom
      Downloading micro-ROS dev dependencies
               - Downloaded ament_cmake
               - Downloaded ament_lint
               - Downloaded ament_package
               - Downloaded googletest
               - Downloaded ament_cmake_ros
               - Downloaded ament_index
      Building micro-ROS dev dependencies
      Downloading micro-ROS library
               - Downloaded microcdr
               - Downloaded microxrcedds_client
               - Downloaded rcl
               - Downloaded rcl_action
               - Downloaded rcl_lifecycle
               - Downloaded rcl_yaml_param_parser (ignored)
               - Downloaded rclc_parameter
               - Downloaded rclc_examples (ignored)
               - Downloaded rclc
               - Downloaded rclc_lifecycle
               - Downloaded micro_ros_utilities
               - Downloaded rcutils
               - Downloaded micro_ros_msgs
               - Downloaded rmw_microxrcedds
               - Downloaded rosidl_typesupport_cpp (ignored)
               - Downloaded rosidl_typesupport_c
               - Downloaded rosidl_typesupport_microxrcedds_c
               - Downloaded rosidl_typesupport_microxrcedds_test_msg
               - Downloaded rosidl_typesupport_microxrcedds_cpp_tests
               - Downloaded rosidl_typesupport_microxrcedds_c_tests
               - Downloaded rosidl_typesupport_microxrcedds_cpp (ignored)
               - Downloaded rosidl_generator_c
               - Downloaded rosidl_runtime_cpp (ignored)
               - Downloaded rosidl_typesupport_introspection_cpp (ignored)
               - Downloaded rosidl_generator_cpp (ignored)
               - Downloaded rosidl_typesupport_introspection_tests
               - Downloaded rosidl_parser
               - Downloaded rosidl_cmake
               - Downloaded rosidl_adapter
               - Downloaded rosidl_typesupport_interface
               - Downloaded rosidl_typesupport_introspection_c
               - Downloaded rosidl_cli
               - Downloaded rosidl_runtime_c
               - Downloaded rmw_implementation_cmake
               - Downloaded rmw
               - Downloaded composition_interfaces
               - Downloaded test_msgs
               - Downloaded rosgraph_msgs
               - Downloaded rcl_interfaces
               - Downloaded action_msgs
               - Downloaded lifecycle_msgs
               - Downloaded builtin_interfaces
               - Downloaded statistics_msgs
               - Downloaded rosidl_default_generators
               - Downloaded rosidl_default_runtime
               - Downloaded unique_identifier_msgs
               - Downloaded actionlib_msgs
               - Downloaded visualization_msgs
               - Downloaded trajectory_msgs
               - Downloaded sensor_msgs_py
               - Downloaded stereo_msgs
               - Downloaded common_interfaces
               - Downloaded shape_msgs
               - Downloaded sensor_msgs
               - Downloaded geometry_msgs
               - Downloaded std_srvs
               - Downloaded diagnostic_msgs
               - Downloaded std_msgs
               - Downloaded nav_msgs
               - Downloaded test_interface_files
               - Downloaded test_rmw_implementation
               - Downloaded rmw_implementation
               - Downloaded rcl_logging_interface
               - Downloaded rcl_logging_spdlog (ignored)
               - Downloaded rcl_logging_noop
               - Downloaded test_tracetools
               - Downloaded ros2trace
               - Downloaded tracetools_launch
               - Downloaded test_tracetools_launch
               - Downloaded tracetools
               - Downloaded tracetools_trace
               - Downloaded tracetools_read
               - Downloaded tracetools_test
               - Downloaded example_interfaces
      Checking extra packages
               - Adding fishbot_interfaces
      Checking extra packages
               - Adding fishbot_interfaces
      Building micro-ROS library
      Found 46 compatible libraries
      Scanning dependencies...
      Dependency Graph
      |-- micro_ros_platformio @ 0.0.1+sha.a2f9de7
      |-- Esp32McpwmMotor @ 0.1.0+sha.48fcf81
      |-- Esp32PcntEncoder @ 0.1.0+sha.43dbbb7
      |-- Adafruit SSD1306 @ 2.5.7
      |   |-- Adafruit GFX Library @ 1.11.3
      |   |   |-- Adafruit BusIO @ 1.14.1
      |   |   |   |-- Wire @ 2.0.0
      |   |   |   |-- SPI @ 2.0.0
      |   |   |-- Wire @ 2.0.0
      |   |   |-- SPI @ 2.0.0
      |   |-- Adafruit BusIO @ 1.14.1
      |   |   |-- Wire @ 2.0.0
      |   |   |-- SPI @ 2.0.0
      |   |-- Wire @ 2.0.0
      |   |-- SPI @ 2.0.0
      |-- OneButton @ 2.0.3
      |-- Time @ 1.6.1
      |-- Displays
      |   |-- Adafruit GFX Library @ 1.11.3
      |   |   |-- Adafruit BusIO @ 1.14.1
      |   |   |   |-- Wire @ 2.0.0
      |   |   |   |-- SPI @ 2.0.0
      |   |   |-- Wire @ 2.0.0
      |   |   |-- SPI @ 2.0.0
      |   |-- Adafruit SSD1306 @ 2.5.7
      |   |   |-- Adafruit GFX Library @ 1.11.3
      |   |   |   |-- Adafruit BusIO @ 1.14.1
      |   |   |   |   |-- Wire @ 2.0.0
      |   |   |   |   |-- SPI @ 2.0.0
      |   |   |   |-- Wire @ 2.0.0
      |   |   |   |-- SPI @ 2.0.0
      |   |   |-- Adafruit BusIO @ 1.14.1
      |   |   |   |-- Wire @ 2.0.0
      |   |   |   |-- SPI @ 2.0.0
      |   |   |-- Wire @ 2.0.0
      |   |   |-- SPI @ 2.0.0
      |   |-- Time @ 1.6.1
      |   |-- Wire @ 2.0.0
      |-- FishbotUtils
      |-- MicroRosRwm
      |   |-- micro_ros_platformio @ 0.0.1+sha.a2f9de7
      |   |-- WiFi @ 2.0.0
      |-- BluetoothSerial @ 2.0.0
      |-- Kinematics
      |-- PidController
      |-- WiFi @ 2.0.0
      |-- Preferences @ 2.0.0
      Building in release mode
      Compiling .pio/build/featheresp32/src/fishbot.cpp.o
      Compiling .pio/build/featheresp32/src/fishbot_config.cpp.o
      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.
      Compiling .pio/build/featheresp32/lib233/micro_ros_platformio/platform_code/arduino/clock_gettime.cpp.o
      Compiling .pio/build/featheresp32/lib72b/Esp32McpwmMotor/Esp32McpwmMotor.cpp.o
      Compiling .pio/build/featheresp32/libdd7/Esp32PcntEncoder/Esp32PcntEncoder.cpp.o
      Compiling .pio/build/featheresp32/libc6b/Wire/Wire.cpp.o
      Compiling .pio/build/featheresp32/libe29/SPI/SPI.cpp.o
      Compiling .pio/build/featheresp32/libe08/Adafruit BusIO/Adafruit_BusIO_Register.cpp.o
      Compiling .pio/build/featheresp32/libe08/Adafruit BusIO/Adafruit_I2CDevice.cpp.o
      Compiling .pio/build/featheresp32/libe08/Adafruit BusIO/Adafruit_SPIDevice.cpp.o
      Compiling .pio/build/featheresp32/lib609/Adafruit GFX Library/Adafruit_GFX.cpp.o
      Compiling .pio/build/featheresp32/lib609/Adafruit GFX Library/Adafruit_GrayOLED.cpp.o
      Compiling .pio/build/featheresp32/lib609/Adafruit GFX Library/Adafruit_SPITFT.cpp.o
      Compiling .pio/build/featheresp32/lib609/Adafruit GFX Library/glcdfont.c.o
      Compiling .pio/build/featheresp32/lib1ec/Adafruit SSD1306/Adafruit_SSD1306.cpp.o
      Compiling .pio/build/featheresp32/libe07/OneButton/OneButton.cpp.o
      Compiling .pio/build/featheresp32/lib928/Time/DateStrings.cpp.o
      Archiving .pio/build/featheresp32/libe08/libAdafruit BusIO.a
      Archiving .pio/build/featheresp32/libc6b/libWire.a
      Archiving .pio/build/featheresp32/libe29/libSPI.a
      Archiving .pio/build/featheresp32/libdd7/libEsp32PcntEncoder.a
      Indexing .pio/build/featheresp32/libe08/libAdafruit BusIO.a
      Archiving .pio/build/featheresp32/lib72b/libEsp32McpwmMotor.a
      Archiving .pio/build/featheresp32/lib233/libmicro_ros_platformio.a
      Indexing .pio/build/featheresp32/libc6b/libWire.a
      Indexing .pio/build/featheresp32/libe29/libSPI.a
      Indexing .pio/build/featheresp32/libdd7/libEsp32PcntEncoder.a
      Indexing .pio/build/featheresp32/lib72b/libEsp32McpwmMotor.a
      Indexing .pio/build/featheresp32/lib233/libmicro_ros_platformio.a
      Compiling .pio/build/featheresp32/lib928/Time/Time.cpp.o
      Compiling .pio/build/featheresp32/lib726/Displays/fishbot_display.cpp.o
      Compiling .pio/build/featheresp32/libed7/FishbotUtils/fishbot_utils.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFi.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiAP.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiClient.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiGeneric.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiMulti.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiSTA.cpp.o
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiScan.cpp.o
      Archiving .pio/build/featheresp32/lib928/libTime.a
      Archiving .pio/build/featheresp32/lib609/libAdafruit GFX Library.a
      Indexing .pio/build/featheresp32/lib928/libTime.a
      Archiving .pio/build/featheresp32/lib1ec/libAdafruit SSD1306.a
      Indexing .pio/build/featheresp32/lib609/libAdafruit GFX Library.a
      Archiving .pio/build/featheresp32/libe07/libOneButton.a
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiServer.cpp.o
      Indexing .pio/build/featheresp32/lib1ec/libAdafruit SSD1306.a
      Compiling .pio/build/featheresp32/lib146/WiFi/WiFiUdp.cpp.o
      Indexing .pio/build/featheresp32/libe07/libOneButton.a
      Compiling .pio/build/featheresp32/liba1b/MicroRosRwm/micro_ros_transport_serial.cpp.o
      Compiling .pio/build/featheresp32/liba1b/MicroRosRwm/micro_ros_transport_wifi_udp.cpp.o
      Compiling .pio/build/featheresp32/liba10/BluetoothSerial/BTAddress.cpp.o
      Compiling .pio/build/featheresp32/liba10/BluetoothSerial/BTAdvertisedDeviceSet.cpp.o
      Compiling .pio/build/featheresp32/liba10/BluetoothSerial/BTScanResultsSet.cpp.o
      Archiving .pio/build/featheresp32/libed7/libFishbotUtils.a
      Archiving .pio/build/featheresp32/lib726/libDisplays.a
      Indexing .pio/build/featheresp32/libed7/libFishbotUtils.a
      Indexing .pio/build/featheresp32/lib726/libDisplays.a
      Compiling .pio/build/featheresp32/liba10/BluetoothSerial/BluetoothSerial.cpp.o
      Compiling .pio/build/featheresp32/lib92b/Kinematics/Kinematics.cpp.o
      Compiling .pio/build/featheresp32/lib47c/PidController/PidController.cpp.o
      Compiling .pio/build/featheresp32/lib10d/Preferences/Preferences.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/Esp.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/FirmwareMSC.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/FunctionalInterrupt.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/HWCDC.cpp.o
      Archiving .pio/build/featheresp32/lib92b/libKinematics.a
      Archiving .pio/build/featheresp32/lib47c/libPidController.a
      Archiving .pio/build/featheresp32/lib146/libWiFi.a
      Indexing .pio/build/featheresp32/lib92b/libKinematics.a
      Archiving .pio/build/featheresp32/liba1b/libMicroRosRwm.a
      Indexing .pio/build/featheresp32/lib47c/libPidController.a
      Indexing .pio/build/featheresp32/lib146/libWiFi.a
      Indexing .pio/build/featheresp32/liba1b/libMicroRosRwm.a
      Compiling .pio/build/featheresp32/FrameworkArduino/HardwareSerial.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/IPAddress.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/IPv6Address.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/MD5Builder.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/Print.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/Stream.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/StreamString.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/Tone.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/USB.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/USBCDC.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/USBMSC.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/WMath.cpp.o
      Archiving .pio/build/featheresp32/lib10d/libPreferences.a
      Indexing .pio/build/featheresp32/lib10d/libPreferences.a
      Compiling .pio/build/featheresp32/FrameworkArduino/WString.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/base64.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/cbuf.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-adc.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-bt.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-cpu.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-dac.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-gpio.c.o
      Archiving .pio/build/featheresp32/liba10/libBluetoothSerial.a
      Indexing .pio/build/featheresp32/liba10/libBluetoothSerial.a
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-i2c-slave.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-i2c.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-ledc.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-matrix.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-misc.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-psram.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-rgb-led.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-rmt.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-sigmadelta.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-spi.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-time.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-timer.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-tinyusb.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-touch.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/esp32-hal-uart.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/firmware_msc_fat.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/libb64/cdecode.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/libb64/cencode.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/main.cpp.o
      Compiling .pio/build/featheresp32/FrameworkArduino/stdlib_noniso.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/wiring_pulse.c.o
      Compiling .pio/build/featheresp32/FrameworkArduino/wiring_shift.c.o
      Archiving .pio/build/featheresp32/libFrameworkArduino.a
      Indexing .pio/build/featheresp32/libFrameworkArduino.a
      Linking .pio/build/featheresp32/firmware.elf
      Retrieving maximum program size .pio/build/featheresp32/firmware.elf
      Checking size .pio/build/featheresp32/firmware.elf
      Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
      RAM:   [===       ]  27.7% (used 90760 bytes from 327680 bytes)
      Flash: [=====     ]  50.1% (used 1577545 bytes from 3145728 bytes)
      Building .pio/build/featheresp32/firmware.bin
      esptool.py v4.2.1
      Creating esp32 image...
      Merged 25 ELF sections
      Successfully created esp32 image.
      ======================================================================================================================================================================= [SUCCESS] Took 362.75 seconds =======================================================================================================================================================================
       *  终端将被任务重用,按任意键关闭。 
      
      

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

      今天吃几顿今 8477189568 4439640734 3 条回复 最后回复 回复 引用 0
      • 小鱼小 小鱼 将这个主题标记为已解决,在
      • 今天吃几顿今
        今天吃几顿 @小鱼
        最后由 编辑

        @小鱼 我删除那个文件后,他又自动下载了一个,然后报错Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino)

        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/liyanshen/.platformio/penv/bin/python -m pip install pyyaml
          Requirement already satisfied: pyyaml in /home/liyanshen/.platformio/penv/lib/python3.10/site-packages (6.0)
          Installing markupsafe==2.0.1 with pip at PlatformIO environment
          /home/liyanshen/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
          Requirement already satisfied: markupsafe==2.0.1 in /home/liyanshen/.platformio/penv/lib/python3.10/site-packages (2.0.1)
          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
          Building in release mode
          Compiling .pio/build/featheresp32/libfab/Adafruit SSD1306/Adafruit_SSD1306.cpp.o
          In file included from .pio/libdeps/featheresp32/Adafruit SSD1306/Adafruit_SSD1306.cpp:53:
          .pio/libdeps/featheresp32/Adafruit SSD1306/Adafruit_SSD1306.h:42:10: fatal error: Adafruit_GFX.h: No such file or directory

        • Looking for Adafruit_GFX.h dependency? Check our library registry!
        • CLI > platformio lib
        1 条回复 最后回复 回复 引用 0
        • 小伊小
          机器人小伊
          最后由 编辑

          从你的报错信息来看,应该是你没有安装 Adafruit_GFX.h 的依赖。你可以使用 platformio lib 命令来查找并安装这个依赖,然后重新编译你的代码,就可以解决问题了。


          以上为生成回答,仅供参考~

          我是小伊,已接入ChatGpt,所有回复,仅供参考~

          今天吃几顿今 1 条回复 最后回复 回复 引用 0
          • 今天吃几顿今
            今天吃几顿 @小伊
            最后由 编辑

            @小伊 报错#include <Adafruit_I2CDevice.h>
            ^~~~~~~~~~~~~~~~~~~~~~
            compilation terminated.
            Compiling .pio/build/featheresp32/libfab/Adafruit SSD1306/Adafruit_SSD1306.cpp.o
            In file included from .pio/libdeps/featheresp32/Adafruit SSD1306/Adafruit_SSD1306.h:42,
            from .pio/libdeps/featheresp32/Adafruit SSD1306/Adafruit_SSD1306.cpp:53:
            .pio/libdeps/featheresp32/Adafruit GFX Library/Adafruit_GFX.h:12:10: fatal error: Adafruit_I2CDevice.h: No such file or directory


            • Looking for Adafruit_I2CDevice.h dependency? Check our library registry!
            • CLI > platformio lib search "header:Adafruit_I2CDevice.h"
            • Web > https://registry.platformio.org/search?q=header:Adafruit_I2CDevice.h

            #include <Adafruit_I2CDevice.h>
            ^~~~~~~~~~~~~~~~~~~~~~
            compilation terminated.
            Compiling .pio/build/featheresp32/libf0a/GFX Library for Arduino/Arduino_DataBus.cpp.o
            Compiling .pio/build/featheresp32/libf0a/GFX Library for Arduino/Arduino_G.cpp.o
            *** [.pio/build/featheresp32/liba41/Adafruit GFX Library/Adafruit_GFX.cpp.o] Error 1
            *** [.pio/build/featheresp32/liba41/Adafruit GFX Library/Adafruit_GrayOLED.cpp.o] Error 1
            *** [.pio/build/featheresp32/liba41/Adafruit GFX Library/Adafruit_SPITFT.cpp.o] Error 1
            *** [.pio/build/featheresp32/libfab/Adafruit SSD1306/Adafruit_SSD1306.cpp.o] Error 1
            =============== [FAILED] Took 6.50 seconds ===============

            • 终端进程“platformio 'run'”已终止,退出代码: 1。
            • 终端将被任务重用,按任意键关闭。
            1 条回复 最后回复 回复 引用 0
            • 小伊小
              机器人小伊
              最后由 编辑

              从上面的报错信息可以看出,缺少Adafruit_I2CDevice.h文件,可以在PlatformIO库中搜索,然后下载安装对应的库文件,或者在Github上找到对应的文件,然后添加到项目中即可。


              以上为生成回答,仅供参考~

              我是小伊,已接入ChatGpt,所有回复,仅供参考~

              1 条回复 最后回复 回复 引用 0
              • 8477189568
                H. @小鱼
                最后由 847718956 编辑

                @小鱼 我根据这篇CSDN的步骤添加Adafruit BusIO依赖库

                lib_deps = 
                	https://gitee.com/ohhuo/micro_ros_platformio.git
                	adafruit/Adafruit SSD1306@^2.5.7
                	adafruit/Adafruit BusIO@^1.14.1```
                

                删除.pio/libdeps/featheresp32/micro_ros_platformio/libmicroros文件夹

                不是pio/libdeps/featheresp32/micro_ros_platformio文件夹,这样文件会在重新编译后重新生成该文件

                重新编译出现下面问题

                Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino)
                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                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/xhy/.platformio/penv/bin/python -m pip install pyyaml
                Requirement already satisfied: pyyaml in /home/xhy/.platformio/penv/lib/python3.10/site-packages (6.0)
                
                [notice] A new release of pip is available: 23.0 -> 23.0.1
                [notice] To update, run: pip install --upgrade pip
                Installing markupsafe==2.0.1 with pip at PlatformIO environment
                /home/xhy/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
                Requirement already satisfied: markupsafe==2.0.1 in /home/xhy/.platformio/penv/lib/python3.10/site-packages (2.0.1)
                
                [notice] A new release of pip is available: 23.0 -> 23.0.1
                [notice] To update, run: pip install --upgrade pip
                Configuring featheresp32 with transport serial
                Downloading micro-ROS dev dependencies
                         - Downloaded ament_cmake
                         - Downloaded ament_lint
                         - Downloaded ament_package
                         - Downloaded googletest
                         - Downloaded ament_cmake_ros
                         - Downloaded ament_index
                Building micro-ROS dev dependencies
                Downloading micro-ROS library
                         - Downloaded microcdr
                         - Downloaded microxrcedds_client
                         - Downloaded rcl
                         - Downloaded rcl_yaml_param_parser (ignored)
                         - Downloaded rcl_lifecycle
                         - Downloaded rcl_action
                         - Downloaded rclc
                         - Downloaded rclc_parameter
                         - Downloaded rclc_examples (ignored)
                         - Downloaded rclc_lifecycle
                         - Downloaded micro_ros_utilities
                         - Downloaded rcutils
                         - Downloaded micro_ros_msgs
                         - Downloaded rmw_microxrcedds
                         - Downloaded rosidl_typesupport_cpp (ignored)
                         - Downloaded rosidl_typesupport_c
                         - Downloaded rosidl_typesupport_microxrcedds_cpp_tests
                         - Downloaded rosidl_typesupport_microxrcedds_test_msg
                         - Downloaded rosidl_typesupport_microxrcedds_c_tests
                         - Downloaded rosidl_typesupport_microxrcedds_cpp (ignored)
                         - Downloaded rosidl_typesupport_microxrcedds_c
                         - Downloaded rosidl_parser
                         - Downloaded rosidl_generator_cpp (ignored)
                         - Downloaded rosidl_cmake
                         - Downloaded rosidl_generator_c
                         - Downloaded rosidl_adapter
                         - Downloaded rosidl_typesupport_introspection_cpp (ignored)
                         - Downloaded rosidl_runtime_c
                         - Downloaded rosidl_typesupport_introspection_c
                         - Downloaded rosidl_typesupport_interface
                         - Downloaded rosidl_typesupport_introspection_tests
                         - Downloaded rosidl_cli
                         - Downloaded rosidl_runtime_cpp (ignored)
                         - Downloaded rmw_implementation_cmake
                         - Downloaded rmw
                         - Downloaded rcl_interfaces
                         - Downloaded action_msgs
                         - Downloaded test_msgs
                         - Downloaded lifecycle_msgs
                         - Downloaded rosgraph_msgs
                         - Downloaded builtin_interfaces
                         - Downloaded composition_interfaces
                         - Downloaded statistics_msgs
                         - Downloaded rosidl_default_generators
                         - Downloaded rosidl_default_runtime
                         - Downloaded unique_identifier_msgs
                         - Downloaded std_msgs
                         - Downloaded std_srvs
                         - Downloaded diagnostic_msgs
                         - Downloaded actionlib_msgs
                         - Downloaded nav_msgs
                         - Downloaded sensor_msgs_py
                         - Downloaded sensor_msgs
                         - Downloaded shape_msgs
                         - Downloaded trajectory_msgs
                         - Downloaded stereo_msgs
                         - Downloaded common_interfaces
                         - Downloaded visualization_msgs
                         - Downloaded geometry_msgs
                         - Downloaded test_interface_files
                         - Downloaded rmw_implementation
                         - Downloaded test_rmw_implementation
                         - Downloaded rcl_logging_interface
                         - Downloaded rcl_logging_noop
                         - Downloaded rcl_logging_spdlog (ignored)
                         - Downloaded tracetools_trace
                         - Downloaded test_tracetools
                         - Downloaded test_tracetools_launch
                         - Downloaded tracetools
                         - Downloaded tracetools_launch
                         - Downloaded tracetools_test
                         - Downloaded tracetools_read
                         - Downloaded ros2trace
                         - Downloaded example_interfaces
                Checking extra packages
                         - Adding fishbot_interfaces
                Checking extra packages
                         - Adding fishbot_interfaces
                Building micro-ROS library
                Build mcu micro-ROS environment failed: 
                --- stderr: rosidl_typesupport_interface
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    CMAKE_POSITION_INDEPENDENT_CODE
                    THIRDPARTY
                
                
                ---
                --- stderr: rosidl_cli
                /home/xhy/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
                  warnings.warn(
                ---
                --- stderr: rmw_implementation_cmake
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_SHARED_LIBS
                    CMAKE_POSITION_INDEPENDENT_CODE
                    THIRDPARTY
                
                
                ---
                --- stderr: microcdr
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_TESTING
                    THIRDPARTY
                
                
                ---
                --- stderr: rosidl_adapter
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_SHARED_LIBS
                    CMAKE_POSITION_INDEPENDENT_CODE
                    THIRDPARTY
                
                
                ---
                --- stderr: tracetools
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: rcutils
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    ENABLE_TESTING
                    THIRDPARTY
                
                
                In function 'rcutils_char_array_strncat',
                    inlined from 'rcutils_char_array_strcat' at /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/char_array.c:239:10:
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/char_array.c:224:3: warning: 'strncat' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
                   strncat(char_array->buffer, src, n);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/char_array.c: In function 'rcutils_char_array_strcat':
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/char_array.c:239:10: note: length computed here
                   return rcutils_char_array_strncat(char_array, src, strlen(src));
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c: In function 'rcutils_get_error_string':
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:240:38: warning: initializer-string for array of chars is too long
                     return (rcutils_error_string_t) {"error not set"};  // NOLINT(readability/braces)
                                                      ^~~~~~~~~~~~~~~
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:240:38: note: (near initialization for '(anonymous).str')
                In file included from /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:35:
                At top level:
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:109:1: warning: '__rcutils_convert_uint64_t_into_c_str' defined but not used [-Wunused-function]
                 __rcutils_convert_uint64_t_into_c_str(uint64_t number, char * buffer, size_t buffer_size)
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:91:1: warning: '__rcutils_reverse_str' defined but not used [-Wunused-function]
                 __rcutils_reverse_str(char * string_in, size_t string_len)
                 ^~~~~~~~~~~~~~~~~~~~~
                ---
                --- stderr: rosidl_parser
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_SHARED_LIBS
                    CMAKE_POSITION_INDEPENDENT_CODE
                    THIRDPARTY
                
                
                ---
                --- stderr: tracetools_trace
                /home/xhy/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
                  warnings.warn(
                ---
                --- stderr: rosidl_cmake
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_SHARED_LIBS
                    CMAKE_POSITION_INDEPENDENT_CODE
                    THIRDPARTY
                
                
                ---
                --- stderr: rosidl_runtime_c
                CMake Warning at /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
                  Package 'rcutils' exports library 'dl' which couldn't be found
                Call Stack (most recent call first):
                  /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
                  CMakeLists.txt:15 (find_package)
                
                
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: rcl_logging_interface
                CMake Warning at /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
                  Package 'rcutils' exports library 'dl' which couldn't be found
                Call Stack (most recent call first):
                  /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
                  CMakeLists.txt:19 (find_package)
                
                
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: microxrcedds_client
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_TESTING
                    THIRDPARTY
                
                
                ---
                --- stderr: test_interface_files
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    BUILD_SHARED_LIBS
                    CMAKE_POSITION_INDEPENDENT_CODE
                    THIRDPARTY
                
                
                ---
                --- stderr: rcl_logging_noop
                CMake Warning at /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
                  Package 'rcutils' exports library 'dl' which couldn't be found
                Call Stack (most recent call first):
                  /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
                  /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcl_logging_interface/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
                  /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcl_logging_interface/cmake/rcl_logging_interfaceConfig.cmake:41 (include)
                  CMakeLists.txt:15 (find_package)
                
                
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: rosidl_typesupport_introspection_c
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: rosidl_generator_c
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: rmw
                CMake Warning at /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
                  Package 'rcutils' exports library 'dl' which couldn't be found
                Call Stack (most recent call first):
                  /home/xhy/Documents/PlatformIO/Projects/oled_interface/.pio/libdeps/featheresp32/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
                  CMakeLists.txt:21 (find_package)
                
                
                CMake Warning:
                  Manually-specified variables were not used by the project:
                
                    THIRDPARTY
                
                
                ---
                --- stderr: tracetools_launch
                /home/xhy/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
                  warnings.warn(
                ---
                --- stderr: tracetools_read
                /home/xhy/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
                  warnings.warn(
                ---
                --- stderr: fishbot_interfaces
                CMake Error at CMakeLists.txt:26 (find_package):
                  By not providing "Findrosidl_default_generators.cmake" in CMAKE_MODULE_PATH
                  this project has asked CMake to find a package configuration file provided
                  by "rosidl_default_generators", but CMake did not find one.
                
                  Could not find a package configuration file provided by
                  "rosidl_default_generators" with any of the following names:
                
                    rosidl_default_generatorsConfig.cmake
                    rosidl_default_generators-config.cmake
                
                  Add the installation prefix of "rosidl_default_generators" to
                  CMAKE_PREFIX_PATH or set "rosidl_default_generators_DIR" to a directory
                  containing one of the above files.  If "rosidl_default_generators" provides
                  a separate development package or SDK, be sure it has been installed.
                
                
                ---
                Failed   <<< fishbot_interfaces [3.79s, exited with code 1]
                
                =========================================================================== [FAILED] Took 271.51 seconds ===========================================================================
                
                 *  终端进程“platformio 'run'”已终止,退出代码: 1。 
                 *  终端将被任务重用,按任意键关闭。 
                
                
                小鱼小 1 条回复 最后回复 回复 引用 0
                • 8477189568 847718956 将这个主题标记为未解决,在
                • 小鱼小
                  小鱼 技术大佬 @847718956
                  最后由 编辑

                  @847718956 这个错误好解决了

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

                  CMake Error at CMakeLists.txt:26 (find_package):
                  By not providing "Findrosidl_default_generators.cmake" in CMAKE_MODULE_PATH
                  this project has asked CMake to find a package configuration file provided
                  by "rosidl_default_generators", but CMake did not find one.

                  Could not find a package configuration file provided by
                  "rosidl_default_generators" with any of the following names:

                  rosidl_default_generatorsConfig.cmake
                  rosidl_default_generators-config.cmake
                  

                  Add the installation prefix of "rosidl_default_generators" to
                  CMAKE_PREFIX_PATH or set "rosidl_default_generators_DIR" to a directory
                  containing one of the above files. If "rosidl_default_generators" provides
                  a separate development package or SDK, be sure it has been installed.

                  确认下CMakeList.txt

                  cmake_minimum_required(VERSION 3.5)
                  project(fishbot_interfaces)
                  
                  
                  
                  if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
                    add_compile_options(-Wall -Wextra -Wpedantic)
                  endif()
                  
                  # find dependencies
                  find_package(ament_cmake REQUIRED)
                  # uncomment the following section in order to fill in
                  # further dependencies manually.
                  # find_package(<dependency> REQUIRED)
                  
                  if(BUILD_TESTING)
                    find_package(ament_lint_auto REQUIRED)
                    # the following line skips the linter which checks for copyrights
                    # uncomment the line when a copyright and license is not present in all source files
                    #set(ament_cmake_copyright_FOUND TRUE)
                    # the following line skips cpplint (only works in a git repo)
                    # uncomment the line when this package is not in a git repo
                    #set(ament_cmake_cpplint_FOUND TRUE)
                    ament_lint_auto_find_test_dependencies()
                  endif()
                  
                  find_package(rosidl_default_generators REQUIRED)
                  
                  rosidl_generate_interfaces(${PROJECT_NAME}
                    "srv/OledControl.srv"
                   )
                  
                  ament_package()
                  
                  

                  packages.xml

                  <?xml version="1.0"?>
                  <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
                  <package format="3">
                    <name>fishbot_interfaces</name>
                    <version>0.0.0</version>
                    <description>TODO: Package description</description>
                    <maintainer email="root@todo.todo">root</maintainer>
                    <license>TODO: License declaration</license>
                  
                    <buildtool_depend>ament_cmake</buildtool_depend>
                  
                    <build_depend>rosidl_default_generators</build_depend>
                    <exec_depend>rosidl_default_runtime</exec_depend>
                    <member_of_group>rosidl_interface_packages</member_of_group>
                  
                    <test_depend>ament_lint_auto</test_depend>
                    <test_depend>ament_lint_common</test_depend>
                  
                    <export>
                      <build_type>ament_cmake</build_type>
                    </export>
                  </package>
                  
                  

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

                  1 条回复 最后回复 回复 引用 0
                  • 小鱼小 小鱼 在 中 引用了 这个主题
                  • 4439640734
                    房间里的大象 @小鱼
                    最后由 编辑

                    @小鱼 这里下载太慢了。挂梯子也一样

                    1 条回复 最后回复 回复 引用 0
                    • 19916236831
                      1991623683
                      最后由 编辑

                      有一个问题,用git 克隆代码,编译出现错误:15795905-ed0a-427c-8303-868a76c3aa1b-图片.png ,请问是什么问题

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

                        @1991623683 有重新编译过吗,删掉libmicroros

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

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

                          该贴中的方法都试过了还是不行,有兄弟们解决了的吗,
                          platformio.ini,因为报错,根据提示也加了很多依赖,还是不行

                          lib_deps = 
                          	https://gitee.com/ohhuo/micro_ros_platformio.git
                          	adafruit/Adafruit SSD1306@^2.5.7
                          	; adafruit/Adafruit GFX Library@^1.11.8
                          	; adafruit/Adafruit BusIO@^1.14.4
                          	; ; fabiobatsilva/ArduinoFake@^0.4.0
                          
                          小鱼小 1 条回复 最后回复 回复 引用 0
                          • 小鱼小
                            小鱼 技术大佬 @842145248
                            最后由 编辑

                            @842145248 你的报错是什么

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

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

                              @小鱼 刚刚重新编译了下,好慢,麻烦大佬帮我看看

                              Building micro-ROS library
                              Found 36 compatible libraries
                              Scanning dependencies...
                              Dependency Graph
                              |-- micro_ros_platformio @ 0.0.1+sha.085c5dd
                              |-- Adafruit SSD1306 @ 2.5.7
                              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.
                              Compiling .pio/build/featheresp32/lib1a4/micro_ros_platformio/platform_code/arduino/clock_gettime.cpp.o
                              Compiling .pio/build/featheresp32/lib1a4/micro_ros_platformio/platform_code/arduino/serial/micro_ros_transport.cpp.o
                              Compiling .pio/build/featheresp32/lib2c3/Adafruit SSD1306/Adafruit_SSD1306.cpp.o
                              In file included from .pio/libdeps/featheresp32/Adafruit SSD1306/Adafruit_SSD1306.cpp:53:
                              .pio/libdeps/featheresp32/Adafruit SSD1306/Adafruit_SSD1306.h:42:10: fatal error: Adafruit_GFX.h: No such file or directory
                              
                              **********************************************************************
                              * Looking for Adafruit_GFX.h dependency? Check our library registry!
                              *
                              * CLI  > platformio lib search "header:Adafruit_GFX.h"
                              * Web  > https://registry.platformio.org/search?q=header:Adafruit_GFX.h
                              *
                              **********************************************************************
                              
                               #include <Adafruit_GFX.h>
                                        ^~~~~~~~~~~~~~~~
                              compilation terminated.
                              Compiling .pio/build/featheresp32/FrameworkArduino/Esp.cpp.o
                              Compiling .pio/build/featheresp32/FrameworkArduino/FirmwareMSC.cpp.o
                              *** [.pio/build/featheresp32/lib2c3/Adafruit SSD1306/Adafruit_SSD1306.cpp.o] Error 1
                              ======================================== [FAILED] Took 658.83 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 再贴一下完整的代码

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

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

                                  @小鱼
                                  platformio.ini

                                  [env:featheresp32]
                                  platform = espressif32
                                  board = featheresp32
                                  framework = arduino
                                  lib_deps = 
                                  	https://gitee.com/ohhuo/micro_ros_platformio.git
                                  	adafruit/Adafruit SSD1306@^2.5.7
                                  

                                  CMakeLists.txt

                                  cmake_minimum_required(VERSION 3.5)
                                  project(fishbot_interfaces)
                                  
                                  
                                  
                                  if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
                                    add_compile_options(-Wall -Wextra -Wpedantic)
                                  endif()
                                  
                                  # find dependencies
                                  find_package(ament_cmake REQUIRED)
                                  # uncomment the following section in order to fill in
                                  # further dependencies manually.
                                  # find_package(<dependency> REQUIRED)
                                  
                                  if(BUILD_TESTING)
                                    find_package(ament_lint_auto REQUIRED)
                                    # the following line skips the linter which checks for copyrights
                                    # uncomment the line when a copyright and license is not present in all source files
                                    #set(ament_cmake_copyright_FOUND TRUE)
                                    # the following line skips cpplint (only works in a git repo)
                                    # uncomment the line when this package is not in a git repo
                                    #set(ament_cmake_cpplint_FOUND TRUE)
                                    ament_lint_auto_find_test_dependencies()
                                  endif()
                                  
                                  find_package(rosidl_default_generators REQUIRED)
                                  
                                  rosidl_generate_interfaces(${PROJECT_NAME}
                                    "srv/OledControl.srv"
                                   )
                                  
                                  ament_package()
                                  

                                  package.xml

                                  <?xml version="1.0"?>
                                  <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
                                  <package format="3">
                                    <name>fishbot_interfaces</name>
                                    <version>0.0.0</version>
                                    <description>TODO: Package description</description>
                                    <maintainer email="root@todo.todo">root</maintainer>
                                    <license>TODO: License declaration</license>
                                  
                                    <buildtool_depend>ament_cmake</buildtool_depend>
                                  
                                    <build_depend>rosidl_default_generators</build_depend>
                                    <exec_depend>rosidl_default_runtime</exec_depend>
                                    <member_of_group>rosidl_interface_packages</member_of_group>
                                  
                                    <test_depend>ament_lint_auto</test_depend>
                                    <test_depend>ament_lint_common</test_depend>
                                  
                                    <export>
                                      <build_type>ament_cmake</build_type>
                                    </export>
                                  </package>
                                  

                                  extra_package包

                                  extra_packages/fishbot_interfaces/
                                  ├── CMakeLists.txt
                                  ├── include
                                  │   └── fishbot_interfaces
                                  ├── package.xml
                                  ├── src
                                  └── srv
                                      └── OledControl.srv
                                  
                                  小鱼小 1 条回复 最后回复 回复 引用 0
                                  • 小鱼小
                                    小鱼 技术大佬 @842145248
                                    最后由 编辑

                                    @842145248 是 src/main.cpp ,你的错误在 main函数里不是自定义功能包造成的

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

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

                                      @小鱼 感谢大佬的的回复,我补充完整了main.cpp后可以编译了,我按照教程还没到编写main.cpp,我以为不用先写main.cpp😂 ,编译看看是否有错

                                      但是命令行调用服务时出现了类似这种导包问题:重新运行代码时出现:UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'village_interfaces', CMakelist.txt 和 packages.xml,看着好像都没问题,麻烦大佬再帮我看看

                                      $ source install/setup.bash  && 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'
                                      

                                      main.cpp

                                      #include <Arduino.h>
                                      #include <micro_ros_platformio.h>
                                      
                                      #include <rcl/rcl.h>
                                      #include <rclc/rclc.h>
                                      #include <rclc/executor.h>
                                      #include <micro_ros_utilities/string_utilities.h>
                                      
                                      #include "Wire.h"
                                      #include <Adafruit_GFX.h>
                                      #include <Adafruit_SSD1306.h>
                                      
                                      #include <fishbot_interfaces/srv/oled_control.h>
                                      
                                      rclc_executor_t executor;
                                      rclc_support_t support;
                                      rcl_allocator_t allocator;
                                      rcl_node_t node;
                                      
                                      rcl_service_t service;
                                      
                                      fishbot_interfaces__srv__OledControl_Request req;
                                      fishbot_interfaces__srv__OledControl_Response res;
                                      
                                      Adafruit_SSD1306 display;
                                      
                                      void service_cb(const void *req, void *res)
                                      {
                                        fishbot_interfaces__srv__OledControl_Request *req_in = (fishbot_interfaces__srv__OledControl_Request *)req;
                                        fishbot_interfaces__srv__OledControl_Response *res_in = (fishbot_interfaces__srv__OledControl_Response *)res;
                                        display.clearDisplay();
                                        display.setCursor(req_in->px, req_in->py);
                                        display.println(req_in->data.data);
                                        display.display();
                                        res_in->result = 0;
                                      }
                                      
                                      void setup()
                                      {
                                        // put your setup code here, to run once:
                                        Serial.begin(115200);
                                        set_microros_serial_transports(Serial);
                                        delay(2000);
                                        allocator = rcl_get_default_allocator();
                                        rclc_support_init(&support, 0, NULL, &allocator);
                                        rclc_node_init_default(&node, "example14_interfaces", "", &support);
                                        rclc_service_init_default(&service, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(fishbot_interfaces, srv, OledControl), "/oled_control");
                                        rclc_executor_init(&executor, &support.context, 1, &allocator);
                                        rclc_executor_add_service(&executor, &service, &req, &res, service_cb);
                                        req.data = micro_ros_string_utilities_init_with_size(100);
                                      
                                        Wire.begin(18, 19);
                                        display = Adafruit_SSD1306(128, 64, &Wire);
                                        display.begin(SSD1306_SWITCHCAPVCC, 0x3c);
                                        display.clearDisplay();
                                        display.setTextSize(1);
                                        display.setCursor(0, 0);
                                        display.setTextColor(SSD1306_WHITE);
                                        display.println("hello world!");
                                        display.display();
                                      }
                                      
                                      void loop()
                                      {
                                        // put your main code here, to run repeatedly:
                                        delay(100);
                                        rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100));
                                      }
                                      
                                      小鱼小 1 条回复 最后回复 回复 引用 0
                                      • 小鱼小
                                        小鱼 技术大佬 @842145248
                                        最后由 编辑

                                        @842145248

                                        $ source install/setup.bash && 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 @小鱼
                                          最后由 编辑

                                          @小鱼 example14_custom_interfaces/extra_packages 目录下

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

                                            @842145248 删除掉build和install ,重新colcon build后测试,还报错就贴一下 CMakeLists.txt 和 srv文件

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

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