大佬们,我在使用232串口通信时,接收数据时出现两个数据包连接在一块,或者一个数据包被分成了两段,这个应该怎么用C++解决呢
重要提示

yudonghou123 发布的最新帖子
-
[ros2run]: Segmentation fault
系统ubuntu22.04,ros2
各位大佬,我在进行ROS2 RUN时,终端输出以下问题:ros2 run auv_socket imu_data_pub [INFO] [1679059271.449093718] [imu_data_pub]: Connect RUNNING [INFO] [1679059271.449619076] [imu_data_pub]: connected successfullly! server message: $AUXA,1873.105,001873.100, 0.000, 0.000, 0.000,31.88882479,120.56537209, 29.64, 0.000, 0.000,0.0000, 0.000464, 0.001863,-0.003287,-0.002777, 0.999490, 0.017888,23.31,31.88882479,120.56537209, 29.64, 0.000, 0.000, 0.000, 0,00|00|00|000|000|0.00,0x02004080,0x00000010*C9 ��U [ros2run]: Segmentation fault
我的惯导发布节点代码如下:
#include <memory> #include <iostream> #include <fstream> #include <iomanip> #include "rclcpp/rclcpp.hpp" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> #include <arpa/inet.h> #include <netinet/in.h> #include <fcntl.h> #include <sys/shm.h> #include "auv_msgs/msg/imu.hpp" // IMU数据传输发布 #define PORT 26 #define BUFSIZE 1024 // 23 DVL 26 IMU 29 USBL 32 BDS char *SERVER_IP = "192.168.0.7"; int result = 0; using namespace std; using namespace std::chrono_literals; class imu_data_pub : public rclcpp::Node { public: imu_data_pub() : Node("imu_data_pub") { // 添加上电信号的指令 auto now = std::chrono::system_clock::now(); // 通过不同精度获取相差的毫秒数 uint64_t dis_millseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count() - std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count() * 1000; time_t tt = std::chrono::system_clock::to_time_t(now); auto time_tm = localtime(&tt); char strTime[25] = {0}; sprintf(strTime, "%d-%02d-%02d %02d:%02d:%02d %03d", time_tm->tm_year + 1900, time_tm->tm_mon + 1, time_tm->tm_mday, time_tm->tm_hour, time_tm->tm_min, time_tm->tm_sec, (int)dis_millseconds); ofstream imufile; imufile.open("imudata.txt", ios::out | ios::app); imufile << "******" << strTime << "******" << endl; imufile.close(); // 创建发布对象 imu_publisher_ = this->create_publisher<auv_msgs::msg::IMU>("imu_data", 100); imu_timer_ = this->create_wall_timer(0.1s, std::bind(&imu_data_pub::imu_time_callback, this)); } private: void imu_time_callback() { // socket通讯 char recvbuf[BUFSIZE]; int socket_cli = socket(AF_INET, SOCK_STREAM, 0); if (socket_cli < 0) { RCLCPP_INFO(this->get_logger(), "socket() error!"); } struct sockaddr_in sev_addr; memset(&sev_addr, 0, sizeof(sev_addr)); sev_addr.sin_family = AF_INET; sev_addr.sin_port = htons(PORT); sev_addr.sin_addr.s_addr = inet_addr(SERVER_IP); RCLCPP_INFO(this->get_logger(), "Connect RUNNING"); if (connect(socket_cli, (struct sockaddr *)&sev_addr, sizeof(sev_addr)) < 0) { RCLCPP_INFO(this->get_logger(), "connect error"); } else { RCLCPP_INFO(this->get_logger(), "connected successfullly!"); } while (rclcpp::ok()) { // 读取变量信息 recv(socket_cli, recvbuf, sizeof(recvbuf), 0); printf("server message: %s\n", recvbuf); auto imu_data = auv_msgs::msg::IMU(); const char *split = ","; // 使用,割符进行分割 char *p = strtok(recvbuf, split); int num = 0; double imu_value[24]; while (p != NULL) { imu_value[num] = strtod(p, NULL); num++; p = strtok(NULL, split); } imu_data.header.frame_id = "imu_link"; rclcpp::Time imu_right_time = this->get_clock()->now(); imu_data.header.stamp = imu_right_time; imu_data.imu_run_time = imu_value[1]; imu_data.imu_utc_time = imu_value[2]; imu_data.imu_yaw = imu_value[3]; imu_data.imu_pitch = imu_value[4]; imu_data.imu_roll = imu_value[5]; imu_data.imu_lat = imu_value[6]; imu_data.imu_lon = imu_value[7]; imu_data.imu_height = imu_value[8]; imu_data.imu_n_velocity = imu_value[9]; imu_data.imu_e_velocity = imu_value[10]; imu_data.imu_estimate_err = imu_value[11]; imu_data.imu_x_angvel = imu_value[12]; imu_data.imu_y_angvel = imu_value[13]; imu_data.imu_z_angvel = imu_value[14]; imu_data.imu_x_speforce = imu_value[15]; imu_data.imu_y_speforce = imu_value[16]; imu_data.imu_z_speforce = imu_value[17]; imu_data.imu_sys_temp = imu_value[18]; imu_data.imu_ref_lat = imu_value[19]; imu_data.imu_ref_lon = imu_value[20]; imu_data.imu_ref_height = imu_value[21]; imu_data.imu_ref_northvel = imu_value[22]; imu_data.imu_ref_eastvel = imu_value[23]; imu_data.imu_ref_yaw = imu_value[24]; // 判断角度不能超过其规定范围 /*if (imu_data.imu_yaw < 0) { imu_data.imu_yaw += 360; // RCLCPP_INFO(this->get_logger(), "IMU DATA ERROR"); } else if (imu_data.imu_yaw > 360) { imu_data.imu_yaw -= 360; } else { */ // 将数据写入txt文件储存,以便后期调用 ofstream imufile; imufile.open("imudata.txt", ios::out | ios::app); for (int i = 0; i < 25; i++) { imufile << fixed << setprecision(4) << imu_value[i] << " "; } cout << endl; imufile.close(); // 发布数据 imu_publisher_->publish(imu_data); //} } close(socket_cli); } rclcpp::TimerBase::SharedPtr imu_timer_; rclcpp::Publisher<auv_msgs::msg::IMU>::SharedPtr imu_publisher_; }; int main(int argc, char *argv[]) { rclcpp::init(argc, argv); rclcpp::spin(std::make_shared<imu_data_pub>()); rclcpp::shutdown(); return 0; }
我利用的socket通信来获取数据信息,大佬们能帮我看看怎么回事吗,不胜感激
-
QT订阅ROS2信息并发布
系统ubuntu22.04 ROS2 Humble
大佬们,就是我想结合QT5写一个可以订阅ros2节点信息并显示的界面,我将功能包写成这样
.
├── CMakeLists.txt
├── CMakeLists.txt.user
├── include
│ └── ros2_qt_display
│ ├── mainwindow.h
│ └── rclcomm.h
├── package.xml
├── src
│ ├── main.cpp
│ ├── mainwindow.cpp
│ └── rclcomm.cpp
└── ui
└── mainwindow.ui
我的mainwindow.h:#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "rclcomm.h" #include <iostream> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; rclcomm *commNode; public slots: void on_getimuyaw(QString); void on_getimupitch(QString); void on_getimuroll(QString); void on_getimulat(QString); void on_getimulon(QString); void on_getimualt(QString); void on_getimuxangvel(QString); void on_getimuyangvel(QString); void on_getimuzangvel(QString); void on_getimuxspef(QString); void on_getimuyspef(QString); void on_getimuzspef(QString); void on_getimunvel(QString); void on_getimuevel(QString); void on_getimuvelerr(QString); void on_pushButton02_clicked(); void on_pushButton01_clicked(); }; #endif // MAINWINDOW_H
然后我在mainwindow.cpp中调用这些:
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->pushButton01,SIGNAL(clicked(bool)),this,SLOT(on_pushButton01_clicked())); connect(ui->pushButton02,SIGNAL(clicked(bool)),this,SLOT(on_pushButton02_clicked())); commNode=new rclcomm(); connect(commNode,SIGNAL(getimuyaw(QString)),this,SLOT(on_getimuyaw(QString))); connect(commNode,SIGNAL(getimupitch(QString)),this,SLOT(on_getimupitch(QString))); connect(commNode,SIGNAL(getimuroll(QString)),this,SLOT(on_getimuroll(QString))); connect(commNode,SIGNAL(getimulat(QString)),this,SLOT(on_getimulat(QString))); connect(commNode,SIGNAL(getimulon(QString)),this,SLOT(on_getimulon(QString))); connect(commNode,SIGNAL(getimualt(QString)),this,SLOT(on_getimualt(QString))); connect(commNode,SIGNAL(getimuxangvel(QString)),this,SLOT(on_getimuxangvel(QString))); connect(commNode,SIGNAL(getimuyangvel(QString)),this,SLOT(on_getimuyangvel(QString))); connect(commNode,SIGNAL(getimuzangvel(QString)),this,SLOT(on_getimuzangvel(QString))); connect(commNode,SIGNAL(getimuxspef(QString)),this,SLOT(on_getimuxspef(QString))); connect(commNode,SIGNAL(getimuyspef(QString)),this,SLOT(on_getimuyspef(QString))); connect(commNode,SIGNAL(getimuzspef(QString)),this,SLOT(on_getimuzspef(QString))); connect(commNode,SIGNAL(getimunvel(QString)),this,SLOT(on_getimunvel(QString))); connect(commNode,SIGNAL(getimuevel(QString)),this,SLOT(on_getimuevel(QString))); connect(commNode,SIGNAL(getimuvelerr(QString)),this,SLOT(on_getimuvelerr(QString))); } void MainWindow::on_getimuyaw(QString yaw){ ui->textEdit_1->clear(); ui->textEdit_1->setText(yaw); } void MainWindow::on_getimupitch(QString pitch){ ui->textEdit_2->clear(); ui->textEdit_2->setText(pitch); } void MainWindow::on_getimuroll(QString roll){ ui->textEdit_3->clear(); ui->textEdit_3->setText(roll); } void MainWindow::on_getimulat(QString lat){ ui->textEdit_4->clear(); ui->textEdit_4->setText(lat); } void MainWindow::on_getimulon(QString lon){ ui->textEdit_5->clear(); ui->textEdit_5->setText(lon); } void MainWindow::on_getimualt(QString alt){ ui->textEdit_6->clear(); ui->textEdit_6->setText(alt); } void MainWindow::on_getimuxangvel(QString xangvel){ ui->textEdit_7->clear(); ui->textEdit_7->setText(xangvel); } void MainWindow::on_getimuyangvel(QString yangvel){ ui->textEdit_8->clear(); ui->textEdit_8->setText(yangvel); } void MainWindow::on_getimuzangvel(QString zangvel){ ui->textEdit_9->clear(); ui->textEdit_9->setText(zangvel); } void MainWindow::on_getimuxspef(QString xspef){ ui->textEdit_10->clear(); ui->textEdit_10->setText(xspef); } void MainWindow::on_getimuyspef(QString yspef){ ui->textEdit_11->clear(); ui->textEdit_11->setText(yspef); } void MainWindow::on_getimuzspef(QString zspef){ ui->textEdit_12->clear(); ui->textEdit_12->setText(zspef); } void MainWindow::on_getimunvel(QString nvel){ ui->textEdit_13->clear(); ui->textEdit_13->setText(nvel); } void MainWindow::on_getimuevel(QString evel){ ui->textEdit_15->clear(); ui->textEdit_15->setText(evel); } void MainWindow::on_getimuvelerr(QString velerr){ ui->textEdit_15->clear(); ui->textEdit_15->setText(velerr); } void MainWindow::on_pushButton01_clicked() { commNode->start(); } void MainWindow::on_pushButton02_clicked() { } MainWindow::~MainWindow() { delete ui; }
我的终端始终爆出下面的问题:
--- stderr: ros2_qt_display /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x1b): undefined reference to `main' /usr/bin/ld: CMakeFiles/ros2_qt_display.dir/include/ros2_qt_display/moc_mainwindow.cpp.o: in function `MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)': moc_mainwindow.cpp:(.text+0x93): undefined reference to `MainWindow::on_getimuyaw(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0xd1): undefined reference to `MainWindow::on_getimupitch(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x10f): undefined reference to `MainWindow::on_getimuroll(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x14d): undefined reference to `MainWindow::on_getimulat(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x18b): undefined reference to `MainWindow::on_getimulon(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x1c9): undefined reference to `MainWindow::on_getimualt(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x207): undefined reference to `MainWindow::on_getimuxangvel(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x245): undefined reference to `MainWindow::on_getimuyangvel(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x283): undefined reference to `MainWindow::on_getimuzangvel(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x2c1): undefined reference to `MainWindow::on_getimuxspef(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x2ff): undefined reference to `MainWindow::on_getimuyspef(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x33d): undefined reference to `MainWindow::on_getimuzspef(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x37b): undefined reference to `MainWindow::on_getimunvel(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x3b9): undefined reference to `MainWindow::on_getimuevel(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x3f4): undefined reference to `MainWindow::on_getimuvelerr(QString)' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x40e): undefined reference to `MainWindow::on_pushButton02_clicked()' /usr/bin/ld: moc_mainwindow.cpp:(.text+0x41c): undefined reference to `MainWindow::on_pushButton01_clicked()' /usr/bin/ld: CMakeFiles/ros2_qt_display.dir/include/ros2_qt_display/moc_mainwindow.cpp.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x28): undefined reference to `MainWindow::~MainWindow()' /usr/bin/ld: CMakeFiles/ros2_qt_display.dir/include/ros2_qt_display/moc_mainwindow.cpp.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x30): undefined reference to `MainWindow::~MainWindow()' /usr/bin/ld: CMakeFiles/ros2_qt_display.dir/include/ros2_qt_display/moc_mainwindow.cpp.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1c8): undefined reference to `non-virtual thunk to MainWindow::~MainWindow()' /usr/bin/ld: CMakeFiles/ros2_qt_display.dir/include/ros2_qt_display/moc_mainwindow.cpp.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1d0): undefined reference to `non-virtual thunk to MainWindow::~MainWindow()' /usr/bin/ld: CMakeFiles/ros2_qt_display.dir/include/ros2_qt_display/moc_rclcomm.cpp.o:(.data.rel.ro._ZTV7rclcomm[_ZTV7rclcomm]+0x70): undefined reference to `rclcomm::run()' collect2: error: ld returned 1 exit status gmake[2]: *** [CMakeFiles/ros2_qt_display.dir/build.make:208:ros2_qt_display] 错误 1 gmake[1]: *** [CMakeFiles/Makefile2:137:CMakeFiles/ros2_qt_display.dir/all] 错误 2 gmake: *** [Makefile:146:all] 错误 2 ---
请问这是怎么回事呢,我用的VScode,请各位大佬提醒一下,谢谢
-
RE: 运行launch文件报错
@小伊 在launch文件出现这种问题怎么解决
Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [launch]: nested parameters and value attributes are mutually exclusive
-
RE: 运行launch文件报错
@小伊 代码是这样的
<launch> <arg name="uuv_name" default="eca_a9"/> <arg name="gui_on" default="true"/> <arg name="use_ned_frame" default="false"/> <!-- <arg name="teleop_on" default="false"/> <arg name="joy_id" default="0"/> <arg name="axis_yaw" default="0"/> <arg name="axis_x" default="4"/> <arg name="axis_y" default="3"/> <arg name="axis_z" default="1"/> --> <arg name="Kd" default="[24.328999405818507,95.16574836816616,25.943377407248825,0,6.388371356010936,79.2844976871164]"/> <arg name="Ki" default="[0.0010232768152540483,0.0010232768152540483,0.0010232768152540483,0,0.11901644069756079,0.11901644069756079]"/> <arg name="slope" default="[0.9903858668992097,0.9903858668992097,0.9903858668992097,0,0.20796465986893387,0.20796465986893387]"/> <arg name="look_ahead_delay" default="2.0"/> <arg name="min_thrust" default="40"/> <include file="$(find-pkg-share eca_a9_control)/launch/start_control_allocator.launch"/> <group if="$(var use_ned_frame)"> <push-ros-namespace namespace="$(var uuv_name)"/> <node pkg="uuv_trajectory_control" exec="rov_nmb_sm_controller.py" name="rov_nmb_sm_controller" output="screen"> <!-- Remap necessary topics --> <remap from="odom" to="pose_gt_ned"/> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="input_trajectory" to="dp_controller/input_trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="error" to="dp_controller/error"/> <remap from="reference" to="dp_controller/reference"/> <remap from="thruster_output" to="thruster_manager/input_stamped"/> <remap from="auv_command_output" to="control_allocation/control_input"/> <!-- Controller parameters --> <param name="subst_value" value="true"> <param name="saturation" value="200"/> <param name="thrusters_only" value="false"/> <param name="Kd" value="$(var Kd)"/> <param name="Ki" value="$(var Ki)"/> <param name="slope" value="$(var slope)"/> <param name="inertial_frame_id" value="world_ned"/> <param name="max_forward_speed" value="3.0"/> <param name="use_stamped_poses_only" value="false"/> <param name="look_ahead_delay" value="$(var look_ahead_delay)"/> <param name="min_thrust" value="$(var min_thrust)"/> <param name="dubins"> <param name="radius" value="25"/> <param name="max_pitch" value="0.09"/> </param> </param> </node> </group> <group unless="$(var use_ned_frame)"> <push-ros-namespace namespace="$(var uuv_name)"/> <node pkg="uuv_trajectory_control" exec="rov_nmb_sm_controller.py" name="rov_nmb_sm_controller" output="screen"> <!-- Remap necessary topics --> <remap from="odom" to="pose_gt"/> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="input_trajectory" to="dp_controller/input_trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="error" to="dp_controller/error"/> <remap from="reference" to="dp_controller/reference"/> <remap from="thruster_output" to="thruster_manager/input_stamped"/> <remap from="auv_command_output" to="control_allocation/control_input"/> <!-- Controller parameters --> <param name="subst_value" value="$(var subst_value)"> <param name="saturation" value="($var saturation)"/> <param name="thrusters_only" value="($var thrusters_only)"/> <param name="Kd" value="$(var Kd)"/> <param name="Ki" value="$(var Ki)"/> <param name="slope" value="$(var slope)"/> <param name="inertial_frame_id" value="$(var inertial_frame_id)"/> <param name="max_forward_speed" value="$(var max_forward_speed)"/> <param name="use_stamped_poses_only" value="$(var use_stamped_poses_only)"/> <param name="look_ahead_delay" value="$(var look_ahead_delay)"/> <param name="min_thrust" value="$(var min_thrust)"/> <param name="dubins"> <param name="radius" value="25"/> <param name="max_pitch" value="0.09"/> </param> </param> </node> </group> <!-- <group if="$(var gui_on)"> <node name="rviz" pkg="rviz2" exec="rviz2" output="screen" args="-d $(find-pkg-share eca_a9_control)/rviz/eca_a9_control.rviz"/> </group> --> </launch>
-
RE: 运行launch文件报错
@小伊 终端输出问题如下
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [launch]: nested parameters and value attributes are mutually exclusive
-
RE: 运行launch文件报错
@yudonghou123 大佬们,我发现是这个launch文件出错了,大佬们能帮我看看是launch标签用的不对吗?
<launch> <arg name="uuv_name" default="eca_a9"/> <arg name="gui_on" default="true"/> <arg name="use_ned_frame" default="false"/> <!-- <arg name="teleop_on" default="false"/> <arg name="joy_id" default="0"/> <arg name="axis_yaw" default="0"/> <arg name="axis_x" default="4"/> <arg name="axis_y" default="3"/> <arg name="axis_z" default="1"/> --> <arg name="Kd" default="[24.328999405818507,95.16574836816616,25.943377407248825,0,6.388371356010936,79.2844976871164]"/> <arg name="Ki" default="[0.0010232768152540483,0.0010232768152540483,0.0010232768152540483,0,0.11901644069756079,0.11901644069756079]"/> <arg name="slope" default="[0.9903858668992097,0.9903858668992097,0.9903858668992097,0,0.20796465986893387,0.20796465986893387]"/> <arg name="look_ahead_delay" default="2.0"/> <arg name="min_thrust" default="40"/> <arg name="subst_value" default="true"/> <arg name="saturation" default="200"/> <arg name="thrusters_only" default="false"/> <arg name="max_forward_speed" default="3.0"/> <arg name="use_stamped_poses_only" default="false"/> <arg name="inertial_frame_id" default="world"/><!-- 和use_ned_frame有关 --> <include file="$(find-pkg-share eca_a9_control)/launch/start_control_allocator.launch"/> <group if="$(var use_ned_frame)"> <push-ros-namespace namespace="$(var uuv_name)"/> <node pkg="uuv_trajectory_control" exec="rov_nmb_sm_controller.py" name="rov_nmb_sm_controller" output="screen"> <!-- Remap necessary topics --> <remap from="odom" to="pose_gt_ned"/> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="input_trajectory" to="dp_controller/input_trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="error" to="dp_controller/error"/> <remap from="reference" to="dp_controller/reference"/> <remap from="thruster_output" to="thruster_manager/input_stamped"/> <remap from="auv_command_output" to="control_allocation/control_input"/> <!-- Controller parameters --> <param name="subst_value" value="true"> <param name="saturation" value="200"/> <param name="thrusters_only" value="false"/> <param name="Kd" value="$(var Kd)"/> <param name="Ki" value="$(var Ki)"/> <param name="slope" value="$(var slope)"/> <param name="inertial_frame_id" value="world_ned"/> <param name="max_forward_speed" value="3.0"/> <param name="use_stamped_poses_only" value="false"/> <param name="look_ahead_delay" value="$(var look_ahead_delay)"/> <param name="min_thrust" value="$(var min_thrust)"/> <param name="dubins"> <param name="radius" value="25"/> <param name="max_pitch" value="0.09"/> </param> </param> </node> </group> <group unless="$(var use_ned_frame)"> <push-ros-namespace namespace="$(var uuv_name)"/> <node pkg="uuv_trajectory_control" exec="rov_nmb_sm_controller.py" name="rov_nmb_sm_controller" output="screen"> <!-- Remap necessary topics --> <remap from="odom" to="pose_gt"/> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="input_trajectory" to="dp_controller/input_trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="error" to="dp_controller/error"/> <remap from="reference" to="dp_controller/reference"/> <remap from="thruster_output" to="thruster_manager/input_stamped"/> <remap from="auv_command_output" to="control_allocation/control_input"/> <!-- Controller parameters --> <param name="subst_value" value="$(var subst_value)"> <param name="saturation" value="($var saturation)"/> <param name="thrusters_only" value="($var thrusters_only)"/> <param name="Kd" value="$(var Kd)"/> <param name="Ki" value="$(var Ki)"/> <param name="slope" value="$(var slope)"/> <param name="inertial_frame_id" value="$(var inertial_frame_id)"/> <param name="max_forward_speed" value="$(var max_forward_speed)"/> <param name="use_stamped_poses_only" value="$(var use_stamped_poses_only)"/> <param name="look_ahead_delay" value="$(var look_ahead_delay)"/> <param name="min_thrust" value="$(var min_thrust)"/> <param name="dubins"> <param name="radius" value="25"/> <param name="max_pitch" value="0.09"/> </param> </param> </node> </group> <!-- <group if="$(var gui_on)"> <node name="rviz" pkg="rviz2" exec="rviz2" output="screen" args="-d $(find-pkg-share eca_a9_control)/rviz/eca_a9_control.rviz"/> </group> --> </launch>
-
运行launch文件报错
系统ubuntu22.04 ros2 humble
我在先后运行两个launch文件时,一个终端报出下面问题:<launch> <arg name="uuv_name" default="eca_a9"/> <!-- Vehicle's initial position --> <arg name="x" default="0"/> <arg name="y" default="0"/> <arg name="z" default="-20"/> <arg name="yaw" default="0.0"/> <arg name="gui_on" default="true"/> <arg name="record" default="false"/> <arg name="bag_filename" default="recording.bag"/> <arg name="use_ned_frame" default="false"/> <arg name="joy_id" default="0"/> <include file="$(find-pkg-share eca_a9_description)/launch/upload_eca_a9.launch"> <arg name="namespace" value="$(var uuv_name)"/> <arg name="x" value="$(var x)"/> <arg name="y" value="$(var y)"/> <arg name="z" value="$(var z)"/> <arg name="yaw" value="$(var yaw)"/> </include> <!-- This node just reads the trajectory and waypoint topics and publishes visualization markers for RViz --> <group if="$(var gui_on)"> <group> <push-ros-namespace namespace="$(var uuv_name)"/> <node pkg="uuv_control_utils" exec="trajectory_marker_publisher.py" name="trajectory_marker_publisher" output="screen"> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="reference" to="dp_controller/reference"/> </node> </group> </group> <include file="$(find-pkg-share eca_a9_control)/launch/start_nmb_sm_control.launch"/> <include file="$(find-pkg-share uuv_control_utils)/launch/send_waypoints_file.launch"> <arg name="uuv_name" value="eca_a9"/> <arg name="filename" value="$(find-pkg-share eca_a9_gazebo)/config/waypoint_set.yaml"/> <arg name="interpolator" value="dubins"/> </include> <!-- Initialize the recording afo the simulation according to the record flag --> <!-- <include file="$(find eca_a9_gazebo)/launch/record_demo.launch"> <arg name="record" value="$(arg record)"/> <arg name="use_ned_frame" value="$(arg use_ned_frame)"/> <arg name="bag_filename" value="$(arg bag_filename)"/> </include> --> </launch>
<launch> <arg name="uuv_name" default="eca_a9"/> <arg name="gui_on" default="true"/> <arg name="use_ned_frame" default="false"/> <arg name="teleop_on" default="false"/> <arg name="joy_id" default="0"/> <arg name="axis_yaw" default="0"/> <arg name="axis_x" default="4"/> <arg name="axis_y" default="3"/> <arg name="axis_z" default="1"/> <arg name="Kd" default="[24.328999405818507,95.16574836816616,25.943377407248825,0,6.388371356010936,79.2844976871164]"/> <arg name="Ki" default="[0.0010232768152540483,0.0010232768152540483,0.0010232768152540483,0,0.11901644069756079,0.11901644069756079]"/> <arg name="slope" default="[0.9903858668992097,0.9903858668992097,0.9903858668992097,0,0.20796465986893387,0.20796465986893387]"/> <arg name="look_ahead_delay" default="2.0"/> <arg name="min_thrust" default="40"/> <include file="$(find-pkg-share eca_a9_control)/launch/start_control_allocator.launch"/> <group> <push-ros-namespace namespace="$(var uuv_name)"/> <node pkg="uuv_trajectory_control" exec="rov_nmb_sm_controller.py" name="rov_nmb_sm_controller" output="screen" if="$(var use_ned_frame)"> <!-- Remap necessary topics --> <remap from="odom" to="pose_gt_ned"/> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="input_trajectory" to="dp_controller/input_trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="error" to="dp_controller/error"/> <remap from="reference" to="dp_controller/reference"/> <remap from="thruster_output" to="thruster_manager/input_stamped"/> <remap from="auv_command_output" to="control_allocation/control_input"/> <!-- Controller parameters --> <param name="subst_value" value="true"> <param name="saturation" value="200"/> <param name="thrusters_only" value="false"/> <param name="Kd" value="$(var Kd)"/> <param name="Ki" value="$(var Ki)"/> <param name="slope" value="$(var slope)"/> <param name="inertial_frame_id" value="world_ned"/> <param name="max_forward_speed" value="3.0"/> <param name="use_stamped_poses_only" value="false"/> <param name="look_ahead_delay" value="$(var look_ahead_delay)"/> <param name="min_thrust" value="$(var min_thrust)"/> <param name="dubins"> <param name="radius" value="25"/> <param name="max_pitch" value="0.09"/> </param> <!-- saturation: 200 thrusters_only: false Kd: $(var Kd) Ki: $(var Ki) slope: $(var slope) inertial_frame_id: world_ned max_forward_speed: 3.0 use_stamped_poses_only: false look_ahead_delay: $(var look_ahead_delay) min_thrust: $(var min_thrust) dubins: radius: 25 max_pitch: 0.09 --> </param> </node> <node pkg="uuv_trajectory_control" exec="rov_nmb_sm_controller.py" name="rov_nmb_sm_controller" output="screen" unless="$(var use_ned_frame)"> <!-- Remap necessary topics --> <remap from="odom" to="pose_gt"/> <remap from="trajectory" to="dp_controller/trajectory"/> <remap from="input_trajectory" to="dp_controller/input_trajectory"/> <remap from="waypoints" to="dp_controller/waypoints"/> <remap from="error" to="dp_controller/error"/> <remap from="reference" to="dp_controller/reference"/> <remap from="thruster_output" to="thruster_manager/input_stamped"/> <remap from="auv_command_output" to="control_allocation/control_input"/> <!-- Controller parameters --> <param name="subst_value" value="true"> <param name="saturation" value="200"/> <param name="thrusters_only" value="false"/> <param name="Kd" value="$(var Kd)"/> <param name="Ki" value="$(var Ki)"/> <param name="slope" value="$(var slope)"/> <param name="inertial_frame_id" value="world"/> <param name="max_forward_speed" value="3.0"/> <param name="use_stamped_poses_only" value="false"/> <param name="look_ahead_delay" value="$(var look_ahead_delay)"/> <param name="min_thrust" value="$(var min_thrust)"/> <param name="dubins"> <param name="radius" value="25"/> <param name="max_pitch" value="0.09"/> </param> <!-- saturation: 200 thrusters_only: false Kd: $(var Kd) Ki: $(var Ki) slope: $(var slope) inertial_frame_id: world max_forward_speed: 3.0 use_stamped_poses_only: false look_ahead_delay: $(var look_ahead_delay) min_thrust: $(var min_thrust) dubins: radius: 25 max_pitch: 0.09 --> </param> </node> </group> <group if="$(var gui_on)"> <node name="rviz" pkg="rviz2" exec="rviz2" output="screen" args="-d $(find-pkg-share eca_a9_control)/rviz/eca_a9_control.rviz"/> </group> </launch>
终端输出问题:
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [launch]: nested parameters and value attributes are mutually exclusive
请问各位大佬,这是怎么回事呢?
-
rviz不能显示环境模型,且机器人模型也不在
各位大佬,我运行项目的时候,机器人也能在gazebo环境中加载出来,但不在rviz中显示,终端报出以下问题:
[INFO] [launch]: All log files can be found below /home/user2/.ros/log/2023-02-17-20-10-20-236922-user2-1009600 [INFO] [launch]: Default logging verbosity is set to INFO redefining global symbol: range when instantiating macro: pressure_plugin_macro (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/pressure_snippets.xacro) instantiated from: default_pressure (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/pressure_snippets.xacro) instantiated from: eca_a9_base (/home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_base.xacro) in file: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_sensors.xacro included from: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/robots/eca_a9_default.urdf.xacro redefining global symbol: gamma when instantiating macro: chemical_concentration_sensor_macro (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/chemical_concentration_snippets.xacro) instantiated from: default_chemical_concentration_sensor (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/chemical_concentration_snippets.xacro) instantiated from: eca_a9_base (/home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_base.xacro) in file: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_sensors.xacro included from: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/robots/eca_a9_default.urdf.xacro [INFO] [spawn_entity.py-1]: process started with pid [1009650] [INFO] [robot_state_publisher-2]: process started with pid [1009652] [INFO] [uuv_message_to_tf-3]: process started with pid [1009654] [INFO] [finned_uuv_teleop.py-4]: process started with pid [1009656] [INFO] [joy_node-5]: process started with pid [1009658] [INFO] [rviz2-6]: process started with pid [1009660] [rviz2-6] WARNING: CPU random generator seem to be failing, disabling hardware random number generation [rviz2-6] WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff [rviz2-6] qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "" [spawn_entity.py-1] [INFO] [1676635822.866889330] [eca_a9.urdf_spawner]: Spawn Entity started [spawn_entity.py-1] [INFO] [1676635822.867159779] [eca_a9.urdf_spawner]: Loading entity published on topic robot_description [spawn_entity.py-1] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead. [spawn_entity.py-1] warnings.warn( [joy_node-5] [INFO] [1676635823.094236435] [eca_a9.joystick]: No haptic (rumble) available, skipping initialization [joy_node-5] [INFO] [1676635823.094329099] [eca_a9.joystick]: Opened joystick: SHANWAN Android Gamepad. deadzone: 0.050000 [spawn_entity.py-1] [INFO] [1676635823.155215881] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [robot_state_publisher-2] [WARN] [1676635823.157768385] [kdl_parser]: The root link eca_a9/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-2] [INFO] [1676635823.157911755] [eca_a9.robot_state_publisher]: got segment eca_a9/base_link [robot_state_publisher-2] [INFO] [1676635823.157965126] [eca_a9.robot_state_publisher]: got segment eca_a9/battery_link [robot_state_publisher-2] [INFO] [1676635823.157972469] [eca_a9.robot_state_publisher]: got segment eca_a9/camera_link [robot_state_publisher-2] [INFO] [1676635823.157978942] [eca_a9.robot_state_publisher]: got segment eca_a9/camera_link_optical [robot_state_publisher-2] [INFO] [1676635823.157984462] [eca_a9.robot_state_publisher]: got segment eca_a9/cc_sensor_link [robot_state_publisher-2] [INFO] [1676635823.157990012] [eca_a9.robot_state_publisher]: got segment eca_a9/dvl_link [robot_state_publisher-2] [INFO] [1676635823.157995603] [eca_a9.robot_state_publisher]: got segment eca_a9/dvl_sonar0_link [robot_state_publisher-2] [INFO] [1676635823.158002356] [eca_a9.robot_state_publisher]: got segment eca_a9/dvl_sonar1_link [robot_state_publisher-2] [INFO] [1676635823.158007906] [eca_a9.robot_state_publisher]: got segment eca_a9/dvl_sonar2_link [robot_state_publisher-2] [INFO] [1676635823.158013336] [eca_a9.robot_state_publisher]: got segment eca_a9/dvl_sonar3_link [robot_state_publisher-2] [INFO] [1676635823.158019428] [eca_a9.robot_state_publisher]: got segment eca_a9/fin0 [robot_state_publisher-2] [INFO] [1676635823.158025359] [eca_a9.robot_state_publisher]: got segment eca_a9/fin1 [robot_state_publisher-2] [INFO] [1676635823.158030709] [eca_a9.robot_state_publisher]: got segment eca_a9/fin2 [robot_state_publisher-2] [INFO] [1676635823.158035308] [eca_a9.robot_state_publisher]: got segment eca_a9/fin3 [robot_state_publisher-2] [INFO] [1676635823.158040708] [eca_a9.robot_state_publisher]: got segment eca_a9/gps_link [robot_state_publisher-2] [INFO] [1676635823.158046198] [eca_a9.robot_state_publisher]: got segment eca_a9/imu_link [robot_state_publisher-2] [INFO] [1676635823.158051678] [eca_a9.robot_state_publisher]: got segment eca_a9/pose_sensor_link_default [robot_state_publisher-2] [INFO] [1676635823.158057419] [eca_a9.robot_state_publisher]: got segment eca_a9/pressure_link [robot_state_publisher-2] [INFO] [1676635823.158062920] [eca_a9.robot_state_publisher]: got segment eca_a9/sonarleft_link [robot_state_publisher-2] [INFO] [1676635823.158068490] [eca_a9.robot_state_publisher]: got segment eca_a9/sonarright_link [robot_state_publisher-2] [INFO] [1676635823.158074161] [eca_a9.robot_state_publisher]: got segment eca_a9/thruster_0 [spawn_entity.py-1] [INFO] [1676635823.198087284] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.299921918] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.402145594] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.504263923] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.603517088] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.704734641] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.806152761] [eca_a9.urdf_spawner]: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1676635823.821186097] [eca_a9.urdf_spawner]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-1] [INFO] [1676635823.821512722] [eca_a9.urdf_spawner]: Waiting for service /spawn_entity [spawn_entity.py-1] [INFO] [1676635823.825562634] [eca_a9.urdf_spawner]: Calling service /spawn_entity [finned_uuv_teleop.py-4] [INFO] [1676635823.957493336] [eca_a9.finned_uuv_teleop]: FinnedUUVControllerNode: initializing node [rviz2-6] [INFO] [1676635824.307615459] [rviz2]: Stereo is NOT SUPPORTED [rviz2-6] [INFO] [1676635824.307686202] [rviz2]: OpenGl version: 4.3 (GLSL 4.3) [rviz2-6] [INFO] [1676635824.317527045] [rviz2]: Stereo is NOT SUPPORTED [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] [INFO] [1676635824.431045751] [rviz2]: Stereo is NOT SUPPORTED [spawn_entity.py-1] [INFO] [1676635824.435702135] [eca_a9.urdf_spawner]: Spawn status: SpawnEntity: Successfully spawned entity [eca_a9] [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [INFO] [spawn_entity.py-1]: process has finished cleanly [pid 1009650] [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [finned_uuv_teleop.py-4] [INFO] [1676635824.615084982] [eca_a9.finned_uuv_teleop]: Thruster #0 - proportional - thrusters/id_0/input [finned_uuv_teleop.py-4] [INFO] [1676635824.615507727] [eca_a9.finned_uuv_teleop]: Thruster model: [finned_uuv_teleop.py-4] [INFO] [1676635824.615786171] [eca_a9.finned_uuv_teleop]: Gain=4.9e-05 [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp [rviz2-6] Warning: Invalid frame ID "eca_a9/base_link" passed to canTransform argument source_frame - frame does not exist [rviz2-6] at line 93 in ./src/buffer_core.cpp
其rviz配置文件如下:
Panels: - Class: rviz_common/Displays Help Height: 78 Name: Displays Property Tree Widget: Expanded: - /Global Options1 - /Status1 - /RobotModel1 - /Sonar left1 - /Sonar right1 - /Waypoint path1 - /Fin 0 - Wrench1 - /Fin 1 - Wrench1 - /Fin 2 - Wrench1 - /Fin 3 - Wrench1 - /Thrust Wrench1 Splitter Ratio: 0.5 Tree Height: 486 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties Expanded: - /2D Pose Estimate1 - /2D Nav Goal1 - /Publish Point1 Name: Tool Properties Splitter Ratio: 0.588679016 - Class: rviz_common/Views Expanded: - /Current View1 Name: Views Splitter Ratio: 0.5 - Class: rviz_common/Time Experimental: false Name: Time SyncMode: 0 SyncSource: Sonar left Visualization Manager: Class: "" Displays: - Alpha: 0.5 Cell Size: 1 Class: rviz_default_plugins/Grid Color: 160; 160; 164 Enabled: true Line Style: Line Width: 0.0299999993 Value: Lines Name: Grid Normal Cell Count: 0 Offset: X: 0 Y: 0 Z: 0 Plane: XY Plane Cell Count: 10 Reference Frame: <Fixed Frame> Value: true - Alpha: 1 Class: rviz_default_plugins/RobotModel Collision Enabled: false Enabled: true Links: All Links Enabled: true Expand Joint Details: false Expand Link Details: false Expand Tree: false Link Tree Style: Links in Alphabetic Order eca_a9/base_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/battery_link: Alpha: 1 Show Axes: false Show Trail: false eca_a9/camera_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/camera_link_optical: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/cc_sensor_link: Alpha: 1 Show Axes: false Show Trail: false eca_a9/dvl_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/dvl_sonar0_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/dvl_sonar1_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/dvl_sonar2_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/dvl_sonar3_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/fin0: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/fin1: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/fin2: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/fin3: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/gps_link: Alpha: 1 Show Axes: false Show Trail: false eca_a9/imu_link: Alpha: 1 Show Axes: false Show Trail: false eca_a9/pose_sensor_link_default: Alpha: 1 Show Axes: false Show Trail: false eca_a9/pressure_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/sonarleft_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/sonarright_link: Alpha: 1 Show Axes: false Show Trail: false Value: true eca_a9/thruster_0: Alpha: 1 Show Axes: false Show Trail: false Value: true Name: RobotModel Robot Description: eca_a9/robot_description TF Prefix: "" Update Interval: 0 Value: true Visual Enabled: true - Class: rviz_default_plugins/TF Enabled: true Frame Timeout: 15 Frames: All Enabled: true eca_a9/base_footprint: Value: true eca_a9/base_link: Value: true eca_a9/base_link_ned: Value: true eca_a9/base_stabilized: Value: true eca_a9/battery_link: Value: true eca_a9/camera_link: Value: true eca_a9/camera_link_optical: Value: true eca_a9/cc_sensor_link: Value: true eca_a9/dvl_link: Value: true eca_a9/dvl_sonar0_link: Value: true eca_a9/dvl_sonar1_link: Value: true eca_a9/dvl_sonar2_link: Value: true eca_a9/dvl_sonar3_link: Value: true eca_a9/fin0: Value: true eca_a9/fin1: Value: true eca_a9/fin2: Value: true eca_a9/fin3: Value: true eca_a9/gps_link: Value: true eca_a9/imu_link: Value: true eca_a9/pose_sensor_link_default: Value: true eca_a9/pressure_link: Value: true eca_a9/sonarleft_link: Value: true eca_a9/sonarright_link: Value: true eca_a9/thruster_0: Value: true world: Value: true world_ned: Value: true Marker Scale: 1 Name: TF Show Arrows: true Show Axes: true Show Names: true Tree: world: eca_a9/base_footprint: eca_a9/base_stabilized: eca_a9/base_link: eca_a9/base_link_ned: {} eca_a9/battery_link: {} eca_a9/camera_link: eca_a9/camera_link_optical: {} eca_a9/cc_sensor_link: {} eca_a9/dvl_link: eca_a9/dvl_sonar0_link: {} eca_a9/dvl_sonar1_link: {} eca_a9/dvl_sonar2_link: {} eca_a9/dvl_sonar3_link: {} eca_a9/fin0: {} eca_a9/fin1: {} eca_a9/fin2: {} eca_a9/fin3: {} eca_a9/gps_link: {} eca_a9/imu_link: {} eca_a9/pose_sensor_link_default: {} eca_a9/pressure_link: {} eca_a9/sonarleft_link: {} eca_a9/sonarright_link: {} eca_a9/thruster_0: {} world_ned: {} Update Interval: 0 Value: true - Class: rviz_default_plugins/MarkerArray Enabled: true Marker Topic: /world_models Name: World models Namespaces: "": true Queue Size: 100 Value: true - Alpha: 1 Autocompute Intensity Bounds: true Autocompute Value Bounds: Max Value: -91.8094254 Min Value: -95.5871582 Value: true Axis: Z Channel Name: intensity Class: rviz_default_plugins/LaserScan Color: 255; 255; 255 Color Transformer: AxisColor Decay Time: 300 Enabled: true Invert Rainbow: false Max Color: 255; 255; 255 Max Intensity: 0 Min Color: 0; 0; 0 Min Intensity: 0 Name: Sonar left Position Transformer: XYZ Queue Size: 10 Selectable: true Size (Pixels): 3 Size (m): 0.00999999978 Style: Points Topic: /eca_a9/sss_left Unreliable: false Use Fixed Frame: true Use rainbow: true Value: true - Alpha: 1 Autocompute Intensity Bounds: true Autocompute Value Bounds: Max Value: -75.8892899 Min Value: -95.6470261 Value: true Axis: Z Channel Name: intensity Class: rviz_default_plugins/LaserScan Color: 255; 255; 255 Color Transformer: AxisColor Decay Time: 300 Enabled: true Invert Rainbow: false Max Color: 255; 255; 255 Max Intensity: 0 Min Color: 0; 0; 0 Min Intensity: 0 Name: Sonar right Position Transformer: XYZ Queue Size: 10 Selectable: true Size (Pixels): 3 Size (m): 0.00999999978 Style: Points Topic: /eca_a9/sss_right Unreliable: false Use Fixed Frame: true Use rainbow: true Value: true - Angle Tolerance: 0.100000001 Class: rviz_default_plugins/Odometry Covariance: Orientation: Alpha: 0.5 Color: 255; 255; 127 Color Style: Unique Frame: Local Offset: 1 Scale: 1 Value: true Position: Alpha: 0.300000012 Color: 204; 51; 204 Scale: 1 Value: true Value: true Enabled: true Keep: 100 Name: Odometry Position Tolerance: 0.100000001 Shape: Alpha: 1 Axes Length: 1 Axes Radius: 0.100000001 Color: 255; 25; 0 Head Length: 0.300000012 Head Radius: 0.100000001 Shaft Length: 1 Shaft Radius: 0.0500000007 Value: Arrow Topic: /eca_a9/pose_gt Unreliable: false Value: true - Alpha: 1 Buffer Length: 1 Class: rviz_default_plugins/Path Color: 255; 85; 255 Enabled: true Head Diameter: 0.300000012 Head Length: 0.200000003 Length: 0.300000012 Line Style: Lines Line Width: 0.0299999993 Name: Trajectory Offset: X: 0 Y: 0 Z: 0 Pose Color: 255; 85; 255 Pose Style: None Radius: 0.0299999993 Shaft Diameter: 0.100000001 Shaft Length: 0.100000001 Topic: /eca_a9/trajectory_marker Unreliable: false Value: true - Class: rviz_default_plugins/MarkerArray Enabled: true Marker Topic: /eca_a9/waypoint_markers Name: Waypoints Namespaces: "": true Queue Size: 100 Value: true - Alpha: 1 Buffer Length: 1 Class: rviz_default_plugins/Path Color: 255; 85; 0 Enabled: true Head Diameter: 0.300000012 Head Length: 0.200000003 Length: 0.300000012 Line Style: Lines Line Width: 0.0299999993 Name: Waypoint path Offset: X: 0 Y: 0 Z: 0 Pose Color: 255; 85; 255 Pose Style: None Radius: 0.0299999993 Shaft Diameter: 0.100000001 Shaft Length: 0.100000001 Topic: /eca_a9/waypoint_path_marker Unreliable: false Value: true - Alpha: 1 Arrow Width: 0.200000003 Class: rviz_default_plugins/Wrench Enabled: true Force Arrow Scale: 0.100000001 Force Color: 204; 51; 51 History Length: 1 Name: Fin 0 - Wrench Topic: /eca_a9/fins/0/wrench_topic Torque Arrow Scale: 2 Torque Color: 204; 204; 51 Unreliable: false Value: true - Alpha: 1 Arrow Width: 0.300000012 Class: rviz_default_plugins/Wrench Enabled: true Force Arrow Scale: 0.100000001 Force Color: 204; 51; 51 History Length: 1 Name: Fin 1 - Wrench Topic: /eca_a9/fins/1/wrench_topic Torque Arrow Scale: 2 Torque Color: 204; 204; 51 Unreliable: false Value: true - Alpha: 1 Arrow Width: 0.300000012 Class: rviz_default_plugins/Wrench Enabled: true Force Arrow Scale: 0.100000001 Force Color: 204; 51; 51 History Length: 1 Name: Fin 2 - Wrench Topic: /eca_a9/fins/2/wrench_topic Torque Arrow Scale: 2 Torque Color: 204; 204; 51 Unreliable: false Value: true - Alpha: 1 Arrow Width: 0.300000012 Class: rviz_default_plugins/Wrench Enabled: true Force Arrow Scale: 0.100000001 Force Color: 204; 51; 51 History Length: 1 Name: Fin 3 - Wrench Topic: /eca_a9/fins/3/wrench_topic Torque Arrow Scale: 2 Torque Color: 204; 204; 51 Unreliable: false Value: true - Alpha: 1 Arrow Width: 0.300000012 Class: rviz_default_plugins/Wrench Enabled: true Force Arrow Scale: 0.100000001 Force Color: 53; 98; 204 History Length: 1 Name: Thrust Wrench Topic: /eca_a9/thrusters/0/thrust_wrench Torque Arrow Scale: 2 Torque Color: 204; 204; 51 Unreliable: false Value: true - Class: rviz_default_plugins/Image Enabled: true Image Topic: /eca_a9/camera/camera_image Max Value: 1 Median window: 5 Min Value: 0 Name: Image Normalize Range: true Queue Size: 2 Transport Hint: raw Unreliable: false Value: true - Class: rviz_default_plugins/Marker Enabled: true Marker Topic: /eca_a9/reference_marker Name: Reference Marker Namespaces: "": true Queue Size: 100 Value: true - Class: rviz_default_plugins/MarkerArray Enabled: true Marker Topic: /eca_a9/interpolator_visual_markers Name: MarkerArray Namespaces: dubins: true Queue Size: 100 Value: true Enabled: true Global Options: Background Color: 48; 48; 48 Fixed Frame: world Frame Rate: 30 Name: root Tools: - Class: rviz_default_plugins/Interact Hide Inactive Objects: true - Class: rviz_default_plugins/MoveCamera - Class: rviz_default_plugins/Select - Class: rviz_default_plugins/FocusCamera - Class: rviz_default_plugins/Measure - Class: rviz_default_plugins/SetInitialPose Topic: /initialpose - Class: rviz_default_plugins/SetGoal Topic: /goal_pose #Topic: /move_base_simple/goal - Class: rviz_default_plugins/PublishPoint Single click: true Topic: /clicked_point Value: true Views: Current: Class: rviz_default_plugins/Orbit Distance: 303.795349 Enable Stereo Rendering: Stereo Eye Separation: 0.0599999987 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false Focal Point: X: 0 Y: 0 Z: 0 Focal Shape Fixed Size: true Focal Shape Size: 0.0500000007 Invert Z Axis: false Name: Current View Near Clip Distance: 0.00999999978 Pitch: 0.525398612 Target Frame: eca_a9/base_link Value: Orbit (rviz) Yaw: 2.36903524 Saved: ~ Window Geometry: Displays: collapsed: false Height: 1176 Hide Left Dock: false Hide Right Dock: false Image: collapsed: false QMainWindow State: 000000ff00000000fd00000004000000000000020f0000040efc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005e00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002800000274000000d000fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d00610067006501000002a2000001940000001600ffffff000000010000010f0000040efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a0056006900650077007301000000280000040e000000a900fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007800000003efc0100000002fb0000000800540069006d00650100000000000007800000030000fffffffb0000000800540069006d00650100000000000004500000000000000000000004560000040e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Time: collapsed: false Tool Properties: collapsed: false Views: collapsed: false Width: 1920 X: 1920 Y: 24
请问这是怎么回事呢?
-
launch运行报错
系统ubuntu22.04 ros2 humble
我的launch文件如下:<launch> <!-- Vehicle's initial position --> <arg name="debug" default="0"/> <arg name="x" default="0"/> <arg name="y" default="0"/> <arg name="z" default="-5"/> <arg name="roll" default="0.0"/> <arg name="pitch" default="0.0"/> <arg name="yaw" default="0.0"/> <arg name="use_sim_time" default="true"/> <arg name="use_geodetic" default="false"/> <arg name="latitude" default="0"/> <arg name="longitude" default="0"/> <arg name="depth" default="0"/> <arg name="mode" default="default"/> <arg name="namespace" default="eca_a9"/> <arg name="latitude_ref" default="0"/> <arg name="longitude_ref" default="0"/> <arg name="altitude_ref" default="0"/> <arg name="record" default="false"/> <arg name="bag_filename" default="recording.bag"/> <arg name="use_ned_frame" default="true"/> <arg name="uuv_name" default="eca_a9"/> <arg name="joy_id" default="0"/> <include file="$(find-pkg-share eca_a9_description)/launch/upload_eca_a9.launch"> <arg name="debug" value="$(var debug)"/> <arg name="x" value="$(var x)"/> <arg name="y" value="$(var y)"/> <arg name="z" value="$(var z)"/> <arg name="roll" value="$(var roll)"/> <arg name="pitch" value="$(var pitch)"/> <arg name="yaw" value="$(var yaw)"/> <arg name="use_ned_frame" value="$(var use_ned_frame)"/> <arg name="namespace" value="$(var namespace)"/> </include> <include file="$(find-pkg-share eca_a9_control)/launch/start_auv_teleop.launch"> <arg name="uuv_name" value="$(var uuv_name)"/> <arg name="joy_id" value="$(var joy_id)"/> </include> <!-- Initialize the recording fo the simulation according to the record flag --> <include file="$(find-pkg-share eca_a9_gazebo)/launch/record_demo.launch"> <arg name="record" value="$(var record)"/> <arg name="use_ned_frame" value="$(var use_ned_frame)"/> <arg name="bag_filename" value="$(var bag_filename)"/> </include> </launch>
终端报错:
[INFO] [launch]: All log files can be found below /home/user2/.ros/log/2023-02-16-18-17-19-117051-user2-544257 [INFO] [launch]: Default logging verbosity is set to INFO redefining global symbol: range when instantiating macro: pressure_plugin_macro (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/pressure_snippets.xacro) instantiated from: default_pressure (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/pressure_snippets.xacro) instantiated from: eca_a9_base (/home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_base.xacro) in file: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_sensors.xacro included from: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/robots/eca_a9_default.urdf.xacro redefining global symbol: gamma when instantiating macro: chemical_concentration_sensor_macro (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/chemical_concentration_snippets.xacro) instantiated from: default_chemical_concentration_sensor (/home/user2/auv_ws/install/uuv_sensor_ros_plugins/share/uuv_sensor_ros_plugins/urdf/chemical_concentration_snippets.xacro) instantiated from: eca_a9_base (/home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_base.xacro) in file: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/urdf/eca_a9_sensors.xacro included from: /home/user2/auv_ws/install/eca_a9_description/share/eca_a9_description/robots/eca_a9_default.urdf.xacro [ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [launch]: Error trying to process rule "substitution": Unknown substitution: arg
其中有问题的一个文件,其程序是这样的
// Copyright (c) 2020 The Plankton Authors. // All rights reserved. // // This source code is derived from UUV Simulator // (https://github.com/uuvsimulator/uuv_simulator) // Copyright (c) 2016-2019 The UUV Simulator Authors // licensed under the Apache 2 license // cf. 3rd-party-licenses.txt file in the root directory of this source tree. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include <uuv_sensor_ros_plugins/SubseaPressureROSPlugin.h> namespace gazebo { //double range = 3000; ///////////////////////////////////////////////// SubseaPressureROSPlugin::SubseaPressureROSPlugin() : ROSBaseModelPlugin() { } ///////////////////////////////////////////////// SubseaPressureROSPlugin::~SubseaPressureROSPlugin() { } ///////////////////////////////////////////////// void SubseaPressureROSPlugin::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) { ROSBaseModelPlugin::Load(_model, _sdf); //GetSDFParam<double>(_sdf, "saturation", this->saturation, 3000); GetSDFParam<double>(_sdf, "saturation", this->range, 3000); GetSDFParam<bool>(_sdf, "estimate_depth_on", this->estimateDepth, false); GetSDFParam<double>(_sdf, "standard_pressure", this->standardPressure, 101.325); GetSDFParam<double>(_sdf, "kPa_per_meter", this->kPaPerM, 9.80638); this->rosSensorOutputPub = myRosNode->create_publisher<sensor_msgs::msg::FluidPressure>( this->sensorOutputTopic, 1); if (this->gazeboMsgEnabled) { this->gazeboSensorOutputPub = this->gazeboNode->Advertise<sensor_msgs::msgs::Pressure>( myRobotNamespace + "/" + this->sensorOutputTopic, 1); } } ///////////////////////////////////////////////// bool SubseaPressureROSPlugin::OnUpdate(const common::UpdateInfo& _info) { // Publish sensor state this->PublishState(); if (!this->EnableMeasurement(_info)) return false; // Using the world pose wrt Gazebo's ENU reference frame ignition::math::Vector3d pos; #if GAZEBO_MAJOR_VERSION >= 8 pos = this->link->WorldPose().Pos(); #else pos = this->link->GetWorldPose().Ign().Pos(); #endif double depth = std::abs(pos.Z()); double pressure = this->standardPressure; if (depth >= 0) { // Convert depth to pressure pressure += depth * this->kPaPerM; } pressure += this->GetGaussianNoise(this->noiseAmp); double inferredDepth = 0.0; // Estimate depth, if enabled if (this->estimateDepth) { inferredDepth = (pressure - this->standardPressure) / this->kPaPerM; } // Publish Gazebo pressure message, if enabled if (this->gazeboMsgEnabled) { sensor_msgs::msgs::Pressure gazeboMsg; gazeboMsg.set_pressure(pressure); gazeboMsg.set_stddev(this->noiseSigma); if (this->estimateDepth) gazeboMsg.set_depth(inferredDepth); this->gazeboSensorOutputPub->Publish(gazeboMsg); } // Publish ROS pressure message sensor_msgs::msg::FluidPressure rosMsg; rosMsg.header.stamp.sec = _info.simTime.sec; rosMsg.header.stamp.nanosec = _info.simTime.nsec; rosMsg.header.frame_id = this->link->GetName(); rosMsg.fluid_pressure = pressure; rosMsg.variance = this->noiseSigma * this->noiseSigma; this->rosSensorOutputPub->publish(rosMsg); // Read the current simulation time #if GAZEBO_MAJOR_VERSION >= 8 this->lastMeasurementTime = this->world->SimTime(); #else this->lastMeasurementTime = this->world->GetSimTime(); #endif return true; } ///////////////////////////////////////////////// GZ_REGISTER_MODEL_PLUGIN(SubseaPressureROSPlugin) }
那个参数在其函数文件定义的是protected类型的,各位大佬,请问这是什么情况呢?怎么解决呢