紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
使用colcon构建工作区时出错
-
我在跟着例程文档使用colcon构建工作区进行学习,在进行到
colcon build
时发生了如下错误:WARNING: given --rosdistro melodic but ROS_DISTRO is "humble". Ignoring environment. #All required rosdeps installed successfully yyh@yyh-device:~/ros_dev_ws$ colcon build [0.193s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces: 'turtlesim' 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 turtlesim This may be promoted to an error in a future release of colcon-override-check. Starting >>> turtlesim --- stderr: turtlesim /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp: In member function ‘void TeleopTurtle::sendGoal(float)’: /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:200:5: error: no match for ‘operator=’ (operand types are ‘rclcpp_action::Client<turtlesim::action::RotateAbsolute>::GoalResponseCallback’ {aka ‘std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>’} and ‘TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>’) 200 | }; | ^ In file included from /usr/include/c++/11/future:47, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:1: /usr/include/c++/11/bits/std_function.h:530:9: note: candidate: ‘template<class _Functor> std::function<_Res(_ArgTypes ...)>::_Requires<std::function<_Res(_ArgTypes ...)>::_Callable<_Functor>, std::function<_Res(_ArgTypes ...)>&> std::function<_Res(_ArgTypes ...)>::operator=(_Functor&&) [with _Functor = _Functor; _Res = void; _ArgTypes = {std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >}]’ 530 | operator=(_Functor&& __f) | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:530:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/11/bits/move.h:57, from /usr/include/c++/11/bits/stl_pair.h:59, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/memory:63, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:153, from /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:1: /usr/include/c++/11/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>&]’: /usr/include/c++/11/bits/std_function.h:353:8: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp> using _Requires = std::__enable_if_t<_Cond::value, _Tp> [with _Cond = std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>::_Callable<TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>, TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>, std::__invoke_result<TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>&, std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > > >; _Tp = std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>&; _Res = void; _ArgTypes = {std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >}]’ /usr/include/c++/11/bits/std_function.h:530:2: required by substitution of ‘template<class _Functor> std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>::_Requires<std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>::_Callable<_Functor, typename std::enable_if<(! std::is_same<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type, std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)> >::value), std::decay<_Tp> >::type::type, std::__invoke_result<typename std::enable_if<(! std::is_same<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type, std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)> >::value), std::decay<_Tp> >::type::type&, std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > > >, std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>&> std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>::operator=<_Functor>(_Functor&&) [with _Functor = TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>]’ /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:200:5: required from here /usr/include/c++/11/type_traits:2205:11: error: no type named ‘type’ in ‘struct std::enable_if<false, std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>&>’ 2205 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /usr/include/c++/11/future:47, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:1: /usr/include/c++/11/bits/std_function.h:540:9: note: candidate: ‘template<class _Functor> std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(std::reference_wrapper<_Functor>) [with _Functor = _Functor; _Res = void; _ArgTypes = {std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >}]’ 540 | operator=(reference_wrapper<_Functor> __f) noexcept | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:540:9: note: template argument deduction/substitution failed: /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:200:5: note: ‘TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>’ is not derived from ‘std::reference_wrapper<_Tp>’ 200 | }; | ^ In file included from /usr/include/c++/11/future:47, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/yyh/ros_dev_ws/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:1: /usr/include/c++/11/bits/std_function.h:469:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(const std::function<_Res(_ArgTypes ...)>&) [with _Res = void; _ArgTypes = {std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >}]’ 469 | operator=(const function& __x) | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:469:33: note: no known conversion for argument 1 from ‘TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>’ to ‘const std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>&’ 469 | operator=(const function& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/std_function.h:487:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(std::function<_Res(_ArgTypes ...)>&&) [with _Res = void; _ArgTypes = {std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >}]’ 487 | operator=(function&& __x) noexcept | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:487:28: note: no known conversion for argument 1 from ‘TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>’ to ‘std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>&&’ 487 | operator=(function&& __x) noexcept | ~~~~~~~~~~~^~~ /usr/include/c++/11/bits/std_function.h:501:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(std::nullptr_t) [with _Res = void; _ArgTypes = {std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >}; std::nullptr_t = std::nullptr_t]’ 501 | operator=(nullptr_t) noexcept | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:501:17: note: no known conversion for argument 1 from ‘TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>’ to ‘std::nullptr_t’ 501 | operator=(nullptr_t) noexcept | ^~~~~~~~~ gmake[2]: *** [CMakeFiles/turtle_teleop_key.dir/build.make:76:CMakeFiles/turtle_teleop_key.dir/tutorials/teleop_turtle_key.cpp.o] 错误 1 gmake[1]: *** [CMakeFiles/Makefile2:628:CMakeFiles/turtle_teleop_key.dir/all] 错误 2 gmake: *** [Makefile:146:all] 错误 2 --- Failed <<< turtlesim [2.10s, exited with code 2] Summary: 0 packages finished [2.25s] 1 package failed: turtlesim 1 package had stderr output: turtlesim
系统环境ubuntu22.04,ros2安装正确,前面的教程反馈正常
在不加入turtlesim时使用空文件colcon build成功
请问这种情况该怎么解决? -
-
-
-
@280390510 在 使用colcon构建工作区时出错 中说:
given --rosdistro melodic but ROS_DISTRO is "humble" 是不是bashrc有什么配置错误的地方