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

    第九章机器人仿真入门第三节《 将启动gazebo和生产fishbot写成launch文件》编写了gazebo.launch.py之后,运行gazebo没有显示机器人,也没有出现报错

    已定时 已固定 已锁定 已移动 未解决
    综合问题
    ros2机器人 gazebo仿真插件之两轮差速 gazebo不显示
    5
    14
    1.3k
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 4417555354
      头怎么还不秃啊
      最后由 编辑

      中间会报这些错误,然后在gazebo里就没有显示模型,launch拆成两个或者合成一个都是一样。
      ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'
      [spawn_entity.py-2] The C extension '/opt/ros/humble/lib/python3.10/site-packages/_rclpy_pybind11.cpython-38-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
      [ERROR] [spawn_entity.py-2]: process has died [pid 11696, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -entity fishbot -file /home/hdm/d2lros2/chapt8_ws/install/fishbot_description/share/fishbot_description/urdf/fishbot_gazebo.urdf --ros-args'].

      小鱼小 1 条回复 最后回复 回复 引用 0
      • 4417555354
        头怎么还不秃啊
        最后由 编辑

        求助求助!!!!

        1 条回复 最后回复 回复 引用 0
        • 小鱼小
          小鱼 技术大佬 @441755535
          最后由 编辑

          @441755535 在 第九章机器人仿真入门第三节《 将启动gazebo和生产fishbot写成launch文件》编写了gazebo.launch.py之后,运行gazebo没有显示机器人,也没有出现报错 中说:

          ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'

          conda 退掉

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

          4417555354 2 条回复 最后回复 回复 引用 0
          • 4417555354
            头怎么还不秃啊 @小鱼
            最后由 编辑

            此回复已被删除!
            4417555354 1 条回复 最后回复 回复 引用 0
            • 4417555354
              头怎么还不秃啊 @441755535
              最后由 编辑

              此回复已被删除!
              1 条回复 最后回复 回复 引用 0
              • 4417555354
                头怎么还不秃啊 @小鱼
                最后由 编辑

                @小鱼 退掉conda后gazebo可以加载模型了,但是会报下面的错误
                [gazebo-1] [Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros_imu_sensor.so: libgazebo_ros_imu_sensor.so: cannot open shared object file: No such file or directory
                [gazebo-1] [Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros_ray_sensor.so: libgazebo_ros_ray_sensor.so: cannot open shared object file: No such file or directory
                [gazebo-1] [Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros_diff_drive.so: libgazebo_ros_diff_drive.so: cannot open shared object file: No such file or directory
                [spawn_entity.py-2] [INFO] [1681979467.799171068] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [fishbot]
                [gazebo-1] [Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros_joint_state_publisher.so: libgazebo_ros_joint_state_publisher.so: cannot open shared object file: No such file or directory
                [INFO] [spawn_entity.py-2]: process has finished cleanly [pid 37915]
                [gazebo-1] context mismatch in svga_surface_destroy
                [gazebo-1] context mismatch in svga_surface_destroy

                4417555354 1 条回复 最后回复 回复 引用 0
                • 4417555354
                  头怎么还不秃啊 @441755535
                  最后由 编辑

                  @441755535
                  urdf代码如下
                  <?xml version="1.0"?>
                  <robot name="fishbot">

                  <!-- Robot Footprint -->
                  <link name="base_footprint"/>

                  <joint name="base_joint" type="fixed">
                  <parent link="base_footprint"/>
                  <child link="base_link"/>
                  <origin xyz="0.0 0.0 0.076" rpy="0 0 0"/>
                  </joint>

                  <!-- base link -->
                  <link name="base_link">
                  <visual>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                  <cylinder length="0.12" radius="0.10"/>
                  </geometry>
                  <material name="blue">
                  <color rgba="0.1 0.1 1.0 0.5" />
                  </material>
                  </visual>
                  <collision>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                  <cylinder length="0.12" radius="0.10"/>
                  </geometry>
                  <material name="blue">
                  <color rgba="0.1 0.1 1.0 0.5" />
                  </material>
                  </collision>
                  <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.0122666" ixy="0" ixz="0" iyy="0.0122666" iyz="0" izz="0.02"/>
                  </inertial>
                  </link>

                  <!-- laser link -->
                  <link name="laser_link">
                  <visual>
                  <origin xyz="0 0 0" rpy="0 0 0"/>
                  <geometry>
                  <cylinder length="0.02" radius="0.02"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </visual>
                  <collision>
                  <origin xyz="0 0 0" rpy="0 0 0"/>
                  <geometry>
                  <cylinder length="0.02" radius="0.02"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </collision>
                  <inertial>
                  <mass value="0.1"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
                  </inertial>
                  </link>

                  <!-- laser joint -->
                  <joint name="laser_joint" type="fixed">
                  <parent link="base_link" />
                  <child link="laser_link" />
                  <origin xyz="0 0 0.075" />
                  </joint>

                  <link name="imu_link">
                  <visual>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                  <box size="0.02 0.02 0.02"/>
                  </geometry>
                  </visual>
                  <collision>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                  <box size="0.02 0.02 0.02"/>
                  </geometry>
                  </collision>
                  <inertial>
                  <mass value="0.1"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
                  </inertial>
                  </link>

                  <!-- imu joint -->
                  <joint name="imu_joint" type="fixed">
                  <parent link="base_link" />
                  <child link="imu_link" />
                  <origin xyz="0 0 0.02" />
                  </joint>

                  <link name="left_wheel_link">
                  <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                  <cylinder length="0.04" radius="0.032"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </visual>
                  <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                  <cylinder length="0.04" radius="0.032"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </collision>
                  <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
                  </inertial>
                  </link>

                  <link name="right_wheel_link">
                  <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                  <cylinder length="0.04" radius="0.032"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </visual>
                  <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                  <cylinder length="0.04" radius="0.032"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </collision>
                  <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
                  </inertial>
                  </link>

                  <joint name="left_wheel_joint" type="continuous">
                  <parent link="base_link" />
                  <child link="left_wheel_link" />
                  <origin xyz="-0.02 0.10 -0.06" />
                  <axis xyz="0 1 0" />
                  </joint>

                  <joint name="right_wheel_joint" type="continuous">
                  <parent link="base_link" />
                  <child link="right_wheel_link" />
                  <origin xyz="-0.02 -0.10 -0.06" />
                  <axis xyz="0 1 0" />
                  </joint>

                  <link name="caster_link">
                  <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                  <sphere radius="0.016"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </visual>
                  <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                  <sphere radius="0.016"/>
                  </geometry>
                  <material name="black">
                  <color rgba="0.0 0.0 0.0 0.5" />
                  </material>
                  </collision>
                  <inertial>
                  <mass value="0.02"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
                  </inertial>
                  </link>

                  <joint name="caster_joint" type="fixed">
                  <parent link="base_link" />
                  <child link="caster_link" />
                  <origin xyz="0.06 0.0 -0.076" />
                  <axis xyz="0 1 0" />
                  </joint>

                  <gazebo reference="caster_link">
                  <material>Gazebo/Black</material>
                  </gazebo>

                  <gazebo reference="caster_link">
                  <mu1 value="0.0"/>
                  <mu2 value="0.0"/>
                  <kp value="1000000.0" />
                  <kd value="10.0" />
                  <!-- <fdir1 value="0 0 1"/> -->
                  </gazebo>

                  <gazebo>
                  <plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'>
                  <ros>
                  <namespace>/</namespace>
                  <remapping>cmd_vel:=cmd_vel</remapping>
                  <remapping>odom:=odom</remapping>
                  </ros>
                  <update_rate>30</update_rate>
                  <!-- wheels -->
                  <!-- <left_joint>left_wheel_joint</left_joint> -->
                  <!-- <right_joint>right_wheel_joint</right_joint> -->
                  <left_joint>left_wheel_joint</left_joint>
                  <right_joint>right_wheel_joint</right_joint>
                  <!-- kinematics -->
                  <wheel_separation>0.2</wheel_separation>
                  <wheel_diameter>0.065</wheel_diameter>
                  <!-- limits -->
                  <max_wheel_torque>20</max_wheel_torque>
                  <max_wheel_acceleration>1.0</max_wheel_acceleration>
                  <!-- output -->
                  <publish_odom>true</publish_odom>
                  <publish_odom_tf>true</publish_odom_tf>
                  <publish_wheel_tf>false</publish_wheel_tf>
                  <odometry_frame>odom</odometry_frame>
                  <robot_base_frame>base_footprint</robot_base_frame>
                  </plugin>

                    <plugin name="fishbot_joint_state" filename="libgazebo_ros_joint_state_publisher.so">
                      <ros>
                        <remapping>~/out:=joint_states</remapping>
                      </ros>
                      <update_rate>30</update_rate>
                      <joint_name>right_wheel_joint</joint_name>
                      <joint_name>left_wheel_joint</joint_name>
                    </plugin>    
                    </gazebo> 
                  
                    <gazebo reference="laser_link">
                      <material>Gazebo/Black</material>
                    </gazebo>
                  
                  <gazebo reference="imu_link">
                    <sensor name="imu_sensor" type="imu">
                    <plugin filename="libgazebo_ros_imu_sensor.so" name="imu_plugin">
                        <ros>
                          <namespace>/</namespace>
                          <remapping>~/out:=imu</remapping>
                        </ros>
                        <initial_orientation_as_reference>false</initial_orientation_as_reference>
                      </plugin>
                      <always_on>true</always_on>
                      <update_rate>100</update_rate>
                      <visualize>true</visualize>
                      <imu>
                        <angular_velocity>
                          <x>
                            <noise type="gaussian">
                              <mean>0.0</mean>
                              <stddev>2e-4</stddev>
                              <bias_mean>0.0000075</bias_mean>
                              <bias_stddev>0.0000008</bias_stddev>
                            </noise>
                          </x>
                          <y>
                            <noise type="gaussian">
                              <mean>0.0</mean>
                              <stddev>2e-4</stddev>
                              <bias_mean>0.0000075</bias_mean>
                              <bias_stddev>0.0000008</bias_stddev>
                            </noise>
                          </y>
                          <z>
                            <noise type="gaussian">
                              <mean>0.0</mean>
                              <stddev>2e-4</stddev>
                              <bias_mean>0.0000075</bias_mean>
                              <bias_stddev>0.0000008</bias_stddev>
                            </noise>
                          </z>
                        </angular_velocity>
                        <linear_acceleration>
                          <x>
                            <noise type="gaussian">
                              <mean>0.0</mean>
                              <stddev>1.7e-2</stddev>
                              <bias_mean>0.1</bias_mean>
                              <bias_stddev>0.001</bias_stddev>
                            </noise>
                          </x>
                          <y>
                            <noise type="gaussian">
                              <mean>0.0</mean>
                              <stddev>1.7e-2</stddev>
                              <bias_mean>0.1</bias_mean>
                              <bias_stddev>0.001</bias_stddev>
                            </noise>
                          </y>
                          <z>
                            <noise type="gaussian">
                              <mean>0.0</mean>
                              <stddev>1.7e-2</stddev>
                              <bias_mean>0.1</bias_mean>
                              <bias_stddev>0.001</bias_stddev>
                            </noise>
                          </z>
                        </linear_acceleration>
                      </imu>
                    </sensor>
                  </gazebo>
                  
                  <gazebo reference="laser_link">
                    <sensor name="laser_sensor" type="ray">
                    <always_on>true</always_on>
                    <visualize>true</visualize>
                    <update_rate>5</update_rate>
                    <pose>0 0 0.075 0 0 0</pose>
                    <ray>
                        <scan>
                          <horizontal>
                            <samples>360</samples>
                            <resolution>1.000000</resolution>
                            <min_angle>0.000000</min_angle>
                            <max_angle>6.280000</max_angle>
                          </horizontal>
                        </scan>
                        <range>
                          <min>0.120000</min>
                          <max>3.5</max>
                          <resolution>0.015000</resolution>
                        </range>
                        <noise>
                          <type>gaussian</type>
                          <mean>0.0</mean>
                          <stddev>0.01</stddev>
                        </noise>
                    </ray>
                  
                    <plugin name="laserscan" filename="libgazebo_ros_ray_sensor.so">
                      <ros>
                        <!-- <namespace>/tb3</namespace> -->
                        <remapping>~/out:=scan</remapping>
                      </ros>
                      <output_type>sensor_msgs/LaserScan</output_type>
                      <frame_name>laser_link</frame_name>
                    </plugin>
                    </sensor>
                  </gazebo>
                  

                  </robot>

                  1 条回复 最后回复 回复 引用 0
                  • 10949672961
                    丘洪键
                    最后由 1094967296 编辑

                    解决:把launch中的urdf_name = "fishbot_gazebo.urdf" 改为:urdf_name = "fishbot_base.urdf"
                    d9b9de99-2f44-4486-92c9-c369170031ed-image.png
                    原因:(自己摸索的,不知道对不对,我自己按上面改了之后就能显示了)
                    应该是urdf的文件名搞错了,第8章跟着教程建立urdf的文件名是_base结尾的,如下图:
                    40d29d65-6dc3-41ba-af2a-4b194ebc90b1-image.png

                    然后现在的launch文件里是_gazebo结尾的:
                    67cb6a7b-520c-4cc6-b0d0-17f13f6e0be3-image.png

                    运行就加载不了urdf文件了,报错:
                    c650fda7-c8af-4342-bf7f-8da8bee23de9-image.png
                    看看这个路径下的urdf文件,并没有fishbot_gazebo.urdf
                    7f3c279f-0bf1-4311-bc28-b2fc1acd8868-image.png

                    10949672961 1 3 条回复 最后回复 回复 引用 0
                    • 10949672961
                      丘洪键 @1094967296
                      最后由 编辑

                      @1094967296 首先确保用rqt显示是没问题的,确保urdf里的内容是对的

                      1 条回复 最后回复 回复 引用 0
                      • 1
                        18730832756 @1094967296
                        最后由 编辑

                        此回复已被删除!
                        1 条回复 最后回复 回复 引用 0
                        • 1
                          18730832756 @1094967296
                          最后由 编辑

                          @1094967296 牛皮,哥,我找了半天的错没想到是名错了

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