@250893029 这个有点奇怪,会报一个找不到model的报错但是可以运行,我修复这个报错后就会卡死
b7a9cc31-913a-4bb6-8646-e135e61f2cad-8463f1d1469274cd98c573eb906baea7.png
求救求救,呜呜呜
fishbot_ros2_controller.yaml文件内容:
controller_manager: ros__parameters: update_rate: 100 # Hz use_sim_time: true fishbot_joint_state_broadcaster: type: joint_state_broadcaster/JointStateBroadcaster use_sim_time: true fishbot_effort_controller: type: effort_controllers/JointGroupEffortController fishbot_effort_controller: ros__parameters: joints: - left_wheel_joint - right_wheel_joint command_interfaces: - effort state_interfaces: - position - velocity - effortgazebo_sim.launch.py文件内容:
import launch import launch_ros from ament_index_python.packages import get_package_share_directory import os def generate_launch_description(): # 获取功能包的share路径 urdf_package_path = get_package_share_directory('fishbot_description') defualt_xacro_path = os.path.join(urdf_package_path, 'urdf', 'fishbot/fishbot.urdf.xacro') defualt_gazebo_world_path = os.path.join(urdf_package_path, 'world', 'custom_room.world') # 声明一个urdf目录的参数,方便修改 action_declare_arg_mode_path = launch.actions.DeclareLaunchArgument( name='model', default_value=str(defualt_xacro_path), description='加载的模型文件路径' ) # 通过文件路径,获取内容,并转换成参数值对象,以供传入 robot_state_publisher substitutions_command_result = launch.substitutions.Command(['xacro ', launch.substitutions.LaunchConfiguration('model')]) robot_description_value = launch_ros.parameter_descriptions.ParameterValue(substitutions_command_result, value_type=str) action_robot_state_publisher = launch_ros.actions.Node( package='robot_state_publisher', executable='robot_state_publisher', parameters=[{'robot_description':robot_description_value}] ) action_launch_gazebo = launch.actions.IncludeLaunchDescription( launch.launch_description_sources.PythonLaunchDescriptionSource( [get_package_share_directory('gazebo_ros'),'/launch','/gazebo.launch.py'] ), launch_arguments=[('world',defualt_gazebo_world_path),('verbose','true')] ) action_spawm_entity = launch_ros.actions.Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic','/robot_description','-entity','fishbot'] ) action_load_joint_state_controller = launch.actions.ExecuteProcess( cmd='ros2 control load_controller fishbot_joint_state_broadcaster --set-state active'.split(' '), output='screen' ) action_load_effort_controller = launch.actions.ExecuteProcess( cmd='ros2 control load_controller fishbot_effort_broadcaster --set-state active'.split(' '), output='screen' ) return launch.LaunchDescription([ action_declare_arg_mode_path, action_robot_state_publisher, action_launch_gazebo, action_spawm_entity, launch.actions.RegisterEventHandler( event_handler=launch.event_handlers.OnProcessExit( target_action=action_spawm_entity, on_exit=[action_load_joint_state_controller], ) ), launch.actions.RegisterEventHandler( event_handler=launch.event_handlers.OnProcessExit( target_action=action_load_joint_state_controller, on_exit=[action_load_effort_controller], ) ), ])报错内容:
charlie@charlie-VirtualBox:~/chapt6/chapt6_ws$ ros2 launch fishbot_description gazebo_sim.launch.py [INFO] [launch]: All log files can be found below /home/charlie/.ros/log/2025-08-14-13-26-32-002900-charlie-VirtualBox-14576 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [14582] [INFO] [gzserver-2]: process started with pid [14584] [INFO] [gzclient-3]: process started with pid [14586] [INFO] [spawn_entity.py-4]: process started with pid [14588] [robot_state_publisher-1] [INFO] [1755149192.409618885] [robot_state_publisher]: got segment back_wheel_link [robot_state_publisher-1] [INFO] [1755149192.409707476] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-1] [INFO] [1755149192.409716020] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1755149192.409720830] [robot_state_publisher]: got segment camera_link [robot_state_publisher-1] [INFO] [1755149192.409725466] [robot_state_publisher]: got segment camera_optical_link [robot_state_publisher-1] [INFO] [1755149192.409730113] [robot_state_publisher]: got segment front_wheel_link [robot_state_publisher-1] [INFO] [1755149192.409734683] [robot_state_publisher]: got segment imu_link [robot_state_publisher-1] [INFO] [1755149192.409739214] [robot_state_publisher]: got segment laser_cylinder_link [robot_state_publisher-1] [INFO] [1755149192.409743668] [robot_state_publisher]: got segment laser_link [robot_state_publisher-1] [INFO] [1755149192.409748291] [robot_state_publisher]: got segment left_wheel_link [robot_state_publisher-1] [INFO] [1755149192.409752794] [robot_state_publisher]: got segment right_wheel_link [gzclient-3] Gazebo multi-robot simulator, version 11.10.2 [gzclient-3] Copyright (C) 2012 Open Source Robotics Foundation. [gzclient-3] Released under the Apache 2 License. [gzclient-3] http://gazebosim.org [gzclient-3] [gzserver-2] Gazebo multi-robot simulator, version 11.10.2 [gzserver-2] Copyright (C) 2012 Open Source Robotics Foundation. [gzserver-2] Released under the Apache 2 License. [gzserver-2] http://gazebosim.org [gzserver-2] [spawn_entity.py-4] [INFO] [1755149192.721795812] [spawn_entity]: Spawn Entity started [spawn_entity.py-4] [INFO] [1755149192.722152998] [spawn_entity]: Loading entity published on topic /robot_description [spawn_entity.py-4] [INFO] [1755149192.723538076] [spawn_entity]: Waiting for entity xml on /robot_description [spawn_entity.py-4] [INFO] [1755149192.737648830] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1755149192.737973586] [spawn_entity]: Waiting for service /spawn_entity [gzserver-2] [Wrn] [gazebo_ros_init.cpp:178] [gzserver-2] # # ####### ####### ### ##### ####### [gzserver-2] ## # # # # # # # # [gzserver-2] # # # # # # # # # [gzserver-2] # # # # # # # # ##### [gzserver-2] # # # # # # # # # [gzserver-2] # ## # # # # # # # [gzserver-2] # # ####### # ### ##### ####### [gzserver-2] [gzserver-2] This version of Gazebo, now called Gazebo classic, reaches end-of-life [gzserver-2] in January 2025. Users are highly encouraged to migrate to the new Gazebo [gzserver-2] using our migration guides (https://gazebosim.org/docs/latest/gazebo_classic_migration?utm_source=gazebo_ros_pkgs&utm_medium=cli) [gzserver-2] [gzserver-2] [spawn_entity.py-4] [INFO] [1755149193.630002076] [spawn_entity]: Calling service /spawn_entity [gzclient-3] [Msg] Waiting for master. [gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [gzclient-3] [Msg] Publicized address: 10.0.2.15 [gzclient-3] [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in "" [gzserver-2] [Msg] Waiting for master. [gzserver-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [gzserver-2] [Msg] Publicized address: 10.0.2.15 [gzserver-2] [Msg] Loading world file [/home/charlie/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world] [gzserver-2] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [gzserver-2] [INFO] [1755149194.040022442] [depth_camera]: Publishing camera info to [/camera_sensor/camera_info] [gzserver-2] [INFO] [1755149194.041348511] [depth_camera]: Publishing depth camera info to [/camera_sensor/depth/camera_info] [gzserver-2] [INFO] [1755149194.041969718] [depth_camera]: Publishing pointcloud to [/camera_sensor/points] [spawn_entity.py-4] [INFO] [1755149194.167642949] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [fishbot] [gzserver-2] [INFO] [1755149194.188820356] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin [gzserver-2] [INFO] [1755149194.196361687] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: / [gzserver-2] [INFO] [1755149194.196411774] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control [gzserver-2] [INFO] [1755149194.202945161] [gazebo_ros2_control]: connected to service!! robot_state_publisher [gzserver-2] [INFO] [1755149194.204511542] [gazebo_ros2_control]: Received urdf from param server, parsing... [gzserver-2] [INFO] [1755149194.204661865] [gazebo_ros2_control]: Loading parameter files /home/charlie/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/config/fishbot_ros2_controller.yaml [gzserver-2] [INFO] [1755149194.216888925] [gazebo_ros2_control]: Loading joint: left_wheel_joint [gzserver-2] [INFO] [1755149194.216973229] [gazebo_ros2_control]: State: [gzserver-2] [INFO] [1755149194.216996699] [gazebo_ros2_control]: position [gzserver-2] [INFO] [1755149194.217017614] [gazebo_ros2_control]: velocity [gzserver-2] [INFO] [1755149194.217035265] [gazebo_ros2_control]: effort [gzserver-2] [INFO] [1755149194.217410237] [gazebo_ros2_control]: Command: [gzserver-2] [INFO] [1755149194.217472195] [gazebo_ros2_control]: velocity [gzserver-2] [INFO] [1755149194.217882558] [gazebo_ros2_control]: effort [gzserver-2] [INFO] [1755149194.217932050] [gazebo_ros2_control]: Loading joint: right_wheel_joint [gzserver-2] [INFO] [1755149194.217953011] [gazebo_ros2_control]: State: [gzserver-2] [INFO] [1755149194.217970816] [gazebo_ros2_control]: position [gzserver-2] [INFO] [1755149194.217992609] [gazebo_ros2_control]: velocity [gzserver-2] [INFO] [1755149194.218018592] [gazebo_ros2_control]: effort [gzserver-2] [INFO] [1755149194.218073496] [gazebo_ros2_control]: Command: [gzserver-2] [INFO] [1755149194.218104275] [gazebo_ros2_control]: velocity [gzserver-2] [INFO] [1755149194.218310209] [gazebo_ros2_control]: effort [gzserver-2] [INFO] [1755149194.218444212] [resource_manager]: Initialize hardware 'FishBotGazeboSystem' [gzserver-2] [INFO] [1755149194.218787765] [resource_manager]: Successful initialization of hardware 'FishBotGazeboSystem' [gzserver-2] [INFO] [1755149194.219203076] [resource_manager]: 'configure' hardware 'FishBotGazeboSystem' [gzserver-2] [INFO] [1755149194.219228919] [resource_manager]: Successful 'configure' of hardware 'FishBotGazeboSystem' [gzserver-2] [INFO] [1755149194.219242935] [resource_manager]: 'activate' hardware 'FishBotGazeboSystem' [gzserver-2] [INFO] [1755149194.219255560] [resource_manager]: Successful 'activate' of hardware 'FishBotGazeboSystem' [gzserver-2] [INFO] [1755149194.219508454] [gazebo_ros2_control]: Loading controller_manager [gzserver-2] [WARN] [1755149194.240378504] [gazebo_ros2_control]: Desired controller update period (0.01 s) is slower than the gazebo simulation period (0.001 s). [gzserver-2] [INFO] [1755149194.240584522] [gazebo_ros2_control]: Loaded gazebo_ros2_control. [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 14588] [INFO] [ros2-5]: process started with pid [14745] [gzserver-2] [INFO] [1755149195.120629564] [controller_manager]: Loading controller 'fishbot_joint_state_broadcaster' [gzserver-2] [INFO] [1755149195.145931071] [controller_manager]: Configuring controller 'fishbot_joint_state_broadcaster' [gzserver-2] [INFO] [1755149195.146586668] [fishbot_joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published [ros2-5] Successfully loaded controller fishbot_joint_state_broadcaster into state active [gzclient-3] context mismatch in svga_surface_destroy [gzclient-3] context mismatch in svga_surface_destroy [INFO] [ros2-5]: process has finished cleanly [pid 14745] [INFO] [ros2-6]: process started with pid [14781] [gzserver-2] [ERROR] [1755149196.607657076] [controller_manager]: The 'type' param was not defined for 'fishbot_effort_broadcaster'. [ros2-6] Error loading controller, check controller_manager logs [ERROR] [ros2-6]: process has died [pid 14781, exit code 1, cmd 'ros2 control load_controller fishbot_effort_broadcaster --set-state active'].e303b6248484e1f5a1c006982b7633b2.png :
ros,docker```
code_text
wros@wros-VirtualBox:~/chapt2$ make
Consolidate compiler generated dependencies of target ros2_cpp_node
[ 50%] Building CXX object CMakeFiles/ros2_cpp_node.dir/ros2_cpp_node.cpp.o
/home/wros/chapt2/ros2_cpp_node.cpp: In function ‘int main(int, char**)’:
/home/wros/chapt2/ros2_cpp_node.cpp:5:22: error: parse error in template argument list
5 | auto node = std::make_sharedrclcpp:::Node("cpp_node"); //创建节点
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wros/chapt2/ros2_cpp_node.cpp:5:48: error: no matching function for call to ‘make_shared<<expression error> >(const char [9])’
5 | auto node = std::make_sharedrclcpp:::Node("cpp_node"); //创建节点
| ~^~
In file included from /usr/include/c++/11/memory:77,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:153,
from /home/wros/chapt2/ros2_cpp_node.cpp:1:
/usr/include/c++/11/bits/shared_ptr.h:875:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’
875 | make_shared(_Args&&... __args)
| ^
/usr/include/c++/11/bits/shared_ptr.h:875:5: note: template argument deduction/substitution failed:
/home/wros/chapt2/ros2_cpp_node.cpp:5:48: error: template argument 1 is invalid
5 | auto node = std::make_sharedrclcpp:::Node("cpp_node"); //创建节点
| ~^~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40,
from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18,
from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37,
from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /home/wros/chapt2/ros2_cpp_node.cpp:1:
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:531:81: error: template argument 1 is invalid
531 | ::std::is_same<typename std::remove_cv_t<typename std::remove_reference_t<decltype(logger)>>,
| ^~
/home/wros/chapt2/ros2_cpp_node.cpp:6:5: note: in expansion of macro ‘RCLCPP_INFO’
6 | RCLCPP_INFO(node->get_logger(),"你好,C++节点!"); //打印日志
| ^
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:531:97: error: template argument 1 is invalid
531 | ::std::is_same<typename std::remove_cv_t<typename std::remove_reference_t<decltype(logger)>>,
| ^~
/home/wros/chapt2/ros2_cpp_node.cpp:6:5: note: in expansion of macro ‘RCLCPP_INFO’
6 | RCLCPP_INFO(node->get_logger(),"你好,C++节点!"); //打印日志
| ^~~~~
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:532:32: error: template argument 1 is invalid
532 | typename ::rclcpp::Logger>::value,
| ^
/home/wros/chapt2/ros2_cpp_node.cpp:6:5: note: in expansion of macro ‘RCLCPP_INFO’
6 | RCLCPP_INFO(node->get_logger(),"你好,C++节点!"); //打印日志
| ^~~~~~~~~~~
make[2]: *** [CMakeFiles/ros2_cpp_node.dir/build.make:76:CMakeFiles/ros2_cpp_node.dir/ros2_cpp_node.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:85:CMakeFiles/ros2_cpp_node.dir/all] 错误 2
make: *** [Makefile:101:all] 错误 2
系统:20.04,ros:noetic,使用一键安装指令安装rosdepc。
问题:尝试了所有的pip源,在执行sudo pip3 install -i https://mirrors.aliyun.com/pypi/simple rosdepc --break-system-packages失败
QQ图片20250812151116.png
打开终端执行这条指令显示没有--break-system-packages这个参数
QQ图片20250812151301.png
检测到程序发生异常退出,请打开:https://fishros.org.cn/forum 携带如下内容进行反馈
标题:使用一键安装过程中遇到程序崩溃
Traceback (most recent call last): File "/tmp/fishinstall/install.py", line 134, in <module> main() File "/tmp/fishinstall/install.py", line 123, in main run_tool_file(tools[code]['tool'].replace("/",".")) File "/tmp/fishinstall/tools/base.py", line 1478, in run_tool_file if tool.run()==False: return False File "/tmp/fishinstall/tools/tool_config_rosdep.py", line 94, in run self.install_rosdepc() File "/tmp/fishinstall/tools/tool_config_rosdep.py", line 85, in install_rosdepc PrintUtils.print_warning("安装失败,尝试使用其他方式安装...") AttributeError: type object 'PrintUtils' has no attribute 'print_warning'本次运行详细日志文件已保存至 /tmp/fishros_install.log
sudo rosdep init
/usr/bin/rosdep:6: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import load_entry_point
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
<urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list)>
配置ros源时:小鱼:检测当前系统ubuntu22.04:jammy 支持一键安装ROS
============正在添加ROS源密钥=================
Run CMD Task:[sudo apt update]
[-][11.15s] CMD Result:success
Run CMD Task:[sudo apt search curl ]
[-][0.45s] CMD Result:success
Run CMD Task:[sudo apt install curl -y]
[-][0.33s] CMD Result:success
Run CMD Task:[sudo apt search gnupg2 ]
[-][0.43s] CMD Result:success
Run CMD Task:[sudo apt install gnupg2 -y]
[-][0.31s] CMD Result:success
正在挑选最快的密钥服务:['https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc', 'https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc']
https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc 延时:0.33s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc 超时已自动选择最快密钥服务:https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc
Run CMD Task:[curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo apt-key add -]
[-][0.38s] CMD Result:success
Run CMD Task:[sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654]
[-][10.07s] CMD Result:code:2
Run CMD Task:[curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/ros.gpg --import]
[-][0.36s] CMD Result:success
Run CMD Task:[sudo chmod 644 /etc/apt/trusted.gpg.d/ros.gpg]
[-][0.00s] CMD Result:success
Run CMD Task:[dpkg --print-architecture]
[-][0.00s] CMD Result:success
根据您的系统,为您推荐安装源为['http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/']
创建文件:/etc/apt/sources.list.d/ros-fish.list
Run CMD Task:[sudo apt update]
[-][11.62s] CMD Result:success
Run CMD Task:[sudo apt search ros-base ]
[-][0.50s] CMD Result:success
恭喜,成功添加ROS源,接下来可以使用apt安装ROS或者使用[1]一键安装ROS安装!
欢迎加入机器人学习交流QQ群:438144612(入群口令:一键安装)
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或打开链接查看:https://item.taobao.com/item.htm?id=696573635888
如在使用过程中遇到问题,请打开:https://fishros.org.cn/forum 进行反馈
检测到本次运行出现失败命令,直接退出按Ctrl+C,按任意键上传日志并退出
colcon build时find_package(OpenMP REQUIRED)报错,显示为:
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
已经安装了ibomp-dev (1:14.0-55~exp2),编译器版本是g++ 11.4.0,ROS版本是Humble。



E: 无法下载 https://mirrors.ustc.edu.cn/ubuntu/pool/universe/f/freeimage/libfreeimage-dev_3.18.0%2Bds2-6ubuntu5.1_amd64.deb 暂时不能解析域名“mirrors.ustc.edu.cn”
E: 无法下载 https://mirrors.ustc.edu.cn/ubuntu/pool/universe/o/ogre-1.9/libogre-1.9-dev_1.9.0%2Bdfsg1-12.1ubuntu1_amd64.deb 暂时不能解析域名“mirrors.ustc.edu.cn”
E: 无法下载 https://mirrors.ustc.edu.cn/ubuntu/pool/universe/libt/libtar/libtar-dev_1.2.20-8ubuntu0.22.04.1_amd64.deb 暂时不能解析域名“mirrors.ustc.edu.cn”
友友们有使用过第四代控制器版本的睿尔曼机械臂吗,ros1版本控制,在跑官方ros包时出现Rviz中的姿态和真实机械臂姿态不一致的问题,利用rostopic echo /joint_states也没有数据反馈,一直处于待接收状态 ,但是虚拟机和机械臂可以ping通,不知道是什么原因如何解决。
出错截图如下:
c6020ed3-713f-4843-8847-cfa67fc658dc-5657331a82cd254b005f37e06551d7e.png
编译的时候报错:src/main.cpp:45:5: error: 'set_microros_wifi_transports' was not declared in this scope,set_microros_wifi_transports函数未声明
635071ff-1004-4bda-9349-791640de5ee5-1754583071097.png
[-][1.00s] CMD Result:code:2
检测到程序发生异常退出,请打开:https://fishros.org.cn/forum 携带如下内容进行反馈
标题:使用一键安装过程中遇到程序崩溃
Traceback (most recent call last): File "/tmp/fishinstall/install.py", line 134, in <module> main() File "/tmp/fishinstall/install.py", line 123, in main run_tool_file(tools[code]['tool'].replace("/",".")) File "/tmp/fishinstall/tools/base.py", line 1478, in run_tool_file if tool.run()==False: return False File "/tmp/fishinstall/tools/tool_config_rosdep.py", line 94, in run self.install_rosdepc() File "/tmp/fishinstall/tools/tool_config_rosdep.py", line 85, in install_rosdepc PrintUtils.print_warning("安装失败,尝试使用其他方式安装...") AttributeError: type object 'PrintUtils' has no attribute 'print_warning'最后输入ros2 run demo_cpp_pkg cpp_node时报错是什么原因呢,应该怎么解决这种情况?局部截取_20250807_210846.png
[自己用gazebo创建了个环境,用nav2进行导航, 给定目标点后,小车在行走过程中,局部膨胀地图随着激光雷达出现了偏移,将路线给挡住了,导致导航失败]
具体细节和上下文:1,机器人的仿真模型是根据鱼哥的视频一步步走下来的;
2.我的param.yaml对全局和局部的配置如下:
2.1 全局配置:
global_costmap:
global_costmap:
ros__parameters:
update_frequency: 2.0 #1.0
publish_frequency: 1.0
global_frame: map
robot_base_frame: base_footprint
use_sim_time: True
# robot_radius: 0.2
footprint: "[[0.325,-0.275],[0.325,0.275],[-0.325,0.275],[-0.325,-0.275]]"
resolution: 0.05
track_unknown_space: true
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: True
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 6.0 #3.0
inflation_radius: 0.35 #0.15
always_send_full_costmap: True
2.2 局部配置:
local_costmap:
local_costmap:
ros__parameters:
update_frequency: 2.0 #2.0 #5.0
publish_frequency: 0.5 #2.0
global_frame: odom
robot_base_frame: base_footprint
use_sim_time: True
rolling_window: true
width: 5 #3
height: 5 #3
resolution: 0.02 #0.05
robot_radius: 0.46 #robot_radius: 0.2
footprint: "[[0.325,-0.275],[0.325,0.275],[-0.325,0.275],[-0.325,-0.275]]"
plugins: ["voxel_layer", "inflation_layer"]
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 6.0 #3.0
inflation_radius: 0.45 #0.35 # 0.2 #0.15
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
publish_voxel_map: True
origin_z: 0.0
z_resolution: 0.05
z_voxels: 16
max_obstacle_height: 2.0
mark_threshold: 0
observation_sources: scan
scan:
topic: /scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: True
always_send_full_costmap: True
a818fc44-b97e-41dc-8db9-ba8c1c59aa45-image.png 尝试过的解决方法:
我尝试将全局和局部地图的更新频率设置成一样的,但是没有效果。不知道是什么原因,求大佬帮忙分析下。
root@6c45ca8f7aff:/home/yby# sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg |
sudo gpg --dearmor -o /etc/apt/keyrings/docker.asc
root@6c45ca8f7aff:/home/yby# sudo apt update
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy InRelease [4682 B]
Err:1 http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy InRelease
The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
Hit:2 https://mirrors.ustc.edu.cn/ubuntu jammy InRelease
Hit:3 https://mirrors.ustc.edu.cn/ubuntu jammy-updates InRelease
Hit:4 https://mirrors.ustc.edu.cn/ubuntu jammy-backports InRelease
Get:5 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease [57.7 kB]
Hit:6 https://mirrors.ustc.edu.cn/ubuntu jammy-security InRelease
Err:5 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Reading package lists... Done
W: http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: GPG error: http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
E: The repository 'http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@6c45ca8f7aff:/home/yby# ^C
root@6c45ca8f7aff:/home/yby#
按照教程一键安装docker+ros,在sudo apt update时出现问题,显示ros2所用的清华源已经过期。因为不知道如何修改容器里的ros源,所以想着修改docker源,修改后觉得不太对。
尝试过的解决方法:修改 Docker 源为阿里云(Ubuntu 20.04)
编辑 docker.listbash
复制
sudo nano /etc/apt/sources.list.d/docker.list 替换为阿里云 Docker CE 源
把原来的:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu focal stable
改成:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal stable
注意:保留 signed-by=/etc/apt/keyrings/docker.asc,确保用的是官方 GPG 密钥。
截图 2025-08-05 18-13-59.png 截图 2025-08-05 18-14-25.png 截图 2025-08-05 18-14-25.png
1、我现在遇到了 在设备上发布ROS2相机话题,本机可以顺畅的收到。局域网里的设备可以收到,但是非常卡顿,丢帧验证的问题。当减小到data大小为115200byte时,局域网也可以顺畅接收
2、发布端关键代码如下:
// 构造函数修改:添加NodeOptions设置DDS参数
CCameraPublisher::CCameraPublisher(std::string name)
: rclcpp::Node(
"Image_publisher_" + sanitizeNodeName(name),
// 配置节点选项,设置DDS参数
&{
rclcpp::NodeOptions options;
// 设置FastDDS最大消息大小(字节),4MB = 4194304
options.append_parameter_override("fastrtps.fragment_size", 1400); // 分片大小 < MTU(如1400,留足IP头空间)
options.append_parameter_override("rmw_fastrtps_max_message_size", 10 * 1024 * 1024); // 大于实际消息大小
// 发布端和订阅端均需添加:
options.append_parameter_override("fastrtps.sendBufferSize", 8 * 1024 * 1024); // 发送缓冲区8MB
options.append_parameter_override("fastrtps.receiveBufferSize", 8 * 1024 * 1024); // 接收缓冲区8MB
options.append_parameter_override("ros_network_receive_buffer_size", 10 * 1024 * 1024); // ROS层缓冲区
// 禁用DDS域名自动发现,避免多播冲突
options.append_parameter_override("rmw_fastrtps_discovery_servers", std::vectorstd::string());
return options;
}()
)
{
// QoS配置保持不变,但建议显式设置历史深度
auto qos = rclcpp::SensorDataQoS()
.keep_last(10) // 队列深度
.best_effort() // 尽力而为模式
.durability_volatile() // volatile耐用性(不存储历史数据)
.deadline(rclcpp::Duration(std::chrono::milliseconds(100))); // 使用std::chrono兼容方式.deadline(rclcpp::Duration(std::chrono::milliseconds(100))); // 使用std::chrono兼容方式
}
bool CCameraPublisher::Publisher(unsigned char *data, int datalen, int64_t tv_sec, int64_t tv_usec)
{
sensor_msgs::msg::CompressedImage image_msg;
image_msg.header.stamp.sec = static_cast<int32_t>(tv_sec);
image_msg.header.stamp.nanosec = static_cast<uint32_t>(tv_usec);
image_msg.header.frame_id = m_strTopic; // 设置帧ID
image_msg.data.resize(datalen);
image_msg.format = "jpg";
std::memcpy(image_msg.data.data(), (unsigned char *)data, image_msg.data.size()); // 填充压缩后的图像数据
m_Publisher->publish(image_msg);
// 更新帧信息
new_frame_ts_ = TZTEK_GetTime();
diff_time_ = new_frame_ts_ - old_frame_ts_; // 单位
tztek_dbg("%d.%09d, 发布 %s,datalen:%d 间隔: %dms",
image_msg.header.stamp.sec,
image_msg.header.stamp.nanosec,
image_msg.header.frame_id.c_str(),datalen,
diff_time_);
old_frame_ts_ = new_frame_ts_;
return true;
}
3、订阅端关键代码如下:
CompressedImageSubscriber() :
Node(
"compressed_image_subscriber",
// 配置节点选项,与发布端保持一致的DDS参数
{
rclcpp::NodeOptions options;
// 设置与发布端相同的最大消息大小(4MB)
options.append_parameter_override("fastrtps.fragment_size", 1400); // 分片大小 < MTU(如1400,留足IP头空间)
options.append_parameter_override("rmw_fastrtps_max_message_size", 10 * 1024 * 1024); // 大于实际消息大小
// 发布端和订阅端均需添加:
options.append_parameter_override("fastrtps.sendBufferSize", 8 * 1024 * 1024); // 发送缓冲区8MB
options.append_parameter_override("fastrtps.receiveBufferSize", 8 * 1024 * 1024); // 接收缓冲区8MB
options.append_parameter_override("ros_network_receive_buffer_size", 10 * 1024 * 1024); // ROS层缓冲区
// 禁用自动发现服务器,减少网络干扰
options.append_parameter_override("rmw_fastrtps_discovery_servers", std::vectorstd::string());
return options;
}()
),
first_callback_(true)
{
// 创建订阅者,使用与发布端完全匹配的QoS配置
auto qos = rclcpp::SensorDataQoS()
.keep_last(10) // 队列深度10,与发布端一致
.best_effort() // 尽力而为可靠性,与发布端匹配
.durability_volatile() // 不存储历史数据,减少内存占用
.deadline(rclcpp::Duration(std::chrono::milliseconds(100))); // 使用std::chrono兼容方式
4、这个数据的 Data size: 576000 bytes,这个尺寸会异常丢帧,但是如果我修改
image_msg.data.resize(datalen/5);
std::memcpy(image_msg.data.data(), (unsigned char *)data, image_msg.data.size()/5);
局域网的设备也可以顺畅接收
5、订阅端的回调函数仅仅是打印
6、请主要关注为啥局域网的设备是否顺畅,与data size有关
7、网络带宽为
[ 5] local 192.168.37.96 port 39468 connected to 192.168.37.167 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 12.0 MBytes 101 Mbits/sec 0 206 KBytes
8、发布端发布1路数据,帧率为12.5fps,订阅端仅仅订阅一路
9、局域网的订阅端带宽:
jixufang@jixufang-Latitude-5401:~/ros2_workspace$ ros2 topic bw cam1/compressed
Subscribed to [cam1/compressed]
2.88 MB/s from 4 messages
Message size mean: 0.58 MB min: 0.58 MB max: 0.58 MB
1.28 MB/s from 4 messages
Message size mean: 0.58 MB min: 0.58 MB max: 0.58 MB
10、本机的订阅端带宽:
root@hobot:/map/ywy/cam_b24cf85b# ros2 topic bw cam1/compressed
Subscribed to [cam1/compressed]
5.78 MB/s from 13 messages
Message size mean: 0.44 MB min: 0.44 MB max: 0.44 MB
5.51 MB/s from 25 messages
Message size mean: 0.44 MB min: 0.44 MB max: 0.44 MB
5.56 MB/s from 38 messages
Message size mean: 0.44 MB min: 0.44 MB max: 0.44 MB
11、scp测试丢包情况:
root@hobot:/map/ywy/cam_b24cf85b# dd if=/dev/zero of=test.bin bs=576000 count=100
100+0 records in
100+0 records out
57600000 bytes (58 MB, 55 MiB) copied, 0.0404203 s, 1.4 GB/s
root@hobot:/map/ywy/cam_b24cf85b# ls
case_tztek cfg demo init_env.sh J6_Cam_User_Guide_V1.0.pdf test.bin tools tztek_camera.sh version
root@hobot:/map/ywy/cam_b24cf85b# scp test.bin jixufang@192.168.37.96:~/
Warning: Permanently added '192.168.37.96' (ED25519) to the list of known hosts.
jixufang@192.168.37.96's password:
test.bin 没看出来丢包
版块
-
1.4k
主题4.9k
帖子 -
460
主题3.0k
帖子 -
68
主题263
帖子 -
1.1k
主题4.3k
帖子 -
1.0k
主题3.7k
帖子 -
5
主题11
帖子 -
358
主题1.6k
帖子