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

    Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?

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

      Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
      系统:ubuntu22.04
      环境:ROS2 humble

      各位大佬,我在编译水下uuv_simulator时,通过以下命令在编译时,终端输出以下问题:
      命令:

      ros2 launch uuv_gazebo_worlds ocean_waves.launch
      
      stdbuf -o L ros2 launch uuv_descriptions upload_rexrov.launch mode:=default x:=0 y:=0 z:=-20 namespace:=rexrov
      

      终端输出为:

      [robot_state_publisher-2] The root link rexrov/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] Link rexrov/camera_link had 1 children
      [robot_state_publisher-2] Link rexrov/camera_link_optical had 0 children
      [robot_state_publisher-2] Link rexrov/cameraleft_link had 1 children
      [robot_state_publisher-2] Link rexrov/cameraleft_link_optical had 0 children
      [robot_state_publisher-2] Link rexrov/cameraright_link had 1 children
      [robot_state_publisher-2] Link rexrov/cameraright_link_optical had 0 children
      [robot_state_publisher-2] Link rexrov/dvl_link had 4 children
      [robot_state_publisher-2] Link rexrov/dvl_sonar0_link had 0 children
      [robot_state_publisher-2] Link rexrov/dvl_sonar1_link had 0 children
      [robot_state_publisher-2] Link rexrov/dvl_sonar2_link had 0 children
      [robot_state_publisher-2] Link rexrov/dvl_sonar3_link had 0 children
      [robot_state_publisher-2] Link rexrov/gps_link had 0 children
      [robot_state_publisher-2] Link rexrov/imu_link had 0 children
      [robot_state_publisher-2] Link rexrov/magnetometer_link had 0 children
      [robot_state_publisher-2] Link rexrov/pose_sensor_link_default had 0 children
      [robot_state_publisher-2] Link rexrov/pressure_link had 0 children
      [robot_state_publisher-2] Link rexrov/rpt_link had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_0 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_1 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_2 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_3 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_4 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_5 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_6 had 0 children
      [robot_state_publisher-2] Link rexrov/thruster_7 had 0 children
      [robot_state_publisher-2] [INFO] [1671183564.854296566] [rexrov.robot_state_publisher]: got segment rexrov/base_link
      [robot_state_publisher-2] [INFO] [1671183564.854380926] [rexrov.robot_state_publisher]: got segment rexrov/camera_link
      [robot_state_publisher-2] [INFO] [1671183564.854387459] [rexrov.robot_state_publisher]: got segment rexrov/camera_link_optical
      [robot_state_publisher-2] [INFO] [1671183564.854391847] [rexrov.robot_state_publisher]: got segment rexrov/cameraleft_link
      [robot_state_publisher-2] [INFO] [1671183564.854396095] [rexrov.robot_state_publisher]: got segment rexrov/cameraleft_link_optical
      [robot_state_publisher-2] [INFO] [1671183564.854400133] [rexrov.robot_state_publisher]: got segment rexrov/cameraright_link
      [robot_state_publisher-2] [INFO] [1671183564.854404030] [rexrov.robot_state_publisher]: got segment rexrov/cameraright_link_optical
      [robot_state_publisher-2] [INFO] [1671183564.854408018] [rexrov.robot_state_publisher]: got segment rexrov/dvl_link
      [robot_state_publisher-2] [INFO] [1671183564.854411885] [rexrov.robot_state_publisher]: got segment rexrov/dvl_sonar0_link
      [robot_state_publisher-2] [INFO] [1671183564.854415652] [rexrov.robot_state_publisher]: got segment rexrov/dvl_sonar1_link
      [robot_state_publisher-2] [INFO] [1671183564.854419509] [rexrov.robot_state_publisher]: got segment rexrov/dvl_sonar2_link
      [robot_state_publisher-2] [INFO] [1671183564.854423307] [rexrov.robot_state_publisher]: got segment rexrov/dvl_sonar3_link
      [robot_state_publisher-2] [INFO] [1671183564.854427014] [rexrov.robot_state_publisher]: got segment rexrov/gps_link
      [robot_state_publisher-2] [INFO] [1671183564.854430751] [rexrov.robot_state_publisher]: got segment rexrov/imu_link
      [robot_state_publisher-2] [INFO] [1671183564.854434548] [rexrov.robot_state_publisher]: got segment rexrov/magnetometer_link
      [robot_state_publisher-2] [INFO] [1671183564.854438405] [rexrov.robot_state_publisher]: got segment rexrov/pose_sensor_link_default
      [robot_state_publisher-2] [INFO] [1671183564.854442333] [rexrov.robot_state_publisher]: got segment rexrov/pressure_link
      [robot_state_publisher-2] [INFO] [1671183564.854446200] [rexrov.robot_state_publisher]: got segment rexrov/rpt_link
      [robot_state_publisher-2] [INFO] [1671183564.854449997] [rexrov.robot_state_publisher]: got segment rexrov/thruster_0
      [robot_state_publisher-2] [INFO] [1671183564.854453895] [rexrov.robot_state_publisher]: got segment rexrov/thruster_1
      [robot_state_publisher-2] [INFO] [1671183564.854457722] [rexrov.robot_state_publisher]: got segment rexrov/thruster_2
      [robot_state_publisher-2] [INFO] [1671183564.854461309] [rexrov.robot_state_publisher]: got segment rexrov/thruster_3
      [robot_state_publisher-2] [INFO] [1671183564.854464916] [rexrov.robot_state_publisher]: got segment rexrov/thruster_4
      [robot_state_publisher-2] [INFO] [1671183564.854468462] [rexrov.robot_state_publisher]: got segment rexrov/thruster_5
      [robot_state_publisher-2] [INFO] [1671183564.854472049] [rexrov.robot_state_publisher]: got segment rexrov/thruster_6
      [robot_state_publisher-2] [INFO] [1671183564.854475596] [rexrov.robot_state_publisher]: got segment rexrov/thruster_7
      [spawn_entity.py-1] [INFO] [1671183565.108923004] [rexrov.urdf_spawner]: Spawn Entity started
      [spawn_entity.py-1] [INFO] [1671183565.109161777] [rexrov.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(
      [spawn_entity.py-1] [INFO] [1671183565.110378944] [rexrov.urdf_spawner]: Waiting for entity xml on robot_description
      [spawn_entity.py-1] [INFO] [1671183565.121690581] [rexrov.urdf_spawner]: Waiting for service /gazebo/spawn_entity, timeout = 30
      [spawn_entity.py-1] [INFO] [1671183565.121910678] [rexrov.urdf_spawner]: Waiting for service /gazebo/spawn_entity
      [spawn_entity.py-1] [ERROR] [1671183595.162424674] [rexrov.urdf_spawner]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
      [spawn_entity.py-1] [ERROR] [1671183595.162913651] [rexrov.urdf_spawner]: Spawn service failed. Exiting.
      [ERROR] [spawn_entity.py-1]: process has died [pid 214939, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -gazebo_namespace /gazebo -x 0 -y 0 -z -20 -R 0.0 -P 0.0 -Y 0.0 -entity rexrov -topic robot_description --ros-args -r __node:=urdf_spawner -r __ns:=/rexrov --params-file /tmp/launch_params_kxf829fv'].
      ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
      [robot_state_publisher-2] [INFO] [1671183610.385946899] [rclcpp]: signal_handler(signum=2)
      [uuv_message_to_tf-3] [INFO] [1671183610.385935668] [rclcpp]: signal_handler(signum=2)
      

      感觉其中的主要问题为以下:

      [spawn_entity.py-1] [ERROR] [1671183595.162424674] [rexrov.urdf_spawner]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
      [spawn_entity.py-1] [ERROR] [1671183595.162913651] [rexrov.urdf_spawner]: Spawn service failed. Exiting.
      [ERROR] [spawn_entity.py-1]: process has died [pid 214939, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -gazebo_namespace /gazebo -x 0 -y 0 -z -20 -R 0.0 -P 0.0 -Y 0.0 -entity rexrov -topic robot_description --ros-args -r __node:=urdf_spawner -r __ns:=/rexrov --params-file /tmp/launch_params_kxf829fv'].
      

      最终的问题呈现是gazebo的环境能够显示,但是机器人或者说是UUV无法在显示的gazebo环境中显示,上网查阅资料发现,有的人在运行turtlebot3时也出现类似的问题,他们的解决方案是在.~/bashrc文件中添加机器人的gazebo模型,但是我按照其思路进行修改,添加以下命令:

       export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/home/user2/auv_ws/src/Plankton-master/models
      
      

      不起作用,所以不知道如何进行修改才好,有大佬遇到相同问题的吗?有的话请帮助我,先提前感激您😋

      芜湖

      小鱼小 1 条回复 最后回复 回复 引用 0
      • yudonghou123Y yudonghou123 将这个主题转为问答主题,在
      • 小鱼小
        小鱼 技术大佬 @yudonghou123
        最后由 编辑

        @yudonghou123 看一下gazebo启动指令,应该要有gazebo-ros-factory

        新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

        yudonghou123Y 2 条回复 最后回复 回复 引用 0
        • yudonghou123Y
          小猴同学 @小鱼
          最后由 编辑

          @小鱼 在 Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? 中说:

          @yudonghou123 看一下gazebo启动指令,应该要有gazebo-ros-factory

          您好,非常感谢您的回复,鱼总,这个gazebo启动指令不是只要在launch文件中有以下节点描述就可以是吗:

          <node name="urdf_spawner" pkg="gazebo_ros" exec="spawn_entity.py" respawn="false" output="screen"
                    args="-gazebo_namespace /gazebo -x $(var x) -y $(var y) -z $(var z) -R $(var roll) -P $(var pitch) -Y $(var yaw) -entity $(var namespace) -file $(var generated_urdf)"/>
          

          或者您能说的详细一点吗,还是gazebo有时候会出现不识别urdf文件类型的问题,它启动的launch文件如下:

          <launch>
            <arg name="debug" default="0"/>
          
            <arg name="x" default="0"/>
            <arg name="y" default="0"/>
            <arg name="z" default="-20"/>
            <arg name="roll" default="0.0"/>
            <arg name="pitch" default="0.0"/>
            <arg name="yaw" default="0.0"/>
          
            <arg name="mode" default="default"/>
            <arg name="namespace" default="rexrov"/>
            <arg name="use_ned_frame" default="false"/>
            <arg name="generated_urdf" default="$(find-pkg-share uuv_descriptions)/robots/generated/$(var namespace)/robot_description"/>
            <arg name="cmd" default= "$(exec-in-pkg xacro xacro) '$(find-pkg-share uuv_descriptions)/robots/rexrov_$(var mode).xacro' 
                    > $(find-pkg-share uuv_descriptions)/robots/generated/$(var namespace)/robot_description
                    --inorder
                    debug:=$(var debug)
                    namespace:=$(var namespace)
                    inertial_reference_frame:=world_ned"/>
            <arg name="cmdUnless" default="xacro '$(find-pkg-share uuv_descriptions)/robots/rexrov_$(var mode).xacro' 
                    > $(find-pkg-share uuv_descriptions)/robots/generated/$(var namespace)/robot_description
                    debug:=$(var debug)
                    namespace:=$(var namespace)
                    inertial_reference_frame:=world"/>
            
            <arg name="use_sim_time" default="true"/>
            
          
            <group>
              <push-ros-namespace namespace="$(var namespace)"/>
              <group if="$(var use_ned_frame)">
                <executable 
                    cmd="$(var cmd)"
                    name="robot_description" 
                    output="screen" 
                    shell="true">
                </executable>
              </group>
          
              <group unless="$(var use_ned_frame)">
                <executable 
                    cmd="$(var cmdUnless)" 
                    cwd="$(find-pkg-prefix xacro)"
                    name="robot_description" 
                    output="screen" 
                    shell="true">
                </executable>
              </group>
          
              <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
             <!--  <node name="urdf_spawner" pkg="uuv_descriptions" exec="spawn_model" respawn="false" output="screen"
                    args="-urdf -x $(var x) -y $(var y) -z $(var z) -R $(var roll) -P $(var pitch) -Y $(var yaw) -model $(var namespace) -file /home/user2/auv_ws/install/uuv_descriptions/share/uuv_descriptions/robots/generated/rexrov/robot_description"/> -->
              
              <node name="urdf_spawner" pkg="gazebo_ros" exec="spawn_entity.py" respawn="false" output="screen"
                    args="-gazebo_namespace /gazebo -x $(var x) -y $(var y) -z $(var z) -R $(var roll) -P $(var pitch) -Y $(var yaw) -entity $(var namespace) -file $(var generated_urdf)"/>
          
              <!-- A joint state publisher plugin already is started with the model, no need to use the default joint state publisher -->
          
              <!-- Publish robot model for ROS -->
              <node name="robot_state_publisher" pkg="robot_state_publisher" exec="robot_state_publisher" respawn="true" output="screen"
                args="$(var generated_urdf)">
                <param name="use_sim_time" value="$(var use_sim_time)"/>
                <!-- <param name="robot_description" value="/$(var namespace)/robot_description" />
                <param name="publish_frequency" value="5" /> -->
              </node>
            </group>
          
            <include file="$(find-pkg-share uuv_assistants)/launch/message_to_tf.launch">
              <arg name="namespace" value="$(var namespace)"/>
              <arg name="world_frame" value="world"/>
              <arg name="child_frame_id" value="/$(var namespace)/base_link"/>
            </include>
          
          </launch>
          

          芜湖

          1 条回复 最后回复 回复 引用 0
          • 25007186052
            将就
            最后由 编辑

            侯总您好,您在下载完开源码之后是怎么操作的呢?我colcon build之后终端输出报错如下:

            hao@hao-virtual-machine:~/ros2_ws$  colcon build --packages-up-to plankton
            Starting >>> plankton_utils
            Starting >>> uuv_gazebo_ros_plugins_msgs
            Starting >>> uuv_gazebo_plugins
            Starting >>> uuv_control_msgs
            Finished <<< plankton_utils [16.5s]                                        
            Starting >>> uuv_assistants            
            [Processing: uuv_assistants, uuv_control_msgs, uuv_gazebo_plugins, uuv_gazebo_ros_plugins_msgs]
            --- stderr: uuv_assistants                 
            In file included from /home/hao/ros2_ws/src/Plankton/uuv_assistants/src/message_to_tf.cpp:41:
            /opt/ros/humble/include/tf2_geometry_msgs/tf2_geometry_msgs/tf2_geometry_msgs.h:35:2: warning: #warning This header is obsolete, please include tf2_geometry_msgs/tf2_geometry_msgs.hpp instead [-Wcpp]
               35 | #warning This header is obsolete, please include tf2_geometry_msgs/tf2_geometry_msgs.hpp instead
                  |  ^~~~~~~
            /home/hao/ros2_ws/src/Plankton/uuv_assistants/src/message_to_tf.cpp:78:22: error: redefinition of ‘void tf2::fromMsg(const Point&, tf2::Vector3&)’
               78 |   static inline void fromMsg(const geometry_msgs::msg::Point& msgIn, tf2::Vector3& out)
                  |                      ^~~~~~~
            In file included from /opt/ros/humble/include/tf2_geometry_msgs/tf2_geometry_msgs/tf2_geometry_msgs.h:37,
                             from /home/hao/ros2_ws/src/Plankton/uuv_assistants/src/message_to_tf.cpp:41:
            /opt/ros/humble/include/tf2_geometry_msgs/tf2_geometry_msgs/tf2_geometry_msgs.hpp:241:6: note: ‘void tf2::fromMsg(const Point&, tf2::Vector3&)’ previously defined here
              241 | void fromMsg(const geometry_msgs::msg::Point & in, tf2::Vector3 & out)
                  |      ^~~~~~~
            gmake[2]: *** [CMakeFiles/uuv_message_to_tf.dir/build.make:76: CMakeFiles/uuv_message_to_tf.dir/src/message_to_tf.cpp.o] Error 1
            gmake[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/uuv_message_to_tf.dir/all] Error 2
            gmake: *** [Makefile:146: all] Error 2
            ---
            Failed   <<< uuv_assistants [45.3s, exited with code 2]
            Aborted  <<< uuv_gazebo_ros_plugins_msgs [1min 9s]    
            Aborted  <<< uuv_control_msgs [1min 48s]               
            Aborted  <<< uuv_gazebo_plugins [2min 22s] 
            
            Summary: 1 package finished [2min 22s]
              1 package failed: uuv_assistants
              3 packages aborted: uuv_control_msgs uuv_gazebo_plugins uuv_gazebo_ros_plugins_msgs
              2 packages had stderr output: uuv_assistants uuv_gazebo_plugins
              17 packages not processed
            
            

            不知道您是否有遇到或者正好懂得如何解决,感激不尽!

            yudonghou123Y 1 条回复 最后回复 回复 引用 0
            • yudonghou123Y
              小猴同学 @2500718605
              最后由 编辑

              @2500718605 在 Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? 中说:

              侯总您好,您在下载完开源码之后是怎么操作的呢?我colcon build之后终端输出报错如下:

              hao@hao-virtual-machine:~/ros2_ws$  colcon build --packages-up-to plankton
              Starting >>> plankton_utils
              Starting >>> uuv_gazebo_ros_plugins_msgs
              Starting >>> uuv_gazebo_plugins
              Starting >>> uuv_control_msgs
              Finished <<< plankton_utils [16.5s]                                        
              Starting >>> uuv_assistants            
              [Processing: uuv_assistants, uuv_control_msgs, uuv_gazebo_plugins, uuv_gazebo_ros_plugins_msgs]
              --- stderr: uuv_assistants                 
              In file included from /home/hao/ros2_ws/src/Plankton/uuv_assistants/src/message_to_tf.cpp:41:
              /opt/ros/humble/include/tf2_geometry_msgs/tf2_geometry_msgs/tf2_geometry_msgs.h:35:2: warning: #warning This header is obsolete, please include tf2_geometry_msgs/tf2_geometry_msgs.hpp instead [-Wcpp]
                 35 | #warning This header is obsolete, please include tf2_geometry_msgs/tf2_geometry_msgs.hpp instead
                    |  ^~~~~~~
              /home/hao/ros2_ws/src/Plankton/uuv_assistants/src/message_to_tf.cpp:78:22: error: redefinition of ‘void tf2::fromMsg(const Point&, tf2::Vector3&)’
                 78 |   static inline void fromMsg(const geometry_msgs::msg::Point& msgIn, tf2::Vector3& out)
                    |                      ^~~~~~~
              In file included from /opt/ros/humble/include/tf2_geometry_msgs/tf2_geometry_msgs/tf2_geometry_msgs.h:37,
                               from /home/hao/ros2_ws/src/Plankton/uuv_assistants/src/message_to_tf.cpp:41:
              /opt/ros/humble/include/tf2_geometry_msgs/tf2_geometry_msgs/tf2_geometry_msgs.hpp:241:6: note: ‘void tf2::fromMsg(const Point&, tf2::Vector3&)’ previously defined here
                241 | void fromMsg(const geometry_msgs::msg::Point & in, tf2::Vector3 & out)
                    |      ^~~~~~~
              gmake[2]: *** [CMakeFiles/uuv_message_to_tf.dir/build.make:76: CMakeFiles/uuv_message_to_tf.dir/src/message_to_tf.cpp.o] Error 1
              gmake[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/uuv_message_to_tf.dir/all] Error 2
              gmake: *** [Makefile:146: all] Error 2
              ---
              Failed   <<< uuv_assistants [45.3s, exited with code 2]
              Aborted  <<< uuv_gazebo_ros_plugins_msgs [1min 9s]    
              Aborted  <<< uuv_control_msgs [1min 48s]               
              Aborted  <<< uuv_gazebo_plugins [2min 22s] 
              
              Summary: 1 package finished [2min 22s]
                1 package failed: uuv_assistants
                3 packages aborted: uuv_control_msgs uuv_gazebo_plugins uuv_gazebo_ros_plugins_msgs
                2 packages had stderr output: uuv_assistants uuv_gazebo_plugins
                17 packages not processed
              
              

              不知道您是否有遇到或者正好懂得如何解决,感激不尽!

              哦哦,你这个问题是重复定义,就是两个拥有相同变量的函数定义了两次,你把其中一个注释掉应该就OK

              芜湖

              25007186052 1 条回复 最后回复 回复 引用 0
              • 25007186052
                将就 @yudonghou123
                最后由 编辑

                @yudonghou123 侯总我爱你!!!
                不过我又遇到了下面的问题😖

                Starting >>> plankton_utils
                Starting >>> uuv_gazebo_ros_plugins_msgs
                Starting >>> uuv_gazebo_plugins
                Starting >>> uuv_control_msgs
                Finished <<< uuv_gazebo_plugins [1.73s]                                 
                Starting >>> uuv_sensor_ros_plugins_msgs
                Finished <<< uuv_gazebo_ros_plugins_msgs [3.93s]                        
                Starting >>> uuv_world_ros_plugins_msgs
                Finished <<< uuv_sensor_ros_plugins_msgs [2.76s]                        
                Starting >>> uuv_world_plugins
                Finished <<< uuv_world_plugins [0.49s]                                   
                Starting >>> uuv_gazebo_ros_plugins                                      
                Finished <<< plankton_utils [5.77s]                                      
                Starting >>> uuv_assistants
                Finished <<< uuv_control_msgs [7.19s]                                   
                Starting >>> uuv_sensor_ros_plugins
                Finished <<< uuv_world_ros_plugins_msgs [4.63s]                                   
                Starting >>> uuv_gazebo
                Finished <<< uuv_gazebo [0.48s]                                                
                Starting >>> uuv_gazebo_worlds
                Finished <<< uuv_gazebo_worlds [0.65s]                                         
                Starting >>> uuv_auv_control_allocator
                Finished <<< uuv_auv_control_allocator [4.49s]                                  
                Starting >>> uuv_control_cascaded_pid
                Finished <<< uuv_control_cascaded_pid [1.80s]                                     
                Starting >>> uuv_world_ros_plugins                                                
                --- stderr: uuv_gazebo_ros_plugins                                                
                In file included from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/gazebo_ros/node.hpp:144:19: error: ‘Executor’ was not declared in this scope; did you mean ‘rclcpp::Executor’?
                  144 |   std::shared_ptr<Executor> executor_;
                      |                   ^~~~~~~~
                      |                   rclcpp::Executor
                In file included 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 /opt/ros/humble/include/gazebo_ros/node.hpp:18,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:65:7: note: ‘rclcpp::Executor’ declared here
                   65 | class Executor
                      |       ^~~~~~~~
                In file included from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/gazebo_ros/node.hpp:144:27: error: template argument 1 is invalid
                  144 |   std::shared_ptr<Executor> executor_;
                      |                           ^
                /opt/ros/humble/include/gazebo_ros/node.hpp:156:24: error: ‘Executor’ was not declared in this scope; did you mean ‘rclcpp::Executor’?
                  156 |   static std::weak_ptr<Executor> static_executor_;
                      |                        ^~~~~~~~
                      |                        rclcpp::Executor
                In file included 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 /opt/ros/humble/include/gazebo_ros/node.hpp:18,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:65:7: note: ‘rclcpp::Executor’ declared here
                   65 | class Executor
                      |       ^~~~~~~~
                In file included from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/gazebo_ros/node.hpp:156:32: error: template argument 1 is invalid
                  156 |   static std::weak_ptr<Executor> static_executor_;
                      |                                ^
                /opt/ros/humble/include/gazebo_ros/node.hpp: In static member function ‘static gazebo_ros::Node::SharedPtr gazebo_ros::Node::CreateWithArgs(Args&& ...)’:
                /opt/ros/humble/include/gazebo_ros/node.hpp:182:38: error: request for member ‘lock’ in ‘gazebo_ros::Node::static_executor_’, which is of non-class type ‘int’
                  182 |   node->executor_ = static_executor_.lock();
                      |                                      ^~~~
                /opt/ros/humble/include/gazebo_ros/node.hpp:186:40: error: ‘Executor’ was not declared in this scope; did you mean ‘rclcpp::Executor’?
                  186 |     node->executor_ = std::make_shared<Executor>();
                      |                                        ^~~~~~~~
                      |                                        rclcpp::Executor
                In file included 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 /opt/ros/humble/include/gazebo_ros/node.hpp:18,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:65:7: note: ‘rclcpp::Executor’ declared here
                   65 | class Executor
                      |       ^~~~~~~~
                In file included from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/gazebo_ros/node.hpp:225:18: error: base operand of ‘->’ is not a pointer
                  225 |   node->executor_->add_node(node);
                      |                  ^~
                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:23,
                                 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 /opt/ros/humble/include/gazebo_ros/node.hpp:18,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp: In member function ‘virtual void uuv_simulator_ros::FinROSPlugin::Load(gazebo::physics::ModelPtr, sdf::v9::ElementPtr)’:
                /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:122:69: error: cannot convert ‘std::__cxx11::basic_string<char>’ to ‘const char*’
                  122 | CLCPP_INFO(myRosNode->get_logger(), "[FinROSPlugin] Namespace: " + std::string(myRosNode->get_namespace()));
                      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      |                                                                  |
                      |                                                                  std::__cxx11::basic_string<char>
                
                In file included from /opt/ros/humble/include/rmw/rmw/types.h:28,
                                 from /opt/ros/humble/include/rcl/rcl/types.h:20,
                                 from /opt/ros/humble/include/rcl/rcl/log_level.h:22,
                                 from /opt/ros/humble/include/rcl/rcl/arguments.h:21,
                                 from /opt/ros/humble/include/rcl/rcl/context.h:28,
                                 from /opt/ros/humble/include/rcl/rcl/guard_condition.h:26,
                                 from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:30,
                                 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 /opt/ros/humble/include/gazebo_ros/node.hpp:18,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/include/uuv_gazebo_ros_plugins/FinROSPlugin.h:31,
                                 from /home/hao/Plankton-master/uuv_gazebo_plugins/uuv_gazebo_ros_plugins/src/FinROSPlugin.cpp:22:
                /opt/ros/humble/include/rcutils/rcutils/logging.h:479:16: note:   initializing argument 4 of ‘void rcutils_log(const rcutils_log_location_t*, int, const char*, const char*, ...)’
                  479 |   const char * format,
                      |   ~~~~~~~~~~~~~^~~~~~
                gmake[2]: *** [CMakeFiles/uuv_fin_ros_plugin.dir/build.make:76: CMakeFiles/uuv_fin_ros_plugin.dir/src/FinROSPlugin.cpp.o] Error 1
                gmake[1]: *** [CMakeFiles/Makefile2:149: CMakeFiles/uuv_fin_ros_plugin.dir/all] Error 2
                gmake: *** [Makefile:146: all] Error 2
                ---
                Failed   <<< uuv_gazebo_ros_plugins [29.4s, exited with code 2]
                Aborted  <<< uuv_assistants [31.5s]                
                Aborted  <<< uuv_sensor_ros_plugins [30.5s]        
                Aborted  <<< uuv_world_ros_plugins [21.9s]                                   
                
                Summary: 11 packages finished [38.2s]
                  1 package failed: uuv_gazebo_ros_plugins
                  3 packages aborted: uuv_assistants uuv_sensor_ros_plugins uuv_world_ros_plugins
                  4 packages had stderr output: uuv_assistants uuv_gazebo_ros_plugins uuv_sensor_ros_plugins uuv_world_ros_plugins
                  7 packages not processed
                

                个人感觉应该是路径问题?不知道该如何下手去改了😵
                希望您不吝赐教!

                yudonghou123Y 1 条回复 最后回复 回复 引用 0
                • yudonghou123Y
                  小猴同学 @2500718605
                  最后由 编辑

                  @2500718605 你这个可能是C++语言的问题,慢慢对这要求改就行,应该是有的符号没识别出来

                  芜湖

                  1 条回复 最后回复 回复 引用 0
                  • yudonghou123Y
                    小猴同学 @小鱼
                    最后由 编辑

                    @小鱼 在 Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? 中说:

                    @yudonghou123 看一下gazebo启动指令,应该要有gazebo-ros-factory

                    您好,我又换了一个模型,还是这样的问题,我以为是gazebo_ros的问题,于是运行humble/share/gazebo_ros中的文件发现能够运行,libgazebo_ros_factory.so也存在这样的依赖包,我是通过launch文件启动的

                    芜湖

                    小鱼小 1 条回复 最后回复 回复 引用 0
                    • yudonghou123Y yudonghou123 删除了该主题于
                    • 小鱼小
                      小鱼 技术大佬 @yudonghou123
                      最后由 编辑

                      @yudonghou123 我觉得可能是gazebo启动的问题,自带的launch那个可能没有加gazebo_factory,你试试这样启动gazebo

                          start_gazebo_cmd =  ExecuteProcess(
                              cmd=['gazebo', '--verbose','-s', 'libgazebo_ros_init.so', '-s', 'libgazebo_ros_factory.so'],
                              output='screen')
                      

                      新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                      yudonghou123Y 1 条回复 最后回复 回复 引用 0
                      • yudonghou123Y yudonghou123 将这个主题标记为已解决,在
                      • yudonghou123Y yudonghou123 恢复了该主题于
                      • yudonghou123Y
                        小猴同学 @小鱼
                        最后由 yudonghou123 编辑

                        @小鱼 非常感激您的解答,原因是我陈列service时发现其对应的服务名称不对,程序调用的是前面加了一个命名空间,所以没有查找到对应的服务,我把多加的命名空间删除后,就可以了,已经改正过来了,模型也都能加载到gazebo环境中了,非常感激您,祝您身体健康😊

                        芜湖

                        25920604782 1 条回复 最后回复 回复 引用 0
                        • 25920604782
                          封月洞天的诺言 @ ROS2开发者 @yudonghou123
                          最后由 编辑

                          @yudonghou123
                          有详细步骤吗

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