Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 19

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 20

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 21

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 22

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 23
URDF集成Rviz基本流程 - Hello World

URDF集成Rviz基本流程

清歌
2023-01-20 / 0 评论 / 0 阅读 / 正在检测是否收录...

需求

在 Rviz 中显示一个盒状机器人
实现流程
准备:新建功能包,导入依赖
核心:编写 urdf 文件
核心:在 launch 文件集成 URDF 与 Rviz

实现流程

创建功能包

创建一个新的功能包,名称自定义,导入依赖包:urdfxacro
在当前功能包下,再新建几个目录:
urdf: 存储 urdf 文件的目录
meshes:机器人模型渲染文件(暂不使用)
config: 配置文件
launch: 存储 launch 启动文件
Snipaste_2023-01-20_09-21-34.png

编写 URDF 文件
<robot name="mycar">
    <link name="base_link">
        <visual>
            <geometry>
                <box size="0.5 0.2 0.1" />
            </geometry>
        </visual>
    </link>
</robot>
编写launch文件
<launch>
    <!-- 设置参数 -->
    <param name="robot_description" textfile="$(find 包名)/urdf/urdf/urdf01_HelloWorld.urdf" />
    <!-- 启动 rviz -->
    <node pkg="rviz" type="rviz" name="rviz" />
</launch>
启动launch文件
source ./devel/setup.bash
roslaunch urdf_demo01 urdf_demo01_hello.launch 

机器人模型导入

导入机器人模型

Snipaste_2023-01-12_09-55-29.png

更改坐标系

Snipaste_2023-01-20_09-28-29.png

优化

存在问题

rviz 启动后,会发现并没有盒装的机器人模型,这是因为默认情况下没有添加机器人显示组件,需要手动添加

保存配置文件

Snipaste_2023-01-20_09-30-22.png

修改launch文件

在launch文件中添加配置文件路径

<launch>
    <param name="robot_description" textfile="$(find 包名)/urdf/urdf/urdf01_HelloWorld.urdf" />
    <node pkg="rviz" type="rviz" name="rviz" args="-d $(find 报名)/config/rviz/show_mycar.rviz" />
</launch>
启动launch文件
source ./devel/setup.bash
roslaunch urdf_demo01 urdf_demo01_hello.launch 
0

评论 (0)

取消