已解决,更换原文件成功
-
code_text ```Error: PermissionError: Traceback (most recent call last): File "/home/fishros/.platformio/penv/lib/python3.10/site-packages/platformio/__main__.py", line 103, in main cli() # pylint: disable=no-value-for-parameter File "/home/fishros/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) File "/home/fishros/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/fishros/.platformio/penv/lib/python3.10/site-packages/platformio/cli.py", line 85, in invoke return super().invoke(ctx) File "/home/fishros/.platformio/penv/lib/python3.10/site-package...
-
背景
我在尝试实现一个用python编写的ros2节点,用来进行目标检测,我所用的ros版本为ros-humble,ubuntu系统为22.04,这个项目实际不止包含这一个包,这里我仅仅展示这个出错的包,我认为这与其他包的关系不大
问题描述节点实现完成后,使用colcon build进行编译,并尝试使用ros2 run进行运行,但是找不到package
具体细节下面给出我具体的项目结构,package.xml、setup.cfg、setup.py文件内容,以及编译结果和运行结果402d848b0992671e576ef7e21969b8a7.png
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>racecar_detector</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="3110379921@qq.com">labor</maintainer> <license>TODO: License declaration</license> <depend>rclpy</depend> <depend>sensor_msgs</denpend> <test_depend>ament_copyright</test_depend> <test_depend>ament_flake8</test_depend> <test_depend>ament_pep257</test_depend> <test_depend>python3-pytest</test_depend> <export> <build_type>ament_python</build_type> </export> </package> setup.py from setuptools import find_packages, setup package_name = 'racecar_detector' setup( name=package_name, version='0.0.0', packages=find_packages(exclude=['test']), data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), ('share/' + package_name + "/model", ['model/yolov5s_bs1.om', 'model/yolov5s.onnx']), ], install_requires=['setuptools'], zip_safe=True, maintainer='labor', maintainer_email='3110379921@qq.com', description='TODO: Package description', license='TODO: License declaration', tests_require=['pytest'], entry_points={ 'console_scripts': [ 'racecar_detector_node = racecar_detector.detector_node:main' ], }, ) setup.cfg [develop] script_dir=$base/lib/racecar_detector [install] install_scripts=$base/lib/racecar_detector这里编译时报了一个setuptools的问题,但那应该无伤大雅
尝试过的解决办法
2d42902b-0d64-4b3a-82f2-2f415d5d3786-image.png
我按照ros2-humble官方wiki文档进行的节点内容编写,并不认为这里有什么问题,我确定自己已经source过install/setup.bash文件,并且经过检查,install下确实存在racecar_detector的包,其中lib文件夹下也已生成可执行文件
56017188e58eaaf00afa07da61f08331.png我在网上进行查阅,并没有找到很有效的办法,删除install build log 文件夹,重新编译,仍然报同样的错
-
回复: [FishBot教程]7. FishBot-Nav2导航测试9025e612-c6da-45a1-9b29-d51778ca74f6-图片.png
dd2a4cd8-b244-44ca-86f2-1969b6c17b08-图片.png
04b19436-013a-4afc-9195-5499e6ed7936-图片.png
85f67117-8191-4c4b-b0c1-b59634c23701-图片.png
191c56e9-999f-4224-9f62-d714271d622b-图片.png
控制机器人跑一圈回到原点之后,此时的x,y非零了是什么原因,而且有时在rviz2中里程计原点不在网格内,而在很远处,后续的建图、导航也无法实现。而且在导航的时候并非按照导入的地图走,而是一边导航一边继续构图,按照社区回复中修改launch文件后地图成为默认地图了 -
**## 标题:**Python代码调用get_link_state和set_link_state
**### 背景:**在ros-melodic-gazebo9仿真环境里有一个运动中的机器人,为了使它在base_link运动过程中其末端link仍然保持在当前世界位置并相对世界坐标静止,我用了下述Python代码调用get_link_state和set_link_state,首先获取当前的位姿,然后循环执行set link state的服务。
**### 问题描述:**以下是完整的脚本:
#!/usr/bin/env python import rospy from gazebo_msgs.srv import GetLinkState, GetLinkStateRequest, SetLinkState, SetLinkStateRequest from geometry_msgs.msg import Pose, Point, Quaternion from std_msgs.msg import Header def get_current_pose(link_name): """ 获取指定链接的当前位姿。 :param link_name: 要获取位姿的链接名称 :return: 当前位姿的Pose对象 """ rospy.wait_for_service('/gazebo/get_link_state') try: get_link_state_service = rospy.ServiceProxy('/gazebo/get_link_state', GetLinkState) get_link_state_request = GetLinkStateRequest() get_link_state_request.link_name = link_name get_link_state_request.reference_frame = 'world' response = get_link_state_service(get_link_state_request) return response.pose except rospy.ServiceException as e: print("获取链接状态服务调用失败: %s"%e) def set_link_state(link_name, pose): """ 设置链接状态,使指定的链接相对于世界保持静止。 :param link_name: 要设置状态的链接名称 :param pose: 设置的位姿,这里我们将位置和方向都设置为0 """ rospy.wait_for_service('/gazebo/set_link_state') try: set_link_state_service = rospy.ServiceProxy('/gazebo/set_link_state', SetLinkState) set_link_state_request = SetLinkStateRequest() # 设置请求头信息 set_link_state_request.header = Header() set_link_state_request.header.stamp = rospy.Time.now() set_link_state_request.header.frame_id = 'world' # 设置链接名称 set_link_state_request.link_name = link_name # 设置目标位姿 set_link_state_request.pose = pose # 设置角速度和线速度为0 set_link_state_request.twist.linear.x = 0 set_link_state_request.twist.linear.y = 0 set_link_state_request.twist.linear.z = 0 set_link_state_request.twist.angular.x = 0 set_link_state_request.twist.angular.y = 0 set_link_state_request.twist.angular.z = 0 # 发送请求并等待响应 response = set_link_state_service(set_link_state_request) return response.success except rospy.ServiceException as e: print("设置链接状态服务调用失败: %s"%e) if __name__ == '__main__': # 初始化ROS节点 rospy.init_node('keep_link_static_example') # 设置要保持静止的链接名称 link_name = 'mobile_link' # 这里替换为目标链接名称 rate = rospy.Rate(10) # 设置循环频率为10Hz while not rospy.is_shutdown(): # 获取当前位姿 current_pose = get_current_pose(link_name) if current_pose: # 创建一个Pose消息,将位置和方向都设置为当前值 pose = Pose() pose.position = current_pose.position pose.orientation = current_pose.orientation # 调用函数设置链接状态 success = set_link_state(link_name, pose) # 打印结果 if success: print("链接 '%s' 设置为相对于世界静止成功。" % link_name) else: print("链接 '%s' 设置为相对于世界静止失败。" % link_name) else: print("无法获取链接 '%s' 的当前位姿。" % link_name) rate.sleep() # 根据设定的循环频率休眠附英文版
#!/usr/bin/env python import rospy from gazebo_msgs.srv import GetLinkState, GetLinkStateRequest, SetLinkState, SetLinkStateRequest from geometry_msgs.msg import Pose, Point, Quaternion from std_msgs.msg import Header def get_current_pose(link_name): """ Get the current pose of the specified link. :param link_name: The name of the link to get the pose for :return: The current pose of the link as a Pose object """ rospy.wait_for_service('/gazebo/get_link_state') try: get_link_state_service = rospy.ServiceProxy('/gazebo/get_link_state', GetLinkState) get_link_state_request = GetLinkStateRequest() get_link_state_request.link_name = link_name get_link_state_request.reference_frame = 'world' response = get_link_state_service(get_link_state_request) return response.pose except rospy.ServiceException as e: print("Failed to call get link state service: %s"%e) def set_link_state(link_name, pose): """ Set the state of the specified link to keep it static relative to the world. :param link_name: The name of the link to set the state for :param pose: The desired pose, here we set all position and orientation components to 0 """ rospy.wait_for_service('/gazebo/set_link_state') try: set_link_state_service = rospy.ServiceProxy('/gazebo/set_link_state', SetLinkState) set_link_state_request = SetLinkStateRequest() # Set request header information set_link_state_request.header = Header() set_link_state_request.header.stamp = rospy.Time.now() set_link_state_request.header.frame_id = 'world' # Set the link name set_link_state_request.link_name = link_name # Set the target pose set_link_state_request.pose = pose # Set the angular and linear velocities to 0 set_link_state_request.twist.linear.x = 0 set_link_state_request.twist.linear.y = 0 set_link_state_request.twist.linear.z = 0 set_link_state_request.twist.angular.x = 0 set_link_state_request.twist.angular.y = 0 set_link_state_request.twist.angular.z = 0 # Send the request and wait for the response response = set_link_state_service(set_link_state_request) return response.success except rospy.ServiceException as e: print("Failed to call set link state service: %s"%e) if __name__ == '__main__': # Initialize the ROS node rospy.init_node('keep_link_static_example') # Set the link name to keep it static link_name = 'mobile_link' # Replace with the name of the link intended to be static rate = rospy.Rate(10) # Set the loop frequency to 10Hz while not rospy.is_shutdown(): # Get the current pose of the link current_pose = get_current_pose(link_name) if current_pose: # Create a Pose message with all position and orientation components set to the current values pose = Pose() pose.position = current_pose.position pose.orientation = current_pose.orientation # Call the function to set the link state success = set_link_state(link_name, pose) # Print the result if success: print("Link '%s' set to static relative to the world successfully." % link_name) else: print("Failed to set link '%s' to static relative to the world." % link_name) else: print("Could not get the current pose of link '%s'." % link_name) rate.sleep() # Sleep based on the set loop frequency但在运行中出现许多类似的报错,经过多次反复修改依然无果,在此请教各位。报错举例(截取关键行):
Traceback (most recent call last): File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 73, in <module> current_pose = get_current_pose(link_name) File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 22, in get_current_pose return response.pose AttributeError: 'GetLinkStateResponse' object has no attribute 'pose' Traceback (most recent call last): File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 77, in <module> pose.position = current_pose.position AttributeError: 'GetLinkStateResponse' object has no attribute 'position' Traceback (most recent call last): File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 81, in <module> success = set_link_state(link_name, pose) File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 39, in set_link_state set_link_state_request.header = Header() AttributeError: 'SetLinkStateRequest' object has no attribute 'header' Traceback (most recent call last): File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 82, in <module> success = set_link_state(link_name, pose) File "/home/hyh/catkin_ws/src/bigmama0225_py/scripts/fix_link_pose0502.py", line 45, in set_link_state set_link_state_request.link_name = link_name AttributeError: 'SetLinkStateRequest' object has no attribute 'link_name'
AttributeError: 'SetLinkStateRequest' object has no attribute 'link_name'
AttributeError: 'SetLinkStateRequest' object has no attribute 'header'
AttributeError: 'GetLinkStateResponse' object has no attribute 'position'
AttributeError: 'GetLinkStateResponse' object has no attribute 'pose'
### 具体细节和上下文:
完整报错举例如下:都是致命报错,但我还是觉得该思路是最有希望的道路,因为之前试着用Python调用set_model_state能成功实现让机器人整体模型frame悬在空中(gravity=true条件下),下面附上调set_model_state服务的代码:
#!/usr/bin/env python #coding=utf-8 from gazebo_msgs.srv import GetModelState, SetModelState import rospy from gazebo_msgs.msg import ModelState from geometry_msgs.msg import Pose, Point, Quaternion from gazebo_msgs.srv import * # Initialize ROS node rospy.init_node('set_model_state_fixed') # Wait for Gazebo services to start rospy.wait_for_service('/gazebo/get_model_state') rospy.wait_for_service('/gazebo/set_model_state') # Create GetModelState service proxy get_model_state_proxy = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState) # Create SetModelState service proxy set_model_state_proxy = rospy.ServiceProxy('/gazebo/set_model_state', SetModelState) # Get the current state of the model model_name = 'robot' # Replace with your model name reference_frame= 'world' current_state = get_model_state_proxy(model_name,reference_frame) # Set the new model state to keep the model fixed in its current position model_state = ModelState() model_state.model_name = model_name model_state.pose = current_state.pose # Keep the current position # Set the linear and angular velocities of the model to zero #model_state.twist = Twist(linear=Vector3(x=0.0, y=0.0, z=0.0), angular=Vector3(x=0.0, y=0.0, z=0.0)) model_state.twist.linear.x = 0.0 model_state.twist.linear.y = 0.0 model_state.twist.linear.z = 0.0 model_state.twist.angular.x = 0.0 model_state.twist.angular.y = 0.0 model_state.twist.angular.z = 0.0 model_state.reference_frame = 'world' # Call the SetModelState service to set the model state set_model_state_proxy(model_state) # Output result print("Model state set successfully, model is now fixed in its current position.") # To ensure that the model stays fixed in its current position in future updates, we need to continuously call the SetModelState service # This can be done using a loop or other logic based on your specific requirements while not rospy.is_shutdown(): set_model_state_proxy(model_state) rospy.sleep(0.01) # Sleep for 0.01 second, adjust frequency as needed### 尝试过的解决方法:
代码部分试着删过报错中提到的各个参量,结果参量全删完了还用个毛。然后仿真部分为了让特定的link固定在管壁上试过(ros-melodic环境下)apply_body_wrench,grasp_fix_plugin,摩擦mu1mu2给到100了还是会滑移,也试过换Ubuntu22.04+RosHumble+gazebo11环境里用 apply_link_force, ros2_grasping(https://github.com/IFRA-Cranfield/ros2_RobotSimulation/tree/foxy/ros2_grasping),ros2_LinkAttacher(https://github.com/IFRA-Cranfield/IFRA_LinkAttacher),都是只能在静态时稳定,base_link那端一抬起来整个模型就飞掉最后坍缩到世界原点处。
最后还是回到ROS-melodic里面舒服点,我这VM17的虚拟机跑ros-humble跑的提心吊胆的,时不时就给你崩一下子真受不了。在座的各位前辈大神有没有用过set_link_state服务,救救我谢谢了。 -
烧录到32GBu盘到99%时显示烧录出错
-
-
U盘内存32GB可用28GB
D盘可用57.8GB
fish2os在D盘解压到U盘显示请插入磁盘
解压到D盘显示相同原无法解压 -
回复: [FishBot教程]7. FishBot-Nav2导航测试249e13019c21c61e97c649d9f8dd4d14.png 9bf18dc86bb899d2076438afb4ff0135.png
请问进行导航的时候 地图变成这个样子是怎么回事 怎么解决 -
标题:[rosdepc install --from-paths src -y出错] 背景(可选):
Ubuntu22.04 、ROS2humble、鱼香ROS2手册学习
问题描述:
fa6f7b9a-d0aa-4c3d-a45d-696b6e09183a-截图 2024-05-02 01-18-19.png从https://github.com/fishros/fishbot网址下载的fishbot模型文件,照文档手册操作到
rosdep install --from-paths src -y这一步时,出现错误
具体细节和上下文:rosdepc install --from-paths src -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
fishbot_description: Cannot locate rosdep definition for [ament_python]
6714eea0-c6fc-4a3c-869a-4013509d6fad-截图 2024-05-02 01-17-36.png 尝试过的解决方法: 已经尝试了照小鱼的方法
https://mp.weixin.qq.com/s/VGs8oWdhHH6XsHcx21lN4Q
进行下载rosdepc,还是出错误 -
IMG_20240501_170938.jpg
-
我在跟着例程文档使用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成功
请问这种情况该怎么解决?😵 -
Failed to load entry point 'test': No module named 'rclpy._rclpy_pybind11'
The C extension '/home/ubuntu-20/Desktop/ros2_humble/build/rpyutils/_rclpy_pybind11.cpython-38-aarch64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
Failed to load entry point 'doctor': No module named 'rclpy._rclpy_pybind11'
The C extension '/home/ubuntu-20/Desktop/ros2_humble/build/rpyutils/_rclpy_pybind11.cpython-38-aarch64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
Failed to load entry point 'wtf': No module named 'rclpy._rclpy_pybind11'
The C extension '/home/ubuntu-20/Desktop/ros2_humble/build/rpyutils/_rclpy_pybind11.cpython-38-aarch64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions -
采用手持雷达Cartographer建图,可以顺利建图,但会触发警告
[cartographer_node-1] [WARN] [1714496501.215460869] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 3 earlier points. [cartographer_node-1] [WARN] [1714496501.302625350] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 9 earlier points. [cartographer_node-1] [WARN] [1714496501.390131808] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 8 earlier points. [cartographer_node-1] [WARN] [1714496501.480315173] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 7 earlier points. [cartographer_node-1] [WARN] [1714496501.652719469] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 26 earlier points. [cartographer_node-1] [WARN] [1714496501.827615893] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 4 earlier points. [cartographer_node-1] [WARN] [1714496501.914384975] [cartographer logger]: W0501 01:01:41.000000 62509 range_data_collator.cc:82] Dropped 18 earlier points. [cartographer_node-1] [WARN] [1714496502.003949874] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 7 earlier points. [cartographer_node-1] [WARN] [1714496502.176990558] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 24 earlier points. [cartographer_node-1] [WARN] [1714496502.351917280] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 11 earlier points. [cartographer_node-1] [WARN] [1714496502.439868920] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 9 earlier points. [cartographer_node-1] [WARN] [1714496502.527763490] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 6 earlier points. [cartographer_node-1] [WARN] [1714496502.614549513] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 7 earlier points. [cartographer_node-1] [WARN] [1714496502.702752650] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 14 earlier points. [cartographer_node-1] [WARN] [1714496502.790368453] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 1 earlier points. [cartographer_node-1] [WARN] [1714496502.880881481] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 11 earlier points. [cartographer_node-1] [WARN] [1714496502.965038746] [cartographer logger]: W0501 01:01:42.000000 62509 range_data_collator.cc:82] Dropped 6 earlier points. [cartographer_node-1] [WARN] [1714496503.053814088] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 12 earlier points. [cartographer_node-1] [WARN] [1714496503.139583006] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 9 earlier points. [cartographer_node-1] [WARN] [1714496503.231428410] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 7 earlier points. [cartographer_node-1] [WARN] [1714496503.314349932] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 4 earlier points. [cartographer_node-1] [WARN] [1714496503.401728617] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 14 earlier points. [cartographer_node-1] [WARN] [1714496503.490083507] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 4 earlier points. [cartographer_node-1] [WARN] [1714496503.582543798] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 2 earlier points. [cartographer_node-1] [WARN] [1714496503.751956079] [cartographer logger]: W0501 01:01:43.000000 62509 range_data_collator.cc:82] Dropped 41 earlier points.请问大家这个会有什么影响吗,什么操作能解决这个警告
-
问题:修改为"nav捻仓tom_planner/CustomPlanner,按清单配置后,rviz初始化位置后不反应
planner_server: ros__parameters: #expected_planner_frequency: 20.0 use_sim_time: True planner_plugins: ["GridBased"] GridBased: #plugin: "nav2_navfn_planner/NavfnPlanner" plugin: "nav2_custom_planner/CustomPlanner" #tolerance: 0.5 #use_astar: false #allow_unknown: true interpolation_resolution: 0.1
planner_server代码:nav2_custom_planner.cpp代码:
#include "nav2_util/node_utils.hpp" #include <cmath> #include <memory> #include <string> #include "nav2_core/exceptions.hpp" #include "nav2_custom_planner/nav2_custom_planner.hpp" namespace nav2_custom_planner { void CustomPlanner::configure( const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, std::shared_ptr<tf2_ros::Buffer> tf, std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) { tf_ = tf; node_ = parent.lock(); name_ = name; costmap_ = costmap_ros->getCostmap(); global_frame_ = costmap_ros->getGlobalFrameID(); //参数初始化 nav2_util::declare_parameter_if_not_declared(node_, name_ + ".interpolation_resolution", rclcpp::ParameterValue(0.1)); node_->get_parameter(name_ + ".interpolation_resolution", interpolation_resolution_); } void CustomPlanner::cleanup() { RCLCPP_INFO(node_->get_logger(), "正在清理类型为CustomPlanner的插件 %s", name_.c_str()); } void CustomPlanner::activate() { RCLCPP_INFO(node_->get_logger(), "正在激活类型为CustomPlanner的插件 %s", name_.c_str()); } void CustomPlanner::deactivate() { RCLCPP_INFO(node_->get_logger(), "正在停用类型为CustomPlanner的插件 %s", name_.c_str()); } nav_msgs::msg::Path CustomPlanner::createPlan(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal) { // 1、声明并初始化global_path nav_msgs::msg::Path global_path; global_path.poses.clear(); global_path.header.stamp = node_->now(); global_path.header.frame_id = global_frame_; // 2、检察目标和起始状态是否在全局坐标中 if (start.header.frame_id != global_frame_) { RCLCPP_ERROR(node_->get_logger(), "规划器仅接受来自 %s 坐标系的起始位置", global_frame_.c_str()); return global_path; } if (goal.header.frame_id != global_frame_) { RCLCPP_INFO(node_->get_logger(), "规划器仅接受来自 %s 坐标系的起始位置", global_frame_.c_str()); return global_path; } // 3、计算当前插值分辨率 interpolation_resolution_下的循环次数和步进值 int total_number_of_loop = std::hypot(goal.pose.position.x - start.pose.position.x, goal.pose.position.y - start.pose.position.y) / interpolation_resolution_; double x_increment = (goal.pose.position.x - start.pose.position.x) / total_number_of_loop; double y_increment = (goal.pose.position.y - start.pose.position.y) / total_number_of_loop; // 4、生成路径 for (int i = 0; i < total_number_of_loop; ++i) { geometry_msgs::msg::PoseStamped pose; // 生成一个点 pose.pose.position.x = start.pose.position.x + x_increment * i; pose.pose.position.y = start.pose.position.y + y_increment * i; pose.pose.position.z = 0.0; pose.header.stamp = node_->now(); pose.header.frame_id = global_frame_; // 将该点放在路径中 global_path.poses.push_back(pose); } // 5、使用 costmap 检察该条路径是否经过障碍物 for (geometry_msgs::msg::PoseStamped pose : global_path.poses) { unsigned int mx, my; // 将坐标转换为栅格坐标 if (costmap_->worldToMap(pose.pose.position.x, pose.pose.position.y, mx, my)) { unsigned char cost = costmap_->getCost(mx, my); // 获取带有栅格的代价值 // 如果存在致命障碍物则抛出异常 if (cost == nav2_costmap_2d::LETHAL_OBSTACLE) { RCLCPP_WARN(node_->get_logger(), "在(%f,%f)检测到存在致命障碍物,规划失败。", pose.pose.position.x, pose.pose.position.y); throw nav2_core::PlannerException( "无法创建规划目标:" + std::to_string(goal.pose.position.x) + "," + std::to_string(goal.pose.position.y)); } } } // 6、收尾,将目标点作为路径的最后一个点并返回路径 geometry_msgs::msg::PoseStamped goal_pose = goal; goal_pose.header.stamp = node_->now(); goal_pose.header.frame_id = global_frame_; global_path.poses.push_back(goal_pose); return global_path; } } // namespace nav2_custom_planner #include "pluginlib/class_list_macros.hpp" PLUGINLIB_EXPORT_CLASS(nav2_custom_planner::CustomPlanner, nav2_core::GlobalPlanner); -
环境是ubuntu22.04, humble
[INFO] [launch]: All log files can be found below /home/star/.ros/log/2024-04-30-07-42-53-898042-star-Dell-G15-5511-71747 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [ydlidar_ros2_driver_node-1]: process started with pid [71758] [INFO] [static_transform_publisher-2]: process started with pid [71760] [static_transform_publisher-2] [WARN] [1714434173.990213394] []: Old-style arguments are deprecated; see --help for new-style arguments [ydlidar_ros2_driver_node-1] [INFO] [1714434173.996838940] [ydlidar_ros2_driver_node]: [YDLIDAR INFO] Current ROS Driver Version: 1.0.1 [ydlidar_ros2_driver_node-1] [ydlidar_ros2_driver_node-1] [YDLIDAR] SDK initializing [ydlidar_ros2_driver_node-1] [YDLIDAR] SDK has been initialized [ydlidar_ros2_driver_node-1] [YDLIDAR] SDK Version: 1.2.5 [static_transform_publisher-2] [INFO] [1714434173.998294667] [static_tf_pub_laser]: Spinning until stopped - publishing transform [static_transform_publisher-2] translation: ('0.000000', '0.000000', '0.020000') [static_transform_publisher-2] rotation: ('0.000000', '0.000000', '0.000000', '1.000000') [static_transform_publisher-2] from 'base_link' to 'laser_frame' [ydlidar_ros2_driver_node-1] [YDLIDAR] Lidar successfully connected [/dev/ttyUSB0:230400] [ydlidar_ros2_driver_node-1] [YDLIDAR] Error, cannot retrieve YDLidar health code: ffffffff [ydlidar_ros2_driver_node-1] [YDLIDAR] Fail to get baseplate device information [ydlidar_ros2_driver_node-1] [YDLIDAR] Lidar init success, Elapsed time 2661 ms [ydlidar_ros2_driver_node-1] [YDLIDAR] Failed to start scan mode: ffffffff [ydlidar_ros2_driver_node-1] [INFO] [1714434182.293046750] [ydlidar_ros2_driver_node]: [YDLIDAR INFO] Now YDLIDAR is stopping ....... [INFO] [ydlidar_ros2_driver_node-1]: process has finished cleanly [pid 71758]
使用的是ydlidar x3雷达,运行官方给的humble驱动报错,说是检测不到健康码但是sdk运行example是正常的,有没有大佬知道这是什么情况
-
770c66d9-760e-49fb-a40f-a4d34bccec3e-微信截图_20240429212416.png
* Executing task: platformio run --target upload --upload-port /dev/ttyUSB0 Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Tool Manager: Installing platformio/tool-mkspiffs @ ~2.230.0 InternetConnectionError: You are not connected to the Internet. PlatformIO needs the Internet connection to download dependent packages or to work with PlatformIO Account. * The terminal process "platformio 'run', '--target', 'upload', '--upload-port', '/dev/ttyUSB0'" terminated with exit code: 1. * Terminal will be reused by tasks, press any key to close it.
请问为什么我按照动手学ROS2操作的时候会显示下面的报错信息呢5f75d3b1-58e5-4b9c-9426-b15d0fe3ef20-微信截图_20240429212958.png
我在ubuntu里是可以打开Firefox网页的,请问是需要科学上网吗 -
你好,
我在安装“ FishBot配置助手及固件发布页”的时候遇到一些问题。
1. 我是ubuntu22.04 + humble, 然后人在海外(不知道有没有影响)
我在安装配置助手时,是下载了git里的fishbot_tool.v1.0.0.beta1.linux_amd64,然后把他放到虚拟机ubuntu22.04里解压的。
解压后,我运行运行命令 xhost + && sudo docker run -it --rm --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY fishros2/fishbot_tool:v1.0.0.beta1 时:
他会闪现一下配置助手的界面,然后立马就消失了。
运行&报错结果:
cheng@cheng-virtual-machine:~$ xhost + && sudo docker run -it --rm --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY fishros2/fishbot_tool:v1.0.0.beta1
access control disabled, clients can connect from any host
[sudo] password for cheng:
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
2024-04-29 10:31:58 > FishBot配置工具已启动.
2024-04-29 10:31:58 > [提示]获取到当前系统设备 ['/dev/ttyS0']
Traceback (most recent call last):
File "main.py", line 236, in <module>
File "main.py", line 215, in show
File "main.py", line 62, in first_startup_operate
File "main.py", line 164, in choose_device_callback
KeyError: 'motion_board'
[7] Failed to execute script 'main' due to unhandled exception!2. 我也尝试运行:配置助手:xhost + && sudo docker run -it --rm --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY fishros2/fishbot-tool:v1.0.0.20240219 python3 main.py 也报错了。
报错结果:
cheng@cheng-virtual-machine:~$ xhost + && sudo docker run -it --rm --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY fishros2/fishbot-tool:v1.0.0.20240219 python3 main.py
access control disabled, clients can connect from any host
2024-04-29 10:37:33 > [提示]获取到当前系统设备 []
[]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 653, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 806, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/usr/local/lib/python3.10/dist-packages/urllib3/util/ssl.py", line 465, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/usr/local/lib/python3.10/dist-packages/urllib3/util/ssl.py", line 509, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.10/ssl.py", line 1100, in _create
self.do_handshake()
File "/usr/lib/python3.10/ssl.py", line 1371, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 793, in urlopen
response = self._make_request(
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/dist-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='fishros.org.cn', port=443): Max retries exceeded with url: /forum/api/v3/posts/2301 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)')))During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/fishbot_tool/fishbot_tool/main.py", line 245, in <module>
fishbottool = FishBotTool()
File "/fishbot_tool/fishbot_tool/main.py", line 57, in init
self.choose_device_callback()
File "/fishbot_tool/fishbot_tool/main.py", line 175, in choose_device_callback
board_bin = get_version_data()
File "/fishbot_tool/fishbot_tool/data.py", line 13, in get_version_data
response = requests.get(version_info_url)
File "/usr/local/lib/python3.10/dist-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='fishros.org.cn', port=443): Max retries exceeded with url: /forum/api/v3/posts/2301 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)')))请大佬解答一下,谢谢。
-
代码报错问题:
没有与参数列表匹配的 重载函数 "nav2_util::declare_parameter_if_not_declared" 实例空间构建错误:
#ifndef NAV2_CUSTOM_PLANNER__NAV2_CUSTOM_PLANNER_HPP_ #define NAV2_CUSTOM_PLANNER__NAV2_CUSTOM_PLANNER_HPP_ #include <memory> #include <string> #include "geometry_msgs/msg/point.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" #include "rclcpp/rclcpp.hpp" #include "nav2_core/global_planner.hpp" #include "nav2_costmap_2d/costmap_2d_ros.hpp" #include "nav2_util/lifecycle_node.hpp" #include "nav2_util/robot_utils.hpp" #include "nav_msgs/msg/path.hpp" namespace nav2_custom_planner { //自定义导航规划器类 class CustomPlanner : public nav2_core::GlobalPlanner{ public: CustomPlanner() = default; ~CustomPlanner() = default; //插件配置方法 void configure( const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, std::shared_ptr<tf2_ros::Buffer> tf, std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) override; //插件清理的方法 void cleanup() override; //插件激活的方法 void activate() override; //插件停用的方法 void deactivate() override; //为给定的起始和目标位姿创建路径的方法 nav_msgs::msg::Path createPlan(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal) override; private: //坐标变换缓存指针,可用于查询坐标关系 std::shared_ptr<tf2_ros::Buffer> tf_; //节点指针 nav2_util::LifecycleNode::SharedPtr node_; //全局代价地图 nav2_costmap_2d::Costmap2D *costmap_; //全局代价地图的坐标系 std::string global_frame_, name_; //插值分辨率 double interpolation_resolution_; }; } // namespace nav2_custom_planner #endif // NAV2_CUSTOM_PLANNER__NAV2_CUSTOM_PLANNER_HPP_nav2_custom_planner.cpp代码:
#include "nav2_util/node_utils.hpp" #include <cmath> #include <memory> #include <string> #include "nav2_core/exceptions.hpp" #include "nav2_custom_planner/nav2_custom_planner.hpp" namespace nav2_custom_planner{ void CustomPlanner::configure( const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, std::shared_ptr<tf2_ros::Buffer> tf, std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) { tf_ = tf; node_ = parent.lock(); name_ = name; costmap_ = costmap_ros->getCostmap(); global_frame_ = costmap_ros->getGlobalFrameID(); //参数初始化 nav2_util::declare_parameter_if_not_declared( node_, name_, + ".interpolation_resolution", rclcpp::ParameterValue(0.1)); node_->get_parameter(name_ + ".interpolation_resolution", interpolation_resolution_); } void CustomPlanner::cleanup() { RCLCPP_INFO(node_->get_logger(), "正在清理类型为CustomPlanner的插件 %s", name_.c_str()); } void CustomPlanner::activate() { RCLCPP_INFO(node_->get_logger(), "正在激活类型为CustomPlanner的插件 %s", name_.c_str()); } void CustomPlanner::deactivate() { RCLCPP_INFO(node_->get_logger(), "正在停用类型为CustomPlanner的插件 %s", name_.c_str()); } nav_msgs::msg::Path CustomPlanner::createPlan(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal) { nav_msgs::msg::Path global_path; //进行规划 return global_path; } } // namespace nav2_custom_planner #include "pluginlib/class_list_macros.hpp" PLUGINLIB_EXPORT_CLASS(nav2_custom_planner::CustomPlanner, nav2_core::GlobalPlanner);nav2_custom_planner.hpp代码:
#ifndef NAV2_CUSTOM_PLANNER__NAV2_CUSTOM_PLANNER_HPP_ #define NAV2_CUSTOM_PLANNER__NAV2_CUSTOM_PLANNER_HPP_ #include <memory> #include <string> #include "geometry_msgs/msg/point.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" #include "rclcpp/rclcpp.hpp" #include "nav2_core/global_planner.hpp" #include "nav2_costmap_2d/costmap_2d_ros.hpp" #include "nav2_util/lifecycle_node.hpp" #include "nav2_util/robot_utils.hpp" #include "nav_msgs/msg/path.hpp" namespace nav2_custom_planner { //自定义导航规划器类 class CustomPlanner : public nav2_core::GlobalPlanner{ public: CustomPlanner() = default; ~CustomPlanner() = default; //插件配置方法 void configure( const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, std::shared_ptr<tf2_ros::Buffer> tf, std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) override; //插件清理的方法 void cleanup() override; //插件激活的方法 void activate() override; //插件停用的方法 void deactivate() override; //为给定的起始和目标位姿创建路径的方法 nav_msgs::msg::Path createPlan(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal) override; private: //坐标变换缓存指针,可用于查询坐标关系 std::shared_ptr<tf2_ros::Buffer> tf_; //节点指针 nav2_util::LifecycleNode::SharedPtr node_; //全局代价地图 nav2_costmap_2d::Costmap2D *costmap_; //全局代价地图的坐标系 std::string global_frame_, name_; //插值分辨率 double interpolation_resolution_; }; } // namespace nav2_custom_planner #endif // NAV2_CUSTOM_PLANNER__NAV2_CUSTOM_PLANNER_HPP_
重要提示
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码