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

    navigation2 demo程序编译出差

    已定时 已固定 已锁定 已移动
    工具软件
    ros2 编译出错
    3
    6
    773
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • vico1999V
      vico1999
      最后由 编辑

      程序编译时,提示找不到部分hpp文件,不过我查看了一下,都是有点,这个问题困挠好久了。我用的是demo代码。我没有修改过
      ico@wp:~/fishbot_ws$ colcon build --packages-up-to fishbot_navigation2
      [0.594s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
      'nav2_map_server' is in: /opt/ros/humble
      If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
      If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

      If you understand the risks and want to override a package anyways, add the following to the command line:
      --allow-overriding nav2_map_server

      This may be promoted to an error in a future release of colcon-override-check.
      Starting >>> nav2_common
      Starting >>> nav_2d_msgs
      Finished <<< nav2_common [0.77s]
      Starting >>> nav2_msgs
      Starting >>> nav2_voxel_grid
      Finished <<< nav2_voxel_grid [0.60s]
      Finished <<< nav_2d_msgs [1.55s]
      Starting >>> dwb_msgs
      --- stderr: dwb_msgs
      In file included from /home/vico/fishbot_ws/build/dwb_msgs/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/dds_fastrtps/critic_score__type_support.cpp:4:
      /home/vico/fishbot_ws/build/dwb_msgs/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/critic_score__rosidl_typesupport_fastrtps_cpp.hpp:11:10: fatal error: dwb_msgs/msg/detail/critic_score__struct.hpp: 没有那个文件或目录
      11 | #include "dwb_msgs/msg/detail/critic_score__struct.hpp"
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      In file included from /home/vico/fishbot_ws/build/dwb_msgs/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/dds_fastrtps/local_plan_evaluation__type_support.cpp:4:
      /home/vico/fishbot_ws/build/dwb_msgs/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/local_plan_evaluation__rosidl_typesupport_fastrtps_cpp.hpp:11:10: fatal error: dwb_msgs/msg/detail/local_plan_evaluation__struct.hpp: 没有那个文件或目录
      11 | #include "dwb_msgs/msg/detail/local_plan_evaluation__struct.hpp"
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      gmake[2]: *** [CMakeFiles/dwb_msgs__rosidl_typesupport_fastrtps_cpp.dir/build.make:223:CMakeFiles/dwb_msgs__rosidl_typesupport_fastrtps_cpp.dir/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/dds_fastrtps/critic_score__type_support.cpp.o] 错误 1
      gmake[2]: *** 正在等待未完成的任务....
      gmake[2]: *** [CMakeFiles/dwb_msgs__rosidl_typesupport_fastrtps_cpp.dir/build.make:237:CMakeFiles/dwb_msgs__rosidl_typesupport_fastrtps_cpp.dir/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/dds_fastrtps/local_plan_evaluation__type_support.cpp.o] 错误 1
      In file included from /home/vico/fishbot_ws/build/dwb_msgs/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/dds_fastrtps/trajectory2_d__type_support.cpp:4:
      /home/vico/fishbot_ws/build/dwb_msgs/rosidl_typesupport_fastrtps_cpp/dwb_msgs/msg/detail/trajectory2_d__rosidl_typesupport_fastrtps_cpp.hpp:11:10: fatal error: dwb_msgs/msg/detail/trajectory2_d__struct.hpp: 没有那个文件或目录
      11 | #include "dwb_msgs/msg/detail/trajectory2_d__struct.hpp"
      选区_002.png

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

        @vico1999 如非必要请使用二进制安装,将源码中navigation2相关包删掉即可。如果需要源码编译请保证

        1. 将系统中的navigation2 删掉

        sudo apt remove ros-<你的ROS版本>-nav2*

        1. 下载对应版本的源码

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

        29180954962 1 条回复 最后回复 回复 引用 0
        • 29180954962
          天问 @小鱼
          最后由 编辑

          @小鱼 我今天也遇到了类似问题,按照鱼哥的方法,卸载后重新安装源码,现在这个重复的问题已经解决了。但是又有新的问题出现,如下:
          设备:Ubuntu20.04 foxy
          编译程序:“基于ROS2实现的Fishbot机器人仿真及实体机器人”的源码
          执行了如下命令:
          命令1:git clone https://github.com/fishros/fishbot.git -b foxy
          成功克隆
          命令2:cd fishbot
          进入到工作空间
          命令3:rosdep install --from-paths src -y
          结果:#All required rosdeps installed successfully是成功的
          命令4:colcon build
          出现错误:
          287 | auto* p = CreateMaybeMessage<::cartographer::mapping::constraints::proto::ConstraintBuilderOptions>(GetArenaNoVirtual());
          | ^~~~~~~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h:287:103: error: expected primary-expression before ‘>’ token
          287 | auto* p = CreateMaybeMessage<::cartographer::mapping::constraints::proto::ConstraintBuilderOptions>(GetArenaNoVirtual());
          | ^
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h: In member function ‘void cartographer::mapping::proto::PoseGraphOptions::set_allocated_constraint_builder_options(cartographer::mapping::constraints::proto::ConstraintBuilderOptions*)’:
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h:301:66: error: ‘GetOwnedMessage’ is not a member of ‘google::protobuf::internal’
          301 | constraint_builder_options = ::google::protobuf::internal::GetOwnedMessage(
          | ^~~~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h: In member function ‘cartographer::mapping::optimization::proto::OptimizationProblemOptions* cartographer::mapping::proto::PoseGraphOptions::mutable_optimization_problem_options()’:
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h:363:15: error: ‘CreateMaybeMessage’ was not declared in this scope
          363 | auto* p = CreateMaybeMessage<::cartographer::mapping::optimization::proto::OptimizationProblemOptions>(GetArenaNoVirtual());
          | ^~~~~~~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h:363:106: error: expected primary-expression before ‘>’ token
          363 | auto* p = CreateMaybeMessage<::cartographer::mapping::optimization::proto::OptimizationProblemOptions>(GetArenaNoVirtual());
          | ^
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h: In member function ‘void cartographer::mapping::proto::PoseGraphOptions::set_allocated_optimization_problem_options(cartographer::mapping::optimization::proto::OptimizationProblemOptions*)’:
          /opt/ros/foxy/include/cartographer/mapping/proto/pose_graph_options.pb.h:377:68: error: ‘GetOwnedMessage’ is not a member of ‘google::protobuf::internal’
          377 | optimization_problem_options = ::google::protobuf::internal::GetOwnedMessage(
          | ^~~~~~~~~~~~~~~
          In file included from /home/aq/Documents/ROS_2/fishbot/src/cartographer_core/cartographer_ros/cartographer_ros/./cartographer_ros/node_options.h:25,
          from /home/aq/Documents/ROS_2/fishbot/src/cartographer_core/cartographer_ros/cartographer_ros/./cartographer_ros/map_builder_bridge.h:29,
          from /home/aq/Documents/ROS_2/fishbot/src/cartographer_core/cartographer_ros/cartographer_ros/./cartographer_ros/node.h:31,
          from /home/aq/Documents/ROS_2/fishbot/src/cartographer_core/cartographer_ros/cartographer_ros/cartographer_ros/node.cc:17:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h: At global scope:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:201:41: error: ‘CachedSize’ in namespace ‘google::protobuf::internal’ does not name a type; did you mean ‘ToCachedSize’?
          201 | mutable ::google::protobuf::internal::CachedSize cached_size;
          | ^~~~~~~~~~
          | ToCachedSize
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h: In member function ‘virtual cartographer::mapping::proto::MapBuilderOptions* cartographer::mapping::proto::MapBuilderOptions::New() const’:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:114:12: error: ‘CreateMaybeMessage’ was not declared in this scope
          114 | return CreateMaybeMessage<MapBuilderOptions>(NULL);
          | ^~~~~~~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:114:48: error: expected primary-expression before ‘>’ token
          114 | return CreateMaybeMessage<MapBuilderOptions>(NULL);
          | ^
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h: In member function ‘virtual cartographer::mapping::proto::MapBuilderOptions* cartographer::mapping::proto::MapBuilderOptions::New(google::protobuf::Arena*) const’:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:118:12: error: ‘CreateMaybeMessage’ was not declared in this scope
          118 | return CreateMaybeMessage<MapBuilderOptions>(arena);
          | ^~~~~~~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:118:48: error: expected primary-expression before ‘>’ token
          118 | return CreateMaybeMessage<MapBuilderOptions>(arena);
          | ^
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h: In member function ‘virtual int cartographer::mapping::proto::MapBuilderOptions::GetCachedSize() const’:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:134:44: error: ‘cached_size’ was not declared in this scope
          134 | int GetCachedSize() const final { return cached_size.Get(); }
          | ^~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h: In member function ‘cartographer::mapping::proto::PoseGraphOptions* cartographer::mapping::proto::MapBuilderOptions::mutable_pose_graph_options()’:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:280:15: error: ‘CreateMaybeMessage’ was not declared in this scope
          280 | auto* p = CreateMaybeMessage<::cartographer::mapping::proto::PoseGraphOptions>(GetArenaNoVirtual());
          | ^~~~~~~~~~~~~~~~~~
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:280:82: error: expected primary-expression before ‘>’ token
          280 | auto* p = CreateMaybeMessage<::cartographer::mapping::proto::PoseGraphOptions>(GetArenaNoVirtual());
          | ^
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h: In member function ‘void cartographer::mapping::proto::MapBuilderOptions::set_allocated_pose_graph_options(cartographer::mapping::proto::PoseGraphOptions*)’:
          /opt/ros/foxy/include/cartographer/mapping/proto/map_builder_options.pb.h:294:58: error: ‘GetOwnedMessage’ is not a member of ‘google::protobuf::internal’
          294 | pose_graph_options = ::google::protobuf::internal::GetOwnedMessage(
          | ^~~~~~~~~~~~~~~
          make[2]: *** [CMakeFiles/cartographer_ros.dir/build.make:76:CMakeFiles/cartographer_ros.dir/cartographer_ros/msg_conversion.cc.o] 错误 1
          make[2]: *** [CMakeFiles/cartographer_ros.dir/build.make:63:CMakeFiles/cartographer_ros.dir/cartographer_ros/map_builder_bridge.cc.o] 错误 1
          make[2]: *** [CMakeFiles/cartographer_ros.dir/build.make:89:CMakeFiles/cartographer_ros.dir/cartographer_ros/node.cc.o] 错误 1
          make[1]: *** [CMakeFiles/Makefile2:104:CMakeFiles/cartographer_ros.dir/all] 错误 2
          make: *** [Makefile:141:all] 错误 2

          Failed <<< cartographer_ros [18.1s, exited with code 2]

          Summary: 36 packages finished [21.5s]
          1 package failed: cartographer_ros
          1 package had stderr output: cartographer_ros
          1 package not processed

          我应该如何解决,已经困在这两三天了😢

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

            @2918095496 建议切换 humble 版本,真机导航源码 foxy没适配

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

            29180954962 1 条回复 最后回复 回复 引用 0
            • 29180954962
              天问 @小鱼
              最后由 编辑

              好的,那我对应的Ubuntu版本也需要换是吧?

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

                @2918095496 是的

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

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