├── README.md ├── demo1-1 ├── README.md ├── demo1-1.ttt └── script │ └── script.txt ├── demo1-2 ├── README.md ├── demo1-2.ttt └── scene │ └── demo1-1.ttt ├── demo2-1 ├── CAD_model │ ├── part1.STL │ └── part2.STL ├── README.md ├── demo2-1.ttm └── texture │ ├── bus_stop.png │ └── town1.png ├── demo2-2 ├── CAD_model │ ├── body.SLDPRT │ ├── frame.STL │ ├── lamp.STL │ ├── lampshade.STL │ ├── tyre.STL │ ├── wheel.SLDPRT │ ├── wheelhub.STL │ └── windows.STL ├── README.md └── demo2-2.ttm ├── demo2-3 ├── README.md ├── blender │ └── road_segment.blend ├── demo2-3.ttm ├── obj │ ├── road_segment.mtl │ └── road_segment.obj ├── other │ ├── bksid_10.jpg │ ├── bksid_11.jpg │ ├── bksid_12.jpg │ ├── bksid_13.jpg │ ├── bksid_14.jpg │ ├── bump01B.jpg │ ├── bump01C.jpg │ ├── bump01S.jpg │ ├── bump02C.jpg │ ├── bump03B.jpg │ ├── bump03C.jpg │ ├── bump03S.jpg │ ├── bump04C.jpg │ ├── city_bump1.3ds │ ├── city_bump2.3ds │ ├── city_intersection.3ds │ ├── city_intersectionUS.3ds │ ├── city_road.3ds │ ├── cross01B.jpg │ ├── cross01C.jpg │ ├── cross01S.jpg │ ├── cross02C.jpg │ ├── nrUS_08B.jpg │ ├── nrUS_08C.jpg │ ├── nrUS_08S.jpg │ ├── nrUS_10B.jpg │ ├── nrUS_10C.jpg │ ├── nrUS_10S.jpg │ ├── nrUS_11C.jpg │ ├── nrUS_12C.jpg │ ├── nr_05B.jpg │ ├── nr_05C.jpg │ ├── nr_05S.jpg │ ├── nr_06C.jpg │ ├── nr_07B.jpg │ ├── nr_07C.jpg │ ├── nr_07S.jpg │ ├── nr_08B.jpg │ ├── nr_08C.jpg │ ├── nr_08S.jpg │ ├── nr_09B.jpg │ ├── nr_09C.jpg │ ├── nr_09S.jpg │ ├── nr_10B.jpg │ ├── nr_10C.jpg │ ├── nr_10S.jpg │ ├── nr_11C.jpg │ ├── nr_12C.jpg │ ├── nr_13C.jpg │ ├── or_city_bump1.3ds │ ├── or_city_bump2.3ds │ ├── or_city_intersection.3ds │ ├── or_city_intersectionUS.3ds │ └── or_city_road.3ds └── texture │ ├── bksid_11.jpg │ └── nr_05B.jpg └── demo2-4 ├── README.md ├── blender └── terrain.blend ├── demo2-4.ttt ├── obj ├── terrain.mtl └── terrain.obj └── texture └── nr_05B.jpg /README.md: -------------------------------------------------------------------------------- 1 | 本教程介绍VREP的使用,及可视化模型和场景的搭建等内容。 2 | 水平有限,错误和疏漏之处敬请指正。 3 | 感谢老师和师兄的帮助。 4 | 5 | # 安装VREP 6 | ## 下载VREP 7 | 点击下载[64位Windows版本](http://coppeliarobotics.com/files/V-REP_PRO_EDU_V3_4_0_Setup.exe) 8 | 和[64位Linux版本](http://coppeliarobotics.com/files/V-REP_PRO_EDU_V3_4_0_Linux.tar.gz) 9 | VREP。 10 | 11 | **Note**: 目前(2017.11)最新的VREP版本为3.4,是64位的,3.4之前的版本是32位。 12 | 推荐使用64位Linux版本VREP。 13 | 其他平台及其他版本[下载地址](http://www.coppeliarobotics.com/previousversions.html)。 14 | 15 | ## 安装和运行 16 | Windows 17 | 18 | - 相信大家都会。 19 | 20 | Linux 21 | 22 | 以Ubuntu 16.04为例。 23 | - 打开终端`cd`到下载目录,输入`$tar -zxvf V-REP_PRO_EDU_V3_4_0_Linux.tar.gz`解压*V-REP_PRO_EDU_V3_4_0_Linux.tar.gz*文件。进入VREP目录,输入`$./vrep.sh`即可打开VREP。 24 | - 在终端输入`$gedit ~/.bashrc`,在末尾添加 25 | `alias vrep="/vrep.sh"`并保存,随后在终端输入`$source ~/.bashrc`。 26 | 现在可以在终端直接输入`$vrep`命令来打开VREP了。 27 | 28 | **Note**: 如果你是bit-ivrc成员,在autoSim-ivrc仓中的 29 | [脚本](https://github.com/bit-ivrc/autoSim-ivrc/tree/master/scripts)中 30 | 包含了VREP的安装bash,可通过此bash安装,也可以通过上边的介绍手动安装。 31 | 32 | --- 33 | # 1 VREP基础 34 | 本教程使用VREP 3.4.0 版本。 35 | 通过这部分的实例,可以快速了解VREP的基础操作。 36 | 教程中初次提到的操作会详细描述,多次提到的操作将简略说明。 37 | 38 | **Note**: 这部分整理自bit的VREP教学视频, 39 | 视频使用的VREP版本过早,但依然具有参考价值。 40 | 百度云[下载链接](https://pan.baidu.com/s/1jIMPSsm),密码: 8und。 41 | 42 | ## [教程1-1](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo1-1) 43 | - 搭建小车。添加车体车轮,添加和设置转向关节。 44 | - 编写控制脚本,实现用键盘方向键对小车进行运动控制。 45 | 46 | ## [教程1-2](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo1-2) 47 | - 观察小车运动轨迹。观察小车速度。 48 | - 传感器的使用。视觉传感器、距离传感器、激光雷达。 49 | 50 | 51 | # 2 可视化模型和场景 52 | 53 | ## [教程2-1](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo2-1) 54 | 介绍VREP贴图相关操作,利用VREP的贴图可以制作出丰富的场景。 55 | - VREP贴图相关操作。 56 | - 制作交通标志牌。 57 | 58 | ## [教程2-2](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo2-2) 59 | Solidworks绘制车辆模型,并将车辆模型导入VREP中。 60 | - 从Solidworks导出STL文件。 61 | - 将STL文件导入VREP。 62 | - 调整各模型实体的位置和颜色并添加关节(joint)。 63 | - 添加脚本。 64 | 65 | ## [教程2-3](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo2-3) 66 | 使用三维建模软件绘制道路并导入VREP形成可用的道路。教程中绘制道路模型的三维软件为Blender。 67 | - Blender的安装。 68 | - Blender的使用基础。 69 | - 使用Blender绘制道路模型。 70 | - 将道路模型导入VREP中形成可以仿真的道路。 71 | - 模块化道路场景搭建。 72 | 73 | ## [教程2-4](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo2-4) 74 | 制作盘山公路,使用教程1-1中的小车进行仿真。 75 | - 使用Blender绘制盘山公路。 76 | - 将盘山公路导入VREP,并将公路变为仿真实体。 77 | - 添加小车进行仿真。 78 | -------------------------------------------------------------------------------- /demo1-1/README.md: -------------------------------------------------------------------------------- 1 | # 教程1-1 2 | 本教程介绍一个小车的搭建过程,通过编写脚本实现用键盘方向键对小车的控制。 3 | 脚本可在demo1-1/script中获得,已完成的文件demo1-1.ttt,可在demo1-1文件夹中获得。 4 | 5 | ## 1 搭建小车 6 | ### 1.1 车体和四个滚动轮 7 | - 点击菜单栏的*Add > Primitive shape > Cuboid*,在弹出的对话框中 8 | 分别设置x,y,z参数为0.3, 1.1, 0.1,其他参数保持默认,点击OK。 9 | - 点击*Add > Primitive shape > Cylinder*,在弹出的对话框中 10 | 设置x,y,z参数为0.3,其他参数保持默认,点击OK。 11 | - 选中Cylinder,点击工具栏的*object/item rotate*,点击*Orientation*将beta值改为90。 12 | - 选中Cylinder,点击工具栏的*object/item shift*,将*Position*下x,y,z坐标值改为0.4, -0.35, +0.05。 13 | - 点击菜单栏的*Add > Joint > Revolute*,双击Revolute_joint图标, 14 | 在弹出的属性框点击*Show dynamic parameters dialog*,勾选*Motor enable*, 15 | 并设置*Target velocity*为10,*Max. torque*为20。关闭对话框。 16 | - 选中Revolute_joint,点击工具栏的*object/item rotate*,点击*Orientation*将beta值改为90。 17 | - 依次选择Revolute_joint和Cylinder,点击工具栏的*object/item shift*, 18 | 点击*Position*下的*Apply to selection*。此步骤设置Revolute_joint与Cylinder位置相同。 19 | - 拖动Cylinder到Revolute_joint下,再拖动Revolute_joint到Cuboid下,形成一个树状结构。 20 | - 将Cylinder和Revolute_joint作为整体进行复制,粘贴3次,并将复制出来的3个车轮和Joint拖到Cuboid下。 21 | - 选中Revolute_joint0,点击工具栏的*object/item shift*,将*Position*下x值改为-0.4。 22 | 此时树下的Cylinder0会跟着进行位置变换。 23 | - 相同的操作,将Revolute_joint1的y值改为+0.35;将Revolute_joint2的x,y值改为-0.4, +0.35。 24 | - 选中Cuboid,进行位置变换(简略了操作说明),在*Mouse Translation*下选择*World*和*along Z*,用鼠标进行拖动; 25 | 也可在*Position*下直接更改z值改为0.175。此时树下的所有结构都一起做了位置变换。 26 | - 双击Cuboid图标,在弹出的属性框*Common*选项卡下勾选*Object is model base*。 27 | - 选中ResizableFloor_5_25,将size拉到最大。点击工具栏的*start/resume simulation*,可观察到小车在缓慢行驶。 28 | - 更改shape和joint的名字。名字和结构如下。名字与脚本对应,非常重要。 29 |
 \- Vehicle 30 |
      \- Front_left_joint 31 |
          \- Front_left_wheel 32 |
      \- Front_right_joint 33 |
          \- Front_right_wheel 34 |
      \- Rear_left_joint 35 |
          \- Rear_left_wheel 36 |
      \- Rear_right_joint 37 |
          \- Rear_right_wheel 38 | ### 1.2 使两个前轮转向 39 | - 添加一个Cuboid,参数默认,和一个Revolute_joint。依次选中Cuboid和Front_left_joint, 40 | 进行shift变换*Apply to selection*和rotate变换*Apply to selection*; 41 | 依次选中Revolute_joint和Front_left_joint,进行shift变换*Apply to selection*。 42 | - 将Cuboid拖到Revolute_joint下,将Cuboid和Revolute_joint作为整体复制1个出来。 43 | - 将Revolute_joint和Revolute_joint0拖到Vehicle下,将Revolute_joint0坐标x值改为-0.4。 44 | - 将Front_left_joint拖到Cuboid下,将Front_right_joint拖到Cuboid0下,并改名。现在的结构如下所示。 45 |
 \- Vehicle 46 |
      \- Rear_left_joint 47 |
          \- Rear_left_wheel 48 |
      \- Rear_right_joint 49 |
          \- Rear_right_wheel 50 |
      \- Steer_left_joint 51 |
          \- Cuboid 52 |
              \- Front_left_joint 53 |
                  \- Front_left_wheel 54 |
      \- Steer_right_joint 55 |
          \- Cuboid0 56 |
              \- Front_right_joint 57 |
                  \- Front_right_wheel 58 | ### 1.3 属性框参数设置 59 | - 打开Cuboid属性对话框,点击*Show dynamic parameters dialog*勾掉*Body is respondable*, 60 | 并在属性对话框中的*Common*选项卡下,将*Camera visibility layer*勾掉上边的勾,在下面打勾,将其设为隐藏。 61 | 对Cuboid0进行相同的设置。 62 | - 打开Steer_left_joint属性对话框,点击*Show dynamic parameters dialog*,勾上*Motor enable*和*Control loop enable*,将Max. torque设置为1000。对Steer_right_joint的属性进行相同的设置。 63 | - 打开Front_left_joint属性对话框,点击*Show dynamic parameters dialog*,勾上*Motor enable* 并改变Target velocity为0,Max. torque为200。对Front_right_joint进行相同的设置。 64 | - 打开Rear_left_joint属性对话框,点击*Show dynamic parameters dialog*,勾掉*Motor enable*。对Rear_right_joint进行相同的设置。 65 | - **开始仿真**,点击工具栏的start/resume simulation,小车不动,因为我们把速度设为了0。 66 | 67 | ## 2 编写控制脚本 68 | - 选择Vehicle,点击菜单栏的*Add > Associated child script > Threaded*。 69 | - 双击Vehicle右侧的图标,编写lua控制脚本。 70 | 本教程提供了一个lua 71 | [脚本](https://github.com/bit-ivrc/vrep_tutorial/blob/master/demo1-1/script/script.txt), 72 | 将内容粘贴进去即可。 73 | - **开始仿真**,可以用键盘方向键控制小车运动。 74 | 75 | **Note**: VREP的脚本为lua语言,关于lua可查阅 76 | [lua教程](http://www.runoob.com/lua/lua-tutorial.html)。 77 | 关于VREP的API的使用可查看VREP 78 | 使用手册中API的[介绍](http://www.coppeliarobotics.com/helpFiles/en/apisOverview.htm)。 79 | -------------------------------------------------------------------------------- /demo1-1/demo1-1.ttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo1-1/demo1-1.ttt -------------------------------------------------------------------------------- /demo1-1/script/script.txt: -------------------------------------------------------------------------------- 1 | -- This script is threaded! It is a very simple example of how Ackermann steering can be handled. 2 | -- Normally, one would use a non-threaded script for that 3 | 4 | threadFunction=function() 5 | while simGetSimulationState()~=sim_simulation_advancing_abouttostop do 6 | -- Read the keyboard messages (make sure the focus is on the main window, scene view): 7 | message,auxiliaryData=simGetSimulatorMessage() 8 | while message~=-1 do 9 | if (message==sim_message_keypress) then 10 | if (auxiliaryData[1]==2007) then 11 | -- up key 12 | desiredWheelRotSpeed=desiredWheelRotSpeed+wheelRotSpeedDx 13 | end 14 | if (auxiliaryData[1]==2008) then 15 | -- down key 16 | desiredWheelRotSpeed=desiredWheelRotSpeed-wheelRotSpeedDx 17 | end 18 | if (auxiliaryData[1]==2009) then 19 | -- left key 20 | desiredSteeringAngle=desiredSteeringAngle+steeringAngleDx 21 | if (desiredSteeringAngle>45*math.pi/180) then 22 | desiredSteeringAngle=45*math.pi/180 23 | end 24 | end 25 | if (auxiliaryData[1]==2010) then 26 | -- right key 27 | desiredSteeringAngle=desiredSteeringAngle-steeringAngleDx 28 | if (desiredSteeringAngle<-45*math.pi/180) then 29 | desiredSteeringAngle=-45*math.pi/180 30 | end 31 | end 32 | end 33 | message,auxiliaryData=simGetSimulatorMessage() 34 | end 35 | 36 | -- We handle the front left and right wheel steerings (Ackermann steering): 37 | steeringAngleLeft=math.atan(l/(-d+l/math.tan(desiredSteeringAngle))) 38 | steeringAngleRight=math.atan(l/(d+l/math.tan(desiredSteeringAngle))) 39 | simSetJointTargetPosition(steeringLeft,steeringAngleLeft) 40 | simSetJointTargetPosition(steeringRight,steeringAngleRight) 41 | 42 | -- We take care of setting the desired wheel rotation speed: 43 | simSetJointTargetVelocity(motorLeft,desiredWheelRotSpeed) 44 | simSetJointTargetVelocity(motorRight,desiredWheelRotSpeed) 45 | 46 | -- Since this script is threaded, don't waste time here: 47 | simSwitchThread() -- Resume the script at next simulation loop start 48 | end 49 | end 50 | 51 | -- Put some initialization code here: 52 | -- Retrieving of some handles and setting of some initial values: 53 | steeringLeft=simGetObjectHandle('Steer_left_joint') 54 | steeringRight=simGetObjectHandle('Steer_right_joint') 55 | motorLeft=simGetObjectHandle('Front_left_joint') 56 | motorRight=simGetObjectHandle('Front_right_joint') 57 | desiredSteeringAngle=0 58 | desiredWheelRotSpeed=0 59 | steeringAngleDx=2*math.pi/180 60 | wheelRotSpeedDx=20*math.pi/180 61 | d=0.755 -- 2*d=distance between left and right wheels 62 | l=2.5772 -- l=distance between front and read wheels 63 | 64 | -- Here we execute the regular thread code: 65 | res,err=xpcall(threadFunction,function(err) return debug.traceback(err) end) 66 | if not res then 67 | simAddStatusbarMessage('Lua runtime error: '..err) 68 | end 69 | 70 | -- Put some clean-up code here: 71 | 72 | 73 | -------------------------------------------------------------------------------- /demo1-2/README.md: -------------------------------------------------------------------------------- 1 | # 教程1-2 2 | 本教程使用教程1-1搭建的小车,可在本教程目录demo1-2/scene文件夹中, 3 | 或在demo1-1/文件夹中获得demo1-1.ttt文件。 4 | 将介绍如何显示小车的运动轨迹,及传感器的使用。已完成的文件demo1-2.ttt,可在demo1-2文件夹中获得。 5 | 6 | 首先,打开vrep,点击菜单*File > Open scene*,选择demo1-1.ttt文件。 7 | 8 | ## 1 Gragh的使用 9 | ### 1.1 显示小车运动轨迹 10 | - 点击菜单栏的*Add > Graph*,改名为Vehicle_Graph,拖到Vehicle下。弹出的窗口先不管。 11 | 为了不与地板重合,调整z坐标为0.05。 12 | - 打开Vehicle_Graph的属性对话框,点击*Add new data stream to record*,对话框中 13 | *Data stream type*项选择Object: absolute x-position, 14 | *Object/item to record*选择Vehicle_Graph, 15 | 相同,把物体的y,z位置绝对也添加进Vehicle_Graph。 16 | - 把列表中的Data, Data0, Data1重命名为Data_x_vehicle, Data_y_vehicle, Data_z_vehicle。 17 | - 将Data stream recording list的三个数据全部勾选掉*visible*。 18 | - 点击*Edit 3D curves*,接着点击*Add new curve*,xyz值分别对应 19 | Data_x_vehicle, Data_y_vehicle, Data_z_vehicle。勾选*Relative to world*, 20 | 设置*curve width*为4 21 | - **开始仿真**,用按键控制小车运动,即可观察到小车的运动轨迹。 22 | 23 | **Note**: 可通过*Edit 3D curves*中*Adjust color*按钮,设置曲线颜色。 24 | 25 | ### 1.2 观察小车速度 26 | - 在Vehicle_Graph的属性对话框中再添加一条数据, 27 | 将Object: absolute velocity添加进Vehicle_Graph。保持Visible勾选。改名为velocity。 28 | - 运行仿真,可看到小车的速度在Vehicle_Graph窗口Time graph选项卡下显示。 29 | 30 | **Note**: 可通过*Adjust curve color*按钮,,设置曲线颜色。 31 | 32 | ## 2 传感器 33 | ### 2.1 视觉传感器 34 | - 添加4个Cylinder作为障碍物,放在小车前方。Cylinder的x,y,z尺寸均为0.3。 35 | - 点击菜单栏的*Add > Vision sensor > Perspective type*,更改位置, 36 | x为0,y为-0.55,z为+0.25。旋转,Alpha为90。并将其拖入Vehicle树下。 37 | - 打开Vision_sensor的属性对话框。Near/far clipping plane为0.01/2, 38 | Persp. angle为45,Resolution X/Y为256/256。注意观察变化。 39 | - 打开Cylinder的属性对话框,在shape选项卡下,打开*dynamic properties*, 40 | 勾掉*body is dynamic*。其他三个Cylinder相同。 41 | 在Common选项卡下,勾上Collidable, Measuable, Detectable, Renderable。 42 | 其他三个Cylinder相同。 43 | - 选中Vision_sensor,在场景中*右键 > Add > Floating view*, 44 | 在出现的Floating view上*右键 > Associate view with ... version sensor*。 45 | - **运行仿真**,即可在视图窗口中看到视觉传感器检测到的物体。 46 | - 打开Vision_sensor属性对话框,点击*show filter dialog*, 47 | 选择*edge detection on work image*,点击*add fliter*,并将此fliter顺序调到第二位。 48 | 双击fliter可设置阈值。 49 | - **运行仿真**,可看到上述窗口显示了物体的边缘。 50 | - 隐藏Vision_sensor物体。打开属性对话框,在Common选项卡下layer第二层打勾。 51 | 52 | **Note**: 在设置Object/item属性及参数的时候注意理解其中的含义。 53 | 54 | ### 2.2 距离传感器 55 | - 点击菜单栏的*Add > Proximity sensor > Cone type*,使用*Apply to selection* 56 | 将Proximity_sensor进行与Vision_sensor相同的*平移*和*旋转*。 57 | - 打开属性对话框,设置*detection parameters*,仅保持前四项勾选。第四项角度为45。 58 | 设置*detection volume properties*,更改Range为0.5,Angel为30,其他保持不变。 59 | - 将Proximity sensor拖到Vehicle树下并改名为sensingNoise。 60 | - 打开Vehicle_Graph对话框,*add new data stream to record*, 61 | Proximity sensor: detection distance对应sensingNoise。并将data改名为distance_obstacle。 62 | - 更改distance_obstacle的curve颜色为绿色,与velocity的红色curve保持区分。 63 | - **开始仿真**,移动小车,可按到Vehicle_Graph窗口中出现红绿两条曲线。 64 | 65 | **Note**: 在设置Object/item属性及参数的时候注意理解其中的含义。 66 | 67 | ### 2.3 激光雷达 68 | - 添加两个Cuboid,xyz为0.1, 0.7, 0.8。作为障碍物,移动到小车两侧。 69 | - 打开Cuboid的属性对话框,在shape选项卡下,打开*dynamic properties*, 70 | 勾掉*body is dynamic*。在Common选项卡下,勾上Collidable, Measuable, Detectable, Renderable。另外一个Cuboid相同。 71 | - 点击Model browser的components > sensor将velodyneHDL_64E_S2拖入scene中。 72 | - 沿着z轴将激光雷达移动到小车车身上方。并将激光雷达拖到Vehicle树下。 73 | - **运行仿真**,可看到激光雷达工作。在激光雷达的脚本中,可更该频率参数。 74 | 的在激光雷达树下vision sensor的属性对话框中可更改与激光雷达有关的其他参数。 75 | 76 | **Note**: 注意理解各项参数的含义。 77 | -------------------------------------------------------------------------------- /demo1-2/demo1-2.ttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo1-2/demo1-2.ttt -------------------------------------------------------------------------------- /demo1-2/scene/demo1-1.ttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo1-2/scene/demo1-1.ttt -------------------------------------------------------------------------------- /demo2-1/CAD_model/part1.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-1/CAD_model/part1.STL -------------------------------------------------------------------------------- /demo2-1/CAD_model/part2.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-1/CAD_model/part2.STL -------------------------------------------------------------------------------- /demo2-1/README.md: -------------------------------------------------------------------------------- 1 | # 教程2-1 2 | 本教程介绍VREP贴图相关的操作。提供一个示例,通过VREP贴图操作制作一个路牌。教程中使用的图片素材可在demo2-1/texture文件夹中获得,使用的CAD模型可在demo2-1/CAD_model中获得。已完成的文件demo2-1.ttm,可在demo2-1文件夹中获得。不同于前面两个教程,本教程的完成文件.ttm文件是模型文件。点击菜单栏 *File > model* 可载入.ttm文件。 3 | 4 | **Note**: 本教程不对CAD模型的格式作过多说明,关于CAD模型的说明请看后面的教程。 5 | 6 | ## 1 添加CAD模型 7 | ### 1.1 导入CAD模型 8 | - 点击菜单栏的*File > Import > Mesh*,导入demo2-1/CAD_model文件夹下的所有模型。在VREP中显示为STL_Imported和STL_Imported0,将其改名为part1和part2。 9 | - 点击菜单栏的*Add > Primitive shape*,添加一个Cuboid和Cylinder,分别改名为part3和part4。 10 | ### 1.2 调整模型的位置和色彩 11 | - 调整part1,part2和part3,part4的大小和位置,使之组成一个路牌。 12 | - 可对每一个Mesh和Shape调整色彩。打开Object的属性对话框,点击*Adjust color*进行调整。 13 | 14 | ## 2 添加图片 15 | ### 2.1 导入图片 16 | - 在Shape上添加texture,让模型变得更加逼真。打开part3和part4的属性对话框,点击*Adjust texture*。 17 | - 在弹出的对话框中点击*Load new texture*,part3选择town1.png,part4选择bus_stop.png。 18 | - *Scale textures to*决定图片在VREP中的放大倍数,越大越清晰,但文件大小会变大。 19 | 20 | **Note**: 支持导入的图片格式有JPEG, PNG, TGA, BMP, TIFF, GIF。 21 | 22 | ### 2.2 调整图片 23 | - 在texture对话框值对导入的图片进行大小和位置的调整。 24 | - 映射的[相关解释](http://www.coppeliarobotics.com/helpFiles/en/textureDialog.htm)。 贴图操作是将位图投射到一个Shape上,VREP提供几种投射纹理的方法(Mapping mode): 投影映射、圆柱映射、球形映射,立方体映射。可根据需要选择合适的映射方式。 25 | 26 | ## 3 导出模型 27 | - 选中part1, part2, part3和part4。右键*Edit > Grouping / Merging > Group selected shapes*进行合并,并重命名为guidepost。 28 | - 打开guidepost1属性对话框,选择*Object is model based*。 29 | - 点击*File > Save model as* 导出模型。 30 | -------------------------------------------------------------------------------- /demo2-1/demo2-1.ttm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-1/demo2-1.ttm -------------------------------------------------------------------------------- /demo2-1/texture/bus_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-1/texture/bus_stop.png -------------------------------------------------------------------------------- /demo2-1/texture/town1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-1/texture/town1.png -------------------------------------------------------------------------------- /demo2-2/CAD_model/body.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/body.SLDPRT -------------------------------------------------------------------------------- /demo2-2/CAD_model/frame.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/frame.STL -------------------------------------------------------------------------------- /demo2-2/CAD_model/lamp.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/lamp.STL -------------------------------------------------------------------------------- /demo2-2/CAD_model/lampshade.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/lampshade.STL -------------------------------------------------------------------------------- /demo2-2/CAD_model/tyre.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/tyre.STL -------------------------------------------------------------------------------- /demo2-2/CAD_model/wheel.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/wheel.SLDPRT -------------------------------------------------------------------------------- /demo2-2/CAD_model/wheelhub.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/wheelhub.STL -------------------------------------------------------------------------------- /demo2-2/CAD_model/windows.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/CAD_model/windows.STL -------------------------------------------------------------------------------- /demo2-2/README.md: -------------------------------------------------------------------------------- 1 | # 教程2-2 2 | 本教程介绍将Solidworks绘制的车辆模型导入VREP中,使成为可以进行仿真的车辆模型。教程中使用的CAD模型文件可在demo2-2/CAD_model文件夹中找到。目录下包含两种类型的文件,`.SLDPRT`文件是使用Solidworks 2014创建的文件,`.STL`文件是一种三维图形文件格式,本例中使用这种格式进行Solidworks与VREP的文件交互。完成的模型文件为demo2-2.ttm。 3 | 4 | **Note**: Solidworks曲线和曲面命令是车身和轮胎三维建模过程中经常用到的命令。完成的车身三维模型为`body.SLDPRT`,完成的轮胎三维模型为`wheel.STDPRT`。 5 | 6 | ## 1 Solidworks 7 | Solidworks软件方面,假设已经完成了车身和轮胎的三维建模,得到了车身和轮胎的工程文件`body.SLDPRT`和`wheel.STDPRT`。 8 | - 使用Solidworks打开`body.SLDPRT`,进入“过滤实体模式”,分别选择车身的各个实体,点击*文件 > 另存为*,把个实体另存为STL格式文件。 9 | - 同样,将轮胎模型`wheel.STDPRT`各实体也另存为STL格式文件。 10 | - 最终产生6各STL文件。`wheelhub.STL`, `tyre.STL`, `frame.STL`, `lamp.STL`, `lampshade.STL`, `windows.STL`。可在demo2-2/CAD_model文件夹中找到。 11 | 12 | **Note**: STL格式的选项中,可以选择输出二进制或者ASCII,两种格式都可以。调节品质可调整输出精度,不宜过大,一般选择默认的*粗糙* 即可。 13 | 14 | ## 2 VREP 15 | 把上面得到的STL文件倒入进VREP,更改各部分位置和颜色,添加关节(joint)。 16 | - 点击菜单栏的*File > Import > Mesh* 选择上面生成的各个STL文件。在弹出的对话框中,*Mesh scaling* 表示放大比例,可以根据需要选择;有的三维建模软件采用Z轴向上,有的采用y轴向上,在*Mesh Orientation* 中对应选择。 17 | - `wheelhub.STL`和`tyre.STL`组成车轮,共有四个车轮。`frame.STL`, `lamp.STL`, `lampshade.STL`和`windows.STL`组成车身body。 18 | - 调整车身和车轮各部分的位置。Object/Item Translation/Position。 19 | - 调整各部分颜色。双击Object,打开属性对话框,点击Adjust color。 20 | - 添加关节(joint)。具体的做法请参照 21 | [教程1-1](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo1-1)。 22 | - 调整各Object的父子关系和名称,最终结构如下: 23 |
 \- Vehicle 24 |
 \- Vehicle_body 25 |
      \- Vehicle_rearleftMotor 26 |
          \- Vehicle_rearleftwheelRespondable 27 |
              \- Vehicle_rearleftwheelhub 28 |
      \- Vehicle_rearrightMotor 29 |
          \- Vehicle_rearrightwheelRespondable 30 |
              \- Vehicle_rearrightwheelhub 31 |
      \- Vehicle_frontleftsteeringMotor 32 |
          \- Vehicle_frontleftsteeringMotorpart 33 |
              \- Vehicle_frontleftMotor 34 |
              \- Vehicle_frontleftwheelRespondable 35 |
                  \- Vehicle_frontleftwheelhub 36 |
      \- Vehicle_frontrightsteeringMotor 37 |
          \- Vehicle_frontrightsteeringMotorpart 38 |
              \- Vehicle_frontrightMotor 39 |
              \- Vehicle_frontrightwheelRespondable 40 |
                  \- Vehicle_frontrightwheelhub 41 | - 将对象`Vehicle_body`, `Vehicle_rearleftwheelhub`, `Vehicle_rearrightwheelhub`, 42 | `Vehicle_frontleftwheelhub`, `Vehicle_frontrightwheelhub`设置为可见,其余对象均为不可见。 43 | - 添加教程1-1用到的 44 | [脚本](https://github.com/bit-ivrc/vrep_tutorial/blob/master/demo1-1/script/script.txt),进行按键控制。注意修改脚本中对应关节的名字。 45 | - **开始仿真**,可以用键盘方向键控制小车运动。 46 | - 点击*File > Save model as* 导出模型。 47 | -------------------------------------------------------------------------------- /demo2-2/demo2-2.ttm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-2/demo2-2.ttm -------------------------------------------------------------------------------- /demo2-3/README.md: -------------------------------------------------------------------------------- 1 | # 教程2-3 2 | 本教程介绍三维建模软件Blender的安装和使用。使用Blender绘制道路模型,并将其导入VREP中形成可以进行仿真的道路。 3 | 图片素材、中将过程文件及完成文件均可在文件夹demo2-3/下找到。教程用到的图片素材 在demo2-3/texture/下获得,更多素材和模型可在demo2-3/other目录下找到。中间文件 ,Blender文件`road_segment.blend`在demo2-3/blender/下,OBJ文件`road_segment.obj`在demo2-3/obj/下。教程完成文件`demo2-3.ttm`,在文件夹demo2-3/下可以获得。 4 | 5 | **Note**: 本例通过obj格式文件与VREP进行文件交互,与STL格式文件相比,增加了模型的texture属性。 6 | 7 | ## 1 Blender的安装和使用 8 | ### 1.1 Blender的安装 9 | 到Blender[官网](https://www.blender.org/download/)下载和安装最新版本的Blender。教程中使用的Blender版本为Blender 2.79,环境为Ubuntu 16.04。 10 | 11 | ### 1.2 Blender的使用 12 | [这里](http://www.bilibili.com/video/av909518/)有非常详细地Blender中文视频教程。 13 | 14 | ### 1.3 道路模型 15 | 假设你已经具备使用Blender建模的能力。 16 | - 绘制一小段道路。 17 | - 添加材质。 18 | - 添加贴图。使用提供的图片素材。 19 | - 将模型导出为obj格式。*File > Export > Wavefront* 20 | 21 | **Note**: 注意obj格式的导出选项,为保证贴图存在,建议在*Path Mode* 中选择*Relative*。 22 | 23 | ## 2 模型导入VREP 24 | ### 2.1 让三维模型可参与仿真 25 | - 导入obj文件,步骤和[教程2-2](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo2-2)中导入STL文件过程类似。检查贴图是否存在。 26 | - 添加地板。obj模型默认只是可见,但不发生物理学关系。通过*Add > Primitive shape* 进行排列组合,形成可发生物理关系的地板。 27 | - 导出VREP模型文件。 28 | 29 | ### 2.2 模块化道路编辑 30 | 可以制作多个模块化的道路模型,如短直道、长直到、十字路口、T字路口等。为了方便的进行排列组合,需要对这些模型文件进一步的修改。 31 | - 在上一步的VREP道路模型的基础上添加Dummy点,用来代表模型的位置。最终文件为demo2-3/下的`road_segment.ttm`文件。 32 | - 编写排列道路组合模块。使用该模块对多个模块化的道路进行排列组合。bit-ivrc成员详见[此仓](https://github.com/bit-ivrc/autoSim-ivrc)中的内容。 33 | -------------------------------------------------------------------------------- /demo2-3/blender/road_segment.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/blender/road_segment.blend -------------------------------------------------------------------------------- /demo2-3/demo2-3.ttm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/demo2-3.ttm -------------------------------------------------------------------------------- /demo2-3/obj/road_segment.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'road_segment.blend' 2 | # Material Count: 3 3 | 4 | newmtl road 5 | Ns 96.078431 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.784314 0.784314 0.784314 8 | Ks 0.000000 0.000000 0.000000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | map_Kd ../texture/bksid_11.jpg 14 | map_Bump ../texture/nr_05B.jpg 15 | 16 | newmtl road_nr_05B.jpg 17 | Ns 96.078431 18 | Ka 1.000000 1.000000 1.000000 19 | Kd 0.784314 0.784314 0.784314 20 | Ks 0.000000 0.000000 0.000000 21 | Ke 0.000000 0.000000 0.000000 22 | Ni 1.000000 23 | d 1.000000 24 | illum 2 25 | map_Kd ../texture/nr_05B.jpg 26 | map_Bump ../texture/nr_05B.jpg 27 | 28 | newmtl sidewalk 29 | Ns 96.078431 30 | Ka 1.000000 1.000000 1.000000 31 | Kd 0.784314 0.784314 0.784314 32 | Ks 0.000000 0.000000 0.000000 33 | Ke 0.000000 0.000000 0.000000 34 | Ni 1.000000 35 | d 1.000000 36 | illum 2 37 | map_Kd ../texture/bksid_11.jpg 38 | map_Bump ../texture/bksid_11.jpg 39 | -------------------------------------------------------------------------------- /demo2-3/obj/road_segment.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.79 (sub 0) OBJ File: 'road_segment.blend' 2 | # www.blender.org 3 | mtllib road_segment.mtl 4 | o obj0.001 5 | v 8.190642 -0.070160 5.739978 6 | v 2.204838 -0.070160 2.747076 7 | v 2.204838 -0.070160 5.739978 8 | v 8.190642 -0.070160 2.747076 9 | v 2.204838 -0.070160 -0.245827 10 | v 8.190642 -0.070160 -0.245827 11 | v 8.190642 0.004662 2.747076 12 | v 8.190642 0.004662 5.739978 13 | v 8.190642 0.004662 -0.245827 14 | v 2.204838 0.004663 -0.245829 15 | v 2.204838 -0.070160 -0.245829 16 | v 2.204838 0.004663 2.747076 17 | v 2.204838 -0.070160 2.747076 18 | v 2.204838 0.004663 5.739978 19 | v 2.204838 -0.070160 5.739978 20 | v 2.179897 0.029603 -0.245829 21 | v -0.538656 0.029603 -0.245829 22 | v 2.179897 0.029603 2.747075 23 | v -0.538656 0.029603 2.747076 24 | v 2.179897 0.029603 5.739978 25 | v -0.538656 0.029603 5.739978 26 | v 8.215584 0.029603 5.739978 27 | v 8.215583 0.029603 2.747076 28 | v 10.934136 0.029603 2.747076 29 | v 10.934136 0.029603 5.739978 30 | v 8.215583 0.029603 -0.245827 31 | v 10.934136 0.029603 -0.245827 32 | vt 0.053279 0.903124 33 | vt 0.053155 0.398922 34 | vt 0.053279 -0.105258 35 | vt 0.076748 -0.105256 36 | vt 0.076647 0.398922 37 | vt 0.076773 0.903122 38 | vt 0.000000 -4.000000 39 | vt 0.000000 -4.500000 40 | vt 1.000000 -4.500000 41 | vt 1.000000 -4.000000 42 | vt 1.000000 -3.500000 43 | vt 0.000000 -3.500000 44 | vt 0.093135 -0.105281 45 | vt 0.946504 -0.105317 46 | vt 0.946650 0.398765 47 | vt 0.946845 0.903001 48 | vt 0.093161 0.903096 49 | vt 0.093049 0.398897 50 | vt 0.075506 1.106121 51 | vt 0.051161 1.106132 52 | vt 0.050279 0.592685 53 | vt 0.051009 0.079229 54 | vt 0.075352 0.079238 55 | vt 0.074623 0.592684 56 | vt 0.092317 0.079219 57 | vt 0.091618 0.592683 58 | vt 0.092471 1.106138 59 | vt 0.976454 0.079393 60 | vt 0.976092 0.592647 61 | vt 0.976599 1.105895 62 | vn -1.0000 0.0000 0.0000 63 | vn 0.0000 1.0000 0.0000 64 | vn 1.0000 0.0000 0.0000 65 | vn 0.7071 0.7071 0.0000 66 | vn -0.7071 0.7071 0.0000 67 | usemtl road 68 | s off 69 | f 6/1/1 4/2/1 1/3/1 8/4/1 7/5/1 9/6/1 70 | usemtl road_nr_05B.jpg 71 | f 2/7/2 3/8/2 1/9/2 4/10/2 6/11/2 5/12/2 72 | usemtl sidewalk 73 | f 22/13/2 25/14/2 24/15/2 27/16/2 26/17/2 23/18/2 74 | f 14/19/3 15/20/3 13/21/3 11/22/3 10/23/3 12/24/3 75 | f 12/24/4 10/23/4 16/25/4 18/26/4 20/27/4 14/19/4 76 | f 7/5/5 8/4/5 22/13/5 23/18/5 26/17/5 9/6/5 77 | f 16/25/2 17/28/2 19/29/2 21/30/2 20/27/2 18/26/2 78 | -------------------------------------------------------------------------------- /demo2-3/other/bksid_10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bksid_10.jpg -------------------------------------------------------------------------------- /demo2-3/other/bksid_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bksid_11.jpg -------------------------------------------------------------------------------- /demo2-3/other/bksid_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bksid_12.jpg -------------------------------------------------------------------------------- /demo2-3/other/bksid_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bksid_13.jpg -------------------------------------------------------------------------------- /demo2-3/other/bksid_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bksid_14.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump01B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump01B.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump01C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump01C.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump01S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump01S.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump02C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump02C.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump03B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump03B.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump03C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump03C.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump03S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump03S.jpg -------------------------------------------------------------------------------- /demo2-3/other/bump04C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/bump04C.jpg -------------------------------------------------------------------------------- /demo2-3/other/city_bump1.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/city_bump1.3ds -------------------------------------------------------------------------------- /demo2-3/other/city_bump2.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/city_bump2.3ds -------------------------------------------------------------------------------- /demo2-3/other/city_intersection.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/city_intersection.3ds -------------------------------------------------------------------------------- /demo2-3/other/city_intersectionUS.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/city_intersectionUS.3ds -------------------------------------------------------------------------------- /demo2-3/other/city_road.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/city_road.3ds -------------------------------------------------------------------------------- /demo2-3/other/cross01B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/cross01B.jpg -------------------------------------------------------------------------------- /demo2-3/other/cross01C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/cross01C.jpg -------------------------------------------------------------------------------- /demo2-3/other/cross01S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/cross01S.jpg -------------------------------------------------------------------------------- /demo2-3/other/cross02C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/cross02C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_08B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_08B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_08C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_08C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_08S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_08S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_10B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_10B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_10C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_10C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_10S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_10S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_11C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_11C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nrUS_12C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nrUS_12C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_05B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_05B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_05C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_05C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_05S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_05S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_06C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_06C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_07B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_07B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_07C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_07C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_07S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_07S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_08B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_08B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_08C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_08C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_08S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_08S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_09B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_09B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_09C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_09C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_09S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_09S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_10B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_10B.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_10C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_10C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_10S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_10S.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_11C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_11C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_12C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_12C.jpg -------------------------------------------------------------------------------- /demo2-3/other/nr_13C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/nr_13C.jpg -------------------------------------------------------------------------------- /demo2-3/other/or_city_bump1.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/or_city_bump1.3ds -------------------------------------------------------------------------------- /demo2-3/other/or_city_bump2.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/or_city_bump2.3ds -------------------------------------------------------------------------------- /demo2-3/other/or_city_intersection.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/or_city_intersection.3ds -------------------------------------------------------------------------------- /demo2-3/other/or_city_intersectionUS.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/or_city_intersectionUS.3ds -------------------------------------------------------------------------------- /demo2-3/other/or_city_road.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/other/or_city_road.3ds -------------------------------------------------------------------------------- /demo2-3/texture/bksid_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/texture/bksid_11.jpg -------------------------------------------------------------------------------- /demo2-3/texture/nr_05B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-3/texture/nr_05B.jpg -------------------------------------------------------------------------------- /demo2-4/README.md: -------------------------------------------------------------------------------- 1 | # 教程2-4 2 | 本教程介绍使用三维建模软件Blender绘制盘山公路的基本步骤,然后将三维模型导入VREP,将公路变成实体,添加**教程1-1**搭建的[VREP小车模型](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo1-1), `demo1-1.ttm`进行仿真。 3 | 图片素材、中将过程文件及完成文件均可在文件夹demo2-4/下找到。教程用到的图片素材 在demo2-4/texture/下获得。中间文件,Blender文件在demo2-3/blender/下,OBJ文件在demo2-3/obj/下。教程完成文件`demo2-4.ttm`,在文件夹demo2-4/下可以获得。 4 | 5 | 6 | 7 | ## 1 Blender盘山公路建模 8 | 这部分可参考[视频教程](https://www.youtube.com/watch?v=BJeV8djtlyU),下面整理主要步骤。 9 | 10 | ### 1.1 建立一小段路 11 | 可使用教程2-3完成的[Blender道路模型](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo2-3/blender), `road_segment.blend`进行接下来的工作。 12 | 13 | ### 1.2 雕刻一座小山 14 | - 添加网格。 15 | - 进入雕刻模式进行小山的雕刻。 16 | - 平滑处理和细分表面。 17 | 18 | ### 1.3 形成盘山公路 19 | - 添加曲线,调整道路形状。曲线形状要和山地相匹配。 20 | - 添加一个平面(plane),让这个平面沿着曲线重复。*Add modifier > Array*, *Add modifier > Curve*。 21 | - 让平面与山地产生包裹。*Add modifier > Shrinkwrap*。 22 | - 进行道路形状位置的 调整。 23 | - 进行平滑处理。 24 | - 让一小段路和平面一样,沿着曲线重复。*Add modifier > Array*, *Add modifier > Curve*。 25 | - 进行调整,应用这些modifier,最后导出OBJ文件。*File > Export > Wavefront* 26 | 27 | **Note**: 我们现在有三个网格构成的实体,分别是山地、平面沿曲线重复形成的道路、一小段路沿平面形成的道路,为便于描述,分别记为实体1、实体2、实体3。 28 | 29 | ## 2 模型导入VREP 30 | ### 2.1 让道路可以参与仿真 31 | - 导入obj文件.注意检查贴图是否存在,是否清晰。 32 | - 可以看到导入了3个实体,打开实体3属性对话框,点击*Show dynamic properties dialog*,勾选*Body is respondable*。 33 | 34 | ### 2.2 进行仿真 35 | - 添加**教程1-1**搭建的[VREP小车模型](https://github.com/bit-ivrc/vrep_tutorial/tree/master/demo1-1), `demo1-1.ttm`。 36 | - 调整小车的大小和位置,使与道路大小匹配。 37 | - **开始仿真**,可以用键盘方向键控制小车沿着盘山公路行驶,并通过多个窗口观察小车运动情况。 38 | -------------------------------------------------------------------------------- /demo2-4/blender/terrain.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-4/blender/terrain.blend -------------------------------------------------------------------------------- /demo2-4/demo2-4.ttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-4/demo2-4.ttt -------------------------------------------------------------------------------- /demo2-4/obj/terrain.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'terrain.blend' 2 | # Material Count: 3 3 | 4 | newmtl Material.002 5 | Ns 96.078431 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.640000 0.640000 0.640000 8 | Ks 0.399551 0.399551 0.399551 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | 14 | newmtl Material.003 15 | Ns 96.078431 16 | Ka 1.000000 1.000000 1.000000 17 | Kd 0.640000 0.640000 0.640000 18 | Ks 0.500000 0.500000 0.500000 19 | Ke 0.000000 0.000000 0.000000 20 | Ni 1.000000 21 | d 1.000000 22 | illum 2 23 | 24 | newmtl road 25 | Ns 96.078431 26 | Ka 1.000000 1.000000 1.000000 27 | Kd 0.640000 0.640000 0.640000 28 | Ks 0.500000 0.500000 0.500000 29 | Ke 0.000000 0.000000 0.000000 30 | Ni 1.000000 31 | d 1.000000 32 | illum 2 33 | map_Kd ../texture/nr_05B.jpg 34 | -------------------------------------------------------------------------------- /demo2-4/texture/nr_05B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bit-ivrc/vrep_tutorial/a4853c1519512dcbda22f1676e7bc728a5a80f36/demo2-4/texture/nr_05B.jpg --------------------------------------------------------------------------------