04_例子讲解:rlViewDemo.exe

时间:2023-03-09 19:35:48
04_例子讲解:rlViewDemo.exe

参考资料:http://www.roboticslibrary.org/tutorials/first-steps-windows

使用rlViewDemo对应的快捷方式启动程序,可以看到如下界面:

注意:是用的快捷方式,因为该程序的启动是有填启动参数的:"E:\Program Files (x86)\rl-0.6.2\bin\rlViewDemo.exe" "E:\Program Files (x86)\rl-0.6.2\share\rl\examples\rlsg\unimation-puma560_boxes.xml"

04_例子讲解:rlViewDemo.exe

场景

场景的设计使用xml文件描述,格式是: RL scene graph format

通过rlViewDemo的参数可以知道,程序的启动使用了unimation-puma560_boxes.xml文件,该文件的类容是:

<?xml version="1.0" encoding="UTF-8"?>

<rlsg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="rlsg.xsd">

<scene href="unimation-puma560_boxes.wrl">

<model name="unimation-puma560">

<body name="link0"/>

<body name="link1"/>

<body name="link2"/>

<body name="link3"/>

<body name="link4"/>

<body name="link5"/>

<body name="link6"/>

</model>

<model name="boxes">

<body name=""/>

</model>

</scene>

</rlsg>

模型

场景的显示使用的VRML语言进行绘制的,VRML是一个针对网页的模型语言标准,虚拟现实常用到。

上面红色的部分就是VRML编写的模型,内容如下(就是一层一层的opengl绘制和模型视图的变换):

#VRML V2.0 utf8

Transform {

children [

DEF unimation-puma560 Transform {

children [

Inline {

url "unimation-puma560/unimation-puma560.wrl"

}             ]

}

DEF boxes Inline {

url "boxes.wrl"

}     ]

}

模型中在行前添加#代表注释。我们可以注释 url "boxes.wrl"这句话可以看看效果。这样启动起来的界面就只有机器人了,没有围墙了。