代码报错
-
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:CATKIN_INSTALL_INTO_PREFIX_ROOT
/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] 错误 2Failed <<< 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 -
@小伊 请帮我解决一下