其他分享
首页 > 其他分享> > DAY7-让机器动起来

DAY7-让机器动起来

作者:互联网

<1> Arbotix --Rviz中控制机器人模型运动

文档链接
在这里插入图片描述

<2>URDF集成Gazebo

同样是显示一个小方块,但是,gazebo和rviz有明显的区别。
首先,是依赖的库:

urdf xacro gazebo_ros gazebo_ros_control gazebo_plugins
<!-- 
    创建一个机器人模型(盒状即可),显示在 Gazebo 中 
-->

<robot name="mycar">
    <link name="base_link">
        <!-- Rviz 中只有可视化标签即可 color已经无效 -->
        <visual>
            <geometry>
                <box size="0.5 0.2 0.1" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
            <material name="yellow">
                <color rgba="0.5 0.3 0.0 1" />
            </material>
        </visual>
        <!-- Gazebo 中还有碰撞标签 -->
        <collision>
            <geometry>
                <box size="0.5 0.2 0.1" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
        </collision>
        <!-- Gazebo 中还有惯性标签 -->
        <inertial>
            <!-- 设置重心偏移 -->
            <origin xyz="0 0 0" />
            <!-- 质量 kg -->
            <mass value="6" />
            <!-- 不同维度的惯性 -->
            <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" />
        </inertial>
    </link>
    <!-- Gazebo中有自己的颜色 -->
    <gazebo reference="base_link">
        <material>Gazebo/Green</material>
    </gazebo>

</robot>

<launch>

    <!-- 设置参数 -->
    <param name="robot_description" textfile="$(find urdf_gazebo)/urdf/demo01_helloworld.urdf" />
    <!-- 启动 gazebo -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch" />cl
    <!-- 在 gazebo 中显示机器人模型 -->
    <node pkg="gazebo_ros" type="spawn_model" name="model" args="-urdf -model mycar -param robot_description"  />

</launch>

标签:control,起来,机器,小方块,DAY7,Gazebo,Arbotix,ros,gazebo
来源: https://blog.csdn.net/weixin_45942372/article/details/122381280