使用的是VirtualBox虚拟机,也在b站看了相关教程,粘贴板也设置了双向,增强功能也安装好了,但是拖拽文件还是显示如下。847c9d19-dd6f-4d08-a7be-79d155291e86-image.png 恳请大佬帮忙
zh@zh:~/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/launch$ ros2 launch gazebo_sim.launch.py
[INFO] [launch]: All log files can be found below /home/zh/.ros/log/2025-04-08-14-14-08-743573-zh-18789
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [18809]
[INFO] [gzserver-2]: process started with pid [18811]
[INFO] [gzclient-3]: process started with pid [18813]
[INFO] [spawn_entity.py-4]: process started with pid [18824]
[robot_state_publisher-1] [WARN] [1744092850.983627396] [kdl_parser]: The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.
[robot_state_publisher-1] [INFO] [1744092851.005250818] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1744092851.005356558] [robot_state_publisher]: got segment link1
[robot_state_publisher-1] [INFO] [1744092851.005364945] [robot_state_publisher]: got segment link2
[robot_state_publisher-1] [INFO] [1744092851.005370559] [robot_state_publisher]: got segment link3
[robot_state_publisher-1] [INFO] [1744092851.005375577] [robot_state_publisher]: got segment link4
[robot_state_publisher-1] [INFO] [1744092851.005380653] [robot_state_publisher]: got segment link5
[robot_state_publisher-1] [INFO] [1744092851.005401899] [robot_state_publisher]: got segment link6
[spawn_entity.py-4] [INFO] [1744092851.461900069] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1744092851.462376818] [spawn_entity]: Loading entity published on topic /robot_description
[spawn_entity.py-4] [INFO] [1744092851.597600032] [spawn_entity]: Waiting for entity xml on /robot_description
[spawn_entity.py-4] [INFO] [1744092851.610611232] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1744092851.612326637] [spawn_entity]: Waiting for service /spawn_entity
[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]
[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]
[gzclient-3] [Msg] Waiting for master.
[gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gzclient-3] [Msg] Publicized address: 192.168.45.72
[gzclient-3] [Wrn] [GuiIface.cc:120] QSocketNotifier: Can only be used with threads started with QThread
[spawn_entity.py-4] [INFO] [1744092854.880858607] [spawn_entity]: Calling service /spawn_entity
[gzserver-2] [Msg] Waiting for master.
[gzserver-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gzserver-2] [Msg] Publicized address: 192.168.45.72
[gzserver-2] [Msg] Loading world file [/home/zh/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world]
[gzserver-2] [Wrn] [ModelDatabase.cc:340] Getting models from[http://models.gazebosim.org/]. This may take a few seconds.
[spawn_entity.py-4] [INFO] [1744092855.188383000] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [demo_robot]
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 18824]
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:132] Unable to create the rendering window
[gzclient-3] [Err] [WindowManager.cc:139] EXCEPTION: Unable to create the rendering window
[gzclient-3]
[gzclient-3]
[gzclient-3] terminate called after throwing an instance of 'gazebo::common::Exception'
[ERROR] [gzclient-3]: process has died [pid 18813, exit code -6, cmd 'gzclient --gui-client-plugin=libgazebo_ros_eol_gui.so --verbose'].
[gzclient-3]
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-1] [INFO] [1744092927.750144168] [rclcpp]: signal_handler(signum=2)
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 18809]
[ERROR] [gzserver-2]: process[gzserver-2] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [gzserver-2]: sending signal 'SIGTERM' to process[gzserver-2]
[gzserver-2] [INFO] [1744092932.761096812] [rclcpp]: signal_handler(signum=15)
[ERROR] [gzserver-2]: process[gzserver-2] failed to terminate '10.0' seconds after receiving 'SIGTERM', escalating to 'SIGKILL'
[INFO] [gzserver-2]: sending signal 'SIGKILL' to process[gzserver-2]
[ERROR] [gzserver-2]: process has died [pid 18811, exit code -9, cmd 'gzserver /home/zh/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world --verbose -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
[gzserver-2]
zh@zh:~/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/launch$
使用的是VirtualBox虚拟机,也在b站看了相关教程,粘贴板也设置了双向,增强功能也安装好了,但是拖拽文件还是显示如下。847c9d19-dd6f-4d08-a7be-79d155291e86-image.png 恳请大佬帮忙
用ros2control加hardwear interface 的方式开发机器人看起来很香,为什么不见有人用呢。开源的教育机器人也都是把ros2当一个通信工具用,硬件厂商也不见有提供hardwear interface 代码的。电机驱动器,雷达,摄像头,这些常用配件貌似都是直接连某某派、工控机、mini小主机等上位机更方便。如果这些都带hardwear interface代码,岂不是简化很多开发过程。这样做有什么看不到的缺点吗?是会影响性能还是自由度不够?
Starting >>> stm32_communication
[Processing: stm32_communication]
--- stderr: stm32_communication
gmake: 警告:文件“Makefile”的修改时间在未来 797342943 秒后
gmake[1]: 警告:文件“CMakeFiles/Makefile2”的修改时间在未来 797342943 秒后
gmake[2]: 警告:文件“CMakeFiles/stm32_serial_node.dir/flags.make”的修改时间在未来 797342396 秒后
gmake[2]: 警告:检测到时钟错误。您的构建版本可能是不完整的。
gmake[2]: 警告:文件“CMakeFiles/stm32_serial_node.dir/flags.make”的修改时间在未来 797342395 秒后
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In constructor ‘Stm32Communicator::Stm32Communicator()’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:36:27: error: ‘class drivers::serial_driver::SerialPort’ has no member named ‘init_port’
36 | serial_port_->init_port(port, {baud_rate, fc, pt, sb});
| ^~~~~~~~~
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:38:32: error: ‘class drivers::serial_driver::SerialPort’ has no member named ‘port_open’
38 | if (!serial_port_->port_open()) {
| ^~~~~~~~~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24,
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/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:3:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:42:39: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long int’ [-Wformat=]
42 | RCLCPP_INFO(get_logger(), "Serial port %s opened at %d baud",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | port.c_str(), baud_rate);
| ~~~~~~~~~
| |
| long int
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:42:66: note: format string is defined here
42 | RCLCPP_INFO(get_logger(), "Serial port %s opened at %d baud",
| ~^
| |
| int
| %ld
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In lambda function:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:67:58: error: ‘using element_type = class drivers::common::IoContext’ {aka ‘class drivers::common::IoContext’} has no member named ‘run’
67 | io_thread_ = std::thread(this { io_context_->run(); });
| ^~~
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In destructor ‘virtual Stm32Communicator::~Stm32Communicator()’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:72:22: error: ‘using element_type = class drivers::common::IoContext’ {aka ‘class drivers::common::IoContext’} has no member named ‘stop’
72 | io_context_->stop();
| ^~~~
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In member function ‘void Stm32Communicator::read_from_stm32()’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:119:28: error: ‘class drivers::serial_driver::SerialPort’ has no member named ‘port_open’
119 | if (!serial_port_->port_open()) return;
| ^~~~~~~~~
In file included from /usr/include/c++/11/memory:76,
from /home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:1:
/usr/include/c++/11/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = drivers::serial_driver::SerialPort; _Args = {drivers::common::IoContext&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptrdrivers::serial_driver::SerialPort]’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:18:72: required from here
/usr/include/c++/11/bits/unique_ptr.h:962:30: error: no matching function for call to ‘drivers::serial_driver::SerialPort::SerialPort(drivers::common::IoContext&)’
962 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/humble/include/serial_driver/serial_driver.hpp:22,
from /home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:5:
/opt/ros/humble/include/serial_driver/serial_port.hpp:173:3: note: candidate: ‘drivers::serial_driver::SerialPort::SerialPort(const drivers::common::IoContext&, const string&, drivers::serial_driver::SerialPortConfig)’
173 | SerialPort(
| ^~~~~~~~~~
/opt/ros/humble/include/serial_driver/serial_port.hpp:173:3: note: candidate expects 3 arguments, 1 provided
gmake[2]: *** [CMakeFiles/stm32_serial_node.dir/build.make:76:CMakeFiles/stm32_serial_node.dir/src/stm32_communicate.cpp.o] 错误 1
gmake[1]: *** [CMakeFiles/Makefile2:137:CMakeFiles/stm32_serial_node.dir/all] 错误 2
gmake: *** [Makefile:146:all] 错误 2
Failed <<< stm32_communication [42.6s, exited with code 2]
Summary: 0 packages finished [45.5s]
1 package failed: stm32_communication
1 package had stderr output: stm32_communication
标题:使用一键安装过程中遇到程序崩溃
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 1473, in run_tool_file tool = importlib.import_module(file.replace(".py","")).Tool() AttributeError: module 'tools.tool_config_system_source' has no attribute 'Tool'本次运行详细日志文件已保存至 /tmp/fishros_install.log
检测到本次运行出现失败命令,直接退出按Ctrl+C,按任意键上传日志并退出
3.4.5订阅数据并用Qt显示
按照书本编写程序,运行节点的时候报警:
QSocketNotifier: Can only be used with threads started with QThread
/home/mr/ros2/chapt3/topic_practice_ws/install/status_display/lib/status_display/sys_status_display: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE
[ros2run]: Process exited with failure 127
以下为代码:
#include <QApplication>
#include <QLabel>
#include <QString>
#include "rclcpp/rclcpp.hpp"
#include "status_interfaces/msg/system_status.hpp"
using SystemStatus = status_interfaces::msg::SystemStatus;```
class SysStatusDisplay : public rclcpp::Node{
public:
SysStatusDisplay() : Node("sys_status_display"){
subscription_ =this->create_subscription<SystemStatus>(
"sys_status",10,[&](const SystemStatus::SharedPtr msg) -> void{
label_ -> setText(get_qstr_from_msg(msg));
});
//创建一个空的SystemStatus 对象,转换成QS人tring 进行显示
label_ = new QLabel(get_qstr_from_msg(std::make_shared<SystemStatus>()));
label_->show();
}
QString get_qstr_from_msg(const SystemStatus::SharedPtr msg){
//TODO: 将msg中的内容提出出来并组装成字符串
std::stringstream show_str;
show_str
<<"===========系统状态可视化显示工具===========\n"
<< "数据时间\t" << msg->stamp.sec << "\ts\n"
<< "用 户 名\t" << msg->host_name << "\t\n"
<< "CPU使用率\t" <<msg->cpu_percent << "\t%\n"
<< "内存使用率\t" <<msg->memory_percent << "\t%\n"
<< "内存总大小\t" << msg->memory_total <<"\tMB\n"
<< "剩余有效内存\t" << msg->memory_available << "\tMB\n"
<< "网络发送量\t" <<msg->net_sent <<"\tMB\n"
<< "网络接收量\t"<<msg->net_recv << "\tMB\n"
<< "=========================================";
return QString::fromStdString(show_str.str());
}
private:
rclcpp::Subscription<SystemStatus>::SharedPtr subscription_;
QLabel* label_;
};
int main(int argc,char* argv[]){
rclcpp::init(argc,argv);
QApplication app(argc,argv);
auto node = std::make_shared<SysStatusDisplay>();
std::thread spin_thread(& -> void
{
rclcpp::spin(node);
});
spin_thread.detach();
app.exec();
rclcpp::shutdown();
return 0;
}
===========================================================================================================
CMakeLists.txt:
cmake_minimum_required(VERSION 3.8)
project(status_display)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(status_interfaces REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
add_executable(hello_qt src/hello_qt.cpp)
add_executable(sys_status_display src/sys_status_display.cpp)
target_link_libraries(sys_status_display Qt5::Widgets) #对于非ROS功能使用Cmake原生指令进行链接库
ament_target_dependencies(sys_status_display rclcpp status_interfaces)
target_link_libraries(hello_qt
Qt5::Widgets
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
source files
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
install(TARGETS
hello_qt
sys_status_display
DESTINATION lib/${PROJECT_NAME}
)
ament_package()
===========================================================================================================
package.xml:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>status_display</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="mr@todo.todo">mr</maintainer>
<license>Apche-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>qtbase5-dev</depend>
<depend>rclcpp</depend>
<depend>status_interfaces</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
===========================================================================================================
Ubuntu版本:Ubuntu 24.04.2 LTS
ROS2版本:jazzy
问过deepseek和文心一言,文心一言表示可能是因为detach()别用;可以改称spin_thread.join(),可没有效果,反馈后又说别用join和detach。deepseek则用QObject这种还没有接触到的,可能是操作步骤少了或者有问题deepseek方案照抄了也没有用。
sunrise@ubuntu:~/Desktop/stm32_communication$ colcon build
Starting >>> stm32_communication
[Processing: stm32_communication]
--- stderr: stm32_communication
CMake Warning:
Manually-specified variables were not used by the project:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:36:27: error: ‘class drivers::serial_driver::SerialPort’ has no member named ‘init_port’
36 | serial_port_->init_port(port, {baud_rate, fc, pt, sb});
| ^~~~~~~~~
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:38:32: error: ‘class drivers::serial_driver::SerialPort’ has no member named ‘port_open’
38 | if (!serial_port_->port_open()) {
| ^~~~~~~~~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24,
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/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:3:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:42:39: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long int’ [-Wformat=]
42 | RCLCPP_INFO(get_logger(), "Serial port %s opened at %d baud",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | port.c_str(), baud_rate);
| ~~~~~~~~~
| |
| long int
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:42:66: note: format string is defined here
42 | RCLCPP_INFO(get_logger(), "Serial port %s opened at %d baud",
| ~^
| |
| int
| %ld
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In lambda function:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:67:58: error: ‘using element_type = class drivers::common::IoContext’ {aka ‘class drivers::common::IoContext’} has no member named ‘run’
67 | io_thread_ = std::thread(this { io_context_->run(); });
| ^~~
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In destructor ‘virtual Stm32Communicator::~Stm32Communicator()’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:72:22: error: ‘using element_type = class drivers::common::IoContext’ {aka ‘class drivers::common::IoContext’} has no member named ‘stop’
72 | io_context_->stop();
| ^~~~
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp: In member function ‘void Stm32Communicator::read_from_stm32()’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:119:28: error: ‘class drivers::serial_driver::SerialPort’ has no member named ‘port_open’
119 | if (!serial_port_->port_open()) return;
| ^~~~~~~~~
In file included from /usr/include/c++/11/memory:76,
from /home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:1:
/usr/include/c++/11/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = drivers::serial_driver::SerialPort; _Args = {drivers::common::IoContext&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptrdrivers::serial_driver::SerialPort]’:
/home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:18:72: required from here
/usr/include/c++/11/bits/unique_ptr.h:962:30: error: no matching function for call to ‘drivers::serial_driver::SerialPort::SerialPort(drivers::common::IoContext&)’
962 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/humble/include/serial_driver/serial_driver.hpp:22,
from /home/sunrise/Desktop/stm32_communication/src/stm32_communicate.cpp:5:
/opt/ros/humble/include/serial_driver/serial_port.hpp:173:3: note: candidate: ‘drivers::serial_driver::SerialPort::SerialPort(const drivers::common::IoContext&, const string&, drivers::serial_driver::SerialPortConfig)’
173 | SerialPort(
| ^~~~~~~~~~
/opt/ros/humble/include/serial_driver/serial_port.hpp:173:3: note: candidate expects 3 arguments, 1 provided
gmake[2]: *** [CMakeFiles/stm32_serial_node.dir/build.make:76:CMakeFiles/stm32_serial_node.dir/src/stm32_communicate.cpp.o] 错误 1
gmake[1]: *** [CMakeFiles/Makefile2:137:CMakeFiles/stm32_serial_node.dir/all] 错误 2
gmake: *** [Makefile:146:all] 错误 2
Failed <<< stm32_communication [36.0s, exited with code 2]
Summary: 0 packages finished [38.1s]
1 package failed: stm32_communication
1 package had stderr output: stm32_communication
在重新跑快速上手教程9.0.6里的使用docker运行雷达驱动时,选择1,但是一直连接不上,一直在等待连接,之前是全部都可以的,不知道是什么原因呢,求解答
f0904ce4-cd1c-449d-88e4-a4ea554885e0-image.png
输入nc -l 8889 可以接受到雷达信息
使用的是pc端用有线连接路由器,虚拟机是使用桥接的
93ad7ed5-8cfb-4c1a-a0f2-6da1678ca826-image.png
80289326-6a0c-4666-8641-282b297d02a7-7172a8bc8ffb142dfa8c4f78f7fc192.jpg
无线模式是通过这几行代码连接
// 1.设置传输协议并延时等待设置完成 IPAddress agent_ip; agent_ip.fromString("xxx.xxx.x.xx"); // 替换为你自己主机的 IP 地址 set_microros_wifi_transports("wifi", "pwd", agent_ip, 8888);那么串口模式是通过
set_microros_serial_transports(Serial);这个代码进行连接吗?还需要设置别的吗?
双系统ubuntu22.04humble,学校没有网线连接,使用了中兴的zte ax3000路由器(192.168.5.1)直接使用(没有网络接入),局域网下有雷达(192.168.5.16)和底盘(192.168.5.17)两个设备无线连接2.4G,有线连接了电脑设备(192.168.5.15),可以从电脑ping通各个设备,延迟在3ms左右。调试一下午无果求助。
问题描述:启动后选择1,2都没有任何问题,启动2可以使用rviz2查看/scan有显示
xhost + && sudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/snd -e DISPLAY=unix$DISPLAY -p 8889:8888 registry.cn-hangzhou.aliyuncs.com/fishros/fishbot_laser启动3后大概10秒左右,坐标laser_frame一直摆动,有时候启动会较大的移动。是无规律移动偏移。
d1c353a6-bf92-4e32-a876-9eedb132fd36-截图 2025-04-06 18-40-13.png
相关的报错
然后再次打开一个rviz2,/scan正常,odom和map移动异常(小车静止)怀疑是odom、map的问题。
[ydlidar_node-6] [2025-04-06 10:52:13][error] Timeout count: 1 [ydlidar_node-6] [2025-04-06 10:52:13][error] Timeout count: 2 [ydlidar_node-6] [2025-04-06 10:52:13][error] Timeout count: 3 [cartographer_node-3] [INFO] [1743936733.740978075] [cartographer logger]: I0406 10:52:13.000000 1193 node.cpp:569] Shutdown the subscriber of [scan] [cartographer_node-3] [INFO] [1743936733.741022840] [cartographer logger]: I0406 10:52:13.000000 1193 map_builder_bridge.cpp:152] Finishing trajectory with ID '0'... [cartographer_node-3] [WARN] [1743936733.741097461] [cartographer logger]: W0406 10:52:13.000000 1193 node.cpp:773] Can't run final optimization if there are one or more active trajectories. Trying to finish trajectory with ID 0 now. [cartographer_node-3] [INFO] [1743936733.741111484] [cartographer logger]: I0406 10:52:13.000000 1193 node.cpp:551] Trajectory 0 already pending to finish. [cartographer_node-3] [INFO] [1743936733.741125170] [cartographer logger]: I0406 10:52:13.000000 1193 map_builder_bridge.cpp:161] Running final trajectory optimization... [cartographer_node-3] [INFO] [1743936733.741155903] [cartographer logger]: I0406 10:52:13.000000 1245 pose_graph_2d.cc:538] Remaining work items in queue: 0 [cartographer_node-3] [INFO] [1743936733.741208203] [cartographer logger]: I0406 10:52:13.000000 1245 constraint_builder_2d.cc:290] 25 computations resulted in 3 additional constraints. [cartographer_node-3] [INFO] [1743936733.741281094] [cartographer logger]: I0406 10:52:13.000000 1245 constraint_builder_2d.cc:292] Score histogram: [cartographer_node-3] Count: 131 Min: 0.650471 Max: 0.898431 Mean: 0.752449 [cartographer_node-3] [0.650471, 0.675267) ## Count: 15 (11.4504%) Total: 15 (11.4504%) [cartographer_node-3] [0.675267, 0.700063) ## Count: 11 (8.39695%) Total: 26 (19.8473%) [cartographer_node-3] [0.700063, 0.724859) ## Count: 11 (8.39695%) Total: 37 (28.2443%) [cartographer_node-3] [0.724859, 0.749655) #### Count: 24 (18.3206%) Total: 61 (46.5649%) [cartographer_node-3] [0.749655, 0.774451) #### Count: 29 (22.1374%) Total: 90 (68.7023%) [cartographer_node-3] [0.774451, 0.799247) ### Count: 22 (16.7939%) Total: 112 (85.4962%) [cartographer_node-3] [0.799247, 0.824043) # Count: 8 (6.10687%) Total: 120 (91.6031%) [cartographer_node-3] [0.824043, 0.848839) Count: 2 (1.52672%) Total: 122 (93.1298%) [cartographer_node-3] [0.848839, 0.873635) # Count: 4 (3.05344%) Total: 126 (96.1832%) [cartographer_node-3] [0.873635, 0.898431] # Count: 5 (3.81679%) Total: 131 (100%) [cartographer_node-3] [INFO] [1743936733.797947533] [cartographer logger]: I0406 10:52:13.000000 1245 pose_graph_2d.cc:538] Remaining work items in queue: 1 [cartographer_node-3] [INFO] [1743936733.797970028] [cartographer logger]: I0406 10:52:13.000000 1245 constraint_builder_2d.cc:290] 0 computations resulted in 0 additional constraints. [cartographer_node-3] [INFO] [1743936733.798014465] [cartographer logger]: I0406 10:52:13.000000 1245 constraint_builder_2d.cc:292] Score histogram: [cartographer_node-3] Count: 131 Min: 0.650471 Max: 0.898431 Mean: 0.752449 [cartographer_node-3] [0.650471, 0.675267) ## Count: 15 (11.4504%) Total: 15 (11.4504%) [cartographer_node-3] [0.675267, 0.700063) ## Count: 11 (8.39695%) Total: 26 (19.8473%) [cartographer_node-3] [0.700063, 0.724859) ## Count: 11 (8.39695%) Total: 37 (28.2443%) [cartographer_node-3] [0.724859, 0.749655) #### Count: 24 (18.3206%) Total: 61 (46.5649%) [cartographer_node-3] [0.749655, 0.774451) #### Count: 29 (22.1374%) Total: 90 (68.7023%) [cartographer_node-3] [0.774451, 0.799247) ### Count: 22 (16.7939%) Total: 112 (85.4962%) [cartographer_node-3] [0.799247, 0.824043) # Count: 8 (6.10687%) Total: 120 (91.6031%) [cartographer_node-3] [0.824043, 0.848839) Count: 2 (1.52672%) Total: 122 (93.1298%) [cartographer_node-3] [0.848839, 0.873635) # Count: 4 (3.05344%) Total: 126 (96.1832%) [cartographer_node-3] [0.873635, 0.898431] # Count: 5 (3.81679%) Total: 131 (100%) [cartographer_node-3] [INFO] [1743936733.813257007] [cartographer logger]: I0406 10:52:13.000000 1244 constraint_builder_2d.cc:290] 0 computations resulted in 0 additional constraints. [cartographer_node-3] [INFO] [1743936733.813303709] [cartographer logger]: I0406 10:52:13.000000 1244 constraint_builder_2d.cc:292] Score histogram: [cartographer_node-3] Count: 131 Min: 0.650471 Max: 0.898431 Mean: 0.752449 [cartographer_node-3] [0.650471, 0.675267) ## Count: 15 (11.4504%) Total: 15 (11.4504%) [cartographer_node-3] [0.675267, 0.700063) ## Count: 11 (8.39695%) Total: 26 (19.8473%) [cartographer_node-3] [0.700063, 0.724859) ## Count: 11 (8.39695%) Total: 37 (28.2443%) [cartographer_node-3] [0.724859, 0.749655) #### Count: 24 (18.3206%) Total: 61 (46.5649%) [cartographer_node-3] [0.749655, 0.774451) #### Count: 29 (22.1374%) Total: 90 (68.7023%) [cartographer_node-3] [0.774451, 0.799247) ### Count: 22 (16.7939%) Total: 112 (85.4962%) [cartographer_node-3] [0.799247, 0.824043) # Count: 8 (6.10687%) Total: 120 (91.6031%) [cartographer_node-3] [0.824043, 0.848839) Count: 2 (1.52672%) Total: 122 (93.1298%) [cartographer_node-3] [0.848839, 0.873635) # Count: 4 (3.05344%) Total: 126 (96.1832%) [cartographer_node-3] [0.873635, 0.898431] # Count: 5 (3.81679%) Total: 131 (100%) [cartographer_node-3] [INFO] [1743936733.815327771] [cartographer logger]: I0406 10:52:13.000000 1246 constraint_builder_2d.cc:290] 0 computations resulted in 0 additional constraints. [cartographer_node-3] [INFO] [1743936733.815367107] [cartographer logger]: I0406 10:52:13.000000 1246 constraint_builder_2d.cc:292] Score histogram: [cartographer_node-3] Count: 131 Min: 0.650471 Max: 0.898431 Mean: 0.752449 [cartographer_node-3] [0.650471, 0.675267) ## Count: 15 (11.4504%) Total: 15 (11.4504%) [cartographer_node-3] [0.675267, 0.700063) ## Count: 11 (8.39695%) Total: 26 (19.8473%) [cartographer_node-3] [0.700063, 0.724859) ## Count: 11 (8.39695%) Total: 37 (28.2443%) [cartographer_node-3] [0.724859, 0.749655) #### Count: 24 (18.3206%) Total: 61 (46.5649%) [cartographer_node-3] [0.749655, 0.774451) #### Count: 29 (22.1374%) Total: 90 (68.7023%) [cartographer_node-3] [0.774451, 0.799247) ### Count: 22 (16.7939%) Total: 112 (85.4962%) [cartographer_node-3] [0.799247, 0.824043) # Count: 8 (6.10687%) Total: 120 (91.6031%) [cartographer_node-3] [0.824043, 0.848839) Count: 2 (1.52672%) Total: 122 (93.1298%) [cartographer_node-3] [0.848839, 0.873635) # Count: 4 (3.05344%) Total: 126 (96.1832%) [cartographer_node-3] [0.873635, 0.898431] # Count: 5 (3.81679%) Total: 131 (100%) Optimizing: Done. Optimizing: Done. [ydlidar_node-6] [YDLIDAR ERROR]: -1 Device is not open [ydlidar_node-6] [ERROR] [1743936734.545499440] [ydlidar_node]: Failed to get scan [ydlidar_node-6] [INFO] [1743936734.545534686] [ydlidar_node]: [YDLIDAR INFO] Now YDLIDAR is stopping ....... [ydlidar_node-6] [2025-04-06 10:52:14][info] Now lidar scanning has stopped! [INFO] [ydlidar_node-6]: process has finished cleanly [pid 1306]补充的红色报错。
具体细节和上下文:3acef0db-0d60-4299-835e-503b41768630-截图 2025-04-06 18-49-35.png
更加离谱了,所有过程都是按照教程进行。
重新烧录,重新配置都已经用过,问了ai怀疑是时间未同步的导致数据丢失,还配置了chrony同步时间问题。网络配置尝试过两三次。
fishros@fishros-linux:~$ sudo apt-get update
获取:1 http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy InRelease [4,682 B]
命中:2 https://packages.microsoft.com/repos/code stable InRelease
已下载 4,682 B,耗时 1秒 (4,645 B/s)
正在读取软件包列表... 完成
fishros@fishros-linux:~$ sudo apt install git
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
没有可用的软件包 git,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
E: 软件包 git 没有可安装候选
之前那个u盘内存不够,换了一个256G的u盘全部重新安装,然后现在就特别卡,干什么都特别卡,之前都不这样的
[-][13.04s] CMD Result:success
Run CMD Task:[sudo apt search python3-colcon-common-extensions ]
[-][1.39s] CMD Result:success
Run CMD Task:[sudo apt install python3-colcon-common-extensions -y]
[-][51.76s] CMD Result:success
Run CMD Task:[sudo apt search python3-argcomplete ]
[-][1.45s] CMD Result:success
Run CMD Task:[sudo apt install python3-argcomplete -y]
[-][2.03s] CMD Result:success
Run CMD Task:[sudo apt search python3-rosdep ]
[-][1.46s] CMD Result:success
Run CMD Task:[sudo apt install python3-rosdep -y]
[-][9.89s] CMD Result:success
Run CMD Task:[ls /opt/ros/foxy/setup.bash]
[-][0.01s] CMD Result:code:2
安装失败了,请打开鱼香社区:https://fishros.org.cn/forum 在一键安装专区反馈问题...
Run CMD Task:[ls /opt/ros/foxy/setup.bash]
[-][0.01s] CMD Result:code:2
欢迎加入机器人学习交流QQ群:438144612(入群口令:一键安装)
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或打开链接查看:https://item.taobao.com/item.htm?id=696573635888
如在使用过程中遇到问题,请打开:https://fishros.org.cn/forum 进行反馈
检测到本次运行出现失败命令,直接退出按Ctrl+C,按任意键上传日志并退出
日志上传失败,若还需反馈请手动发帖!
sudo: 无法解析主机:b1-aibox: 未知的名称或服务
sudo: 无法解析主机:b1-aibox: 未知的名称或服务
怎么从零开始做一个基于xxx的蔬菜或者水果采摘机器人,用ros2humble树莓派做,上面有机械臂,下面是履带车的底盘,用slam建图,gazebo仿真,rviz2可视化的,Python或者c++编程的,能验证和输入路径规划算法,能够自己识别水果或者蔬菜进行采摘的,还能判断生熟,比如绿草莓就不摘,红草莓再摘,每一个步骤和每一个代码都讲的详细一点,零基础也能看懂也能做出来的
怎么把淘宝上二驱实体机器人里面的路劲规划算法换成别的算法并进行验证路劲规划算法
回复: [FishBot教程] 9.0.6. 雷达驱动及建图测试
首先跳线帽调整到WIFI模式,执行了相关的驱动,正常0d533b00-241f-412d-a603-fbdea65caebc-image.png
topic话题:没有/scan相关话题!9ee1a3e1-1cfd-45d3-838d-c81df6d020d7-image.png
虚拟机(使用的wsl)ip ,把192.168.31.202烧录进配置31d08cd0-40ff-482f-975a-296a7510a458-image.png
雷达板ip显示:192.168.31.117,oled上显示正常running。ping通
96caf141-8a8d-4ea3-b00b-7f10356bb32f-image.png
同一路由器下,电脑有线连接,雷达板无线连接
[ydlidar_node-6] [2025-04-06 03:07:38][error] Timeout count: 1
[ydlidar_node-6] [2025-04-06 03:07:38][error] Check Sum 0x6050 != 0x61D2
[ydlidar_node-6] [2025-04-06 03:07:38][error] Check Sum 0x6914 != 0x696C
[ydlidar_node-6] [2025-04-06 03:07:40][error] Timeout count: 1
[ydlidar_node-6] [YDLIDAR ERROR]: -1 Device Failed
[ydlidar_node-6] [ERROR] [1743908860.028052460] [ydlidar_node]: Failed to get scan
在git上下载的源代码,编译后的.bin文件,用配置助手烧录,显示烧录成功了,但是屏幕没法正常显示是啥问题导致的呀,扫描配置的时候还提示错误
6af7a1a4-e035-419a-b4e6-41661fb92394-image.png
版块
-
1.3k
主题4.7k
帖子 -
397
主题2.6k
帖子 -
25
主题110
帖子 -
981
主题4.1k
帖子 -
950
主题3.5k
帖子 -
4
主题10
帖子 -
345
主题1.5k
帖子
-
4分钟之前
-
大约1小时之前
-
大约1小时之前
-
大约1小时之前
-
大约3小时之前
-
大约3小时之前
-
大约4小时之前
-
大约5小时之前
-
大约5小时之前
每日废话
百般乐器,唢呐为王;不是升天,就是拜堂。