鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    launch运行报错

    已定时 已固定 已锁定 已移动
    ROS 2相关问题
    launch ros2 humble
    1
    1
    360
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • yudonghou123Y
      小猴同学
      最后由 编辑

      系统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类型的,各位大佬,请问这是什么情况呢?怎么解决呢

      芜湖

      1 条回复 最后回复 回复 引用 0
      • 第一个帖子
        最后一个帖子
      皖ICP备16016415号-7
      Powered by NodeBB | 鱼香ROS