/home/echo/catkin_ws/src/laser_control/src/control.cpp:15:17: error: ‘struct mavros_msgs::CommandLong’ has no member named ‘command’ 15 | servo_command.command = 183; // MAV_CMD_DO_SET_SERVO 请问这个代码我需要怎么修改
时间: 2023-12-23 08:06:23 浏览: 119
这个错误可能是由于 `mavros_msgs::CommandLong` 结构体中没有名为 `command` 的成员变量导致的。你可以尝试修改 `servo_command.command = 183;` 这行代码,将 `command` 改为 `broadcast`,即 `servo_command.broadcast = true;`。如果你需要设置具体的命令,可以使用 `command` 成员变量的替代方案 `command = mavros_msgs::CommandCode::DO_SET_SERVO`。
相关问题
yahboom@Transbot:~/dev/catkin_ws$ catkin_make Base path: /home/yahboom/dev/catkin_ws Source space: /home/yahboom/dev/catkin_ws/src Build space: /home/yahboom/dev/catkin_ws/build Devel space: /home/yahboom/dev/catkin_ws/devel Install space: /home/yahboom/dev/catkin_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/yahboom/dev/catkin_ws/build" #### #### #### Running command: "make -j6 -l6" in "/home/yahboom/dev/catkin_ws/build" ####
这段输出来自 `catkin_make` 命令,它用于编译 ROS packages。在这个例子中,`catkin_make` 在 `/home/yahboom/dev/catkin_ws` 目录下编译 ROS packages。输出中的信息表示:
- Base path: `/home/yahboom/dev/catkin_ws`:`catkin_make` 命令在这个路径下查找 ROS packages 的源代码和 build、devel、install 目录。
- Source space: `/home/yahboom/dev/catkin_ws/src`:ROS packages 的源代码目录。
- Build space: `/home/yahboom/dev/catkin_ws/build`:编译 ROS packages 时生成的中间文件和目标文件目录。
- Devel space: `/home/yahboom/dev/catkin_ws/devel`:编译 ROS packages 后生成的可执行文件和库文件目录。
- Install space: `/home/yahboom/dev/catkin_ws/install`:安装 ROS packages 后生成的可执行文件和库文件目录。
接下来的输出显示了 `catkin_make` 命令运行的步骤。首先运行 `make cmake_check_build_system` 命令检查 build 目录是否存在,以及 build 目录中是否存在 CMakeLists.txt 文件。然后运行 `make -j6 -l6` 命令编译 ROS packages。`-j6` 表示使用 6 个 CPU 核心并行编译,`-l6` 表示在编译过程中限制系统负载不超过 6。
mportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg' Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH. CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message): execute_process(/home/k/anaconda3/bin/python3 "/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py" "/opt/ros/noetic/share/catkin/cmake/../package.xml" "/home/k/catkin_ws/build/catkin/catkin_generated/version/package.cmake") returned error code 1 Call Stack (most recent call first): /opt/ros/noetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process) /opt/ros/noetic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml) /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:58 (find_package) -- Configuring incomplete, errors occurred! See also "/home/k/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/k/catkin_ws/build/CMakeFiles/CMakeError.log". Invoking "cmake" failed
这个错误是因为您缺少了catkin_pkg模块。您需要安装catkin_pkg模块并将其添加到PYTHONPATH中。您可以通过以下命令安装它:
```
pip install catkin_pkg
```
然后,将以下命令添加到您的.bashrc文件中,将catkin_pkg添加到PYTHONPATH中:
```
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages:/home/k/.local/lib/python3.8/site-packages:/opt/ros/noetic/lib/python3/dist-packages
```
请将上述命令中的路径更改为您计算机上实际安装的catkin_pkg模块的路径。完成后,重新启动终端并尝试重新构建您的代码。
阅读全文