机器人仿真软件 V-REP学习记录(一) -- 复现BubbleRob

本来没有复盘计划的,但是第一遍复现没有成功,故重新审核一遍,顺便把教程捞一下

0 想到什么补充什么

1.材料: BubbleRob tutorial案例

1.项目拆分

  1. 建立球体
  2. 建立

2.常见不熟词汇

  • texture:名词:质地,理 动词:组织,组成

1 We will start with the body (主体)

  1. We add a primitive sphere of diameter 0.2 to the scene
  2. We adjust the X-size item to 0.2,
  3. be dynamic and respondable (这样球体可以在环境运动)
  4. we enable Collidable, Measurable, Renderable and Detectable (可被其他模块检测处理)
  5. BubbleRob’s body – enter 0.02 for Along Z
  6. we double-click the sphere’s name — edit its name

2 we will add a proximity sensor(接近传感器)

  • so that BubbleRob knows when it is approaching obstacles
  1. we select [Menu bar --> Add --> Proximity sensor --> Cone type]
  2. on the orientation tab, we enter 90 for Around Y and for Around Z
  3. on the position tab, we enter 0.1 for X-coord. and 0.12 for Z-coord.
  4. The proximity sensor is now relative to BubbleRob’s body.
  5. We adjust items Offset to 0.005, Angle to 30 and Range to 0.15.
  6. We uncheck item Don’t allow detections if distance smaller than
  7. edit its name. We enter bubbleRob_sensingNose
  8. attaches the sensor to the body of the robot – 建立父子关系

3 we will take BubbleRob’s wheels(建轮子)

  1. We create a new scene (新环境建好了轮子再复制回去)
  2. We add a pure primitive cylinder with dimensions (0.08,0.08,0.02)
  3. we enable Collidable, Measurable, Renderable and Detectable
  4. we set the cylinder’s absolute position to (0.05,0.1,0.04)
  5. and its absolute orientation to (-90,0,0)
  6. We change the name to bubbleRob_leftWheel
  7. We copy and paste the wheel,set the absolute Y coordinate of the copy to -0.1
  8. We rename the copy to bubbleRob_rightWheel.
  9. We copy them, then back to scene 1, then paste the wheels.

4 We now need to add joints(添加电机)

  1. We click [Menu bar --> Add --> Joint --> Revolute]
  2. 将电机和轮子位置方向合并 — 并习惯将电机设置到隐藏层
  3. We rename the joint to bubbleRob_leftMotor
  4. We enable the motor,
  5. and check item Lock motor when target velocity is zero(静态锁住电机)
  6. We now repeat the same procedure for the right motor
  7. we attach the left wheel to the left motor,right wheel to right motor
  8. attach the two motors to bubbleRob

5 We need third contact point to the floor(支点)

  1. We now add a small slider (or caster) with diameter 0.05
  2. make the sphere Collidable, Measurable, Renderable and Detectable
  3. rename it to bubbleRob_slider.
  4. We set the Material to noFrictionMaterial
  5. we add a force sensor object [Menu bar --> Add --> Force sensor].
  6. We rename it to bubbleRob_connection and shift it up by 0.05
  7. We attach the slider to the force sensor
  8. We then shift the force sensor by -0.07 along the absolute X-axis,
  9. then attach it to the robot body.
  10. To avoid strange effects during dynamics simulation — for bubbleRob_slider we set the local respondable mask to 00001111, and for bubbleRob, we set the local respondable mask to 11110000.
    设置电机速度,仿真后发现能动
  11. We select the two wheels and the slider —in the shape dynamics dialog we click three times M=M*2 (for selection)
  12. we set the Target velocity to 50 for both motors. We run the simulation

6 we define a collection of objects(信息采集)

  1. we define a collection object. We click [Menu bar --> Tools --> Collections]
  2. we click Add new collection.
  3. While the new collection item is selected in the list, select bubbleRob in the scene hierarchy, and then click Add in the collection dialog
  4. edit the collection name

7 track the minimum distance between BubbleRob and any other object.(测距)

  1. [Menu bar --> Tools --> Calculation module properties].
  2. Add new distance object and select a distance pair:
  3. We rename the distance object to bubbleRob_distance

8 we add a graph object(添加显示图)

  1. We click [Menu bar --> Add --> Graph]
  2. rename it to bubbleRob_graph
  3. We attach the graph to bubbleRob, and set the graph’s absolute coordinates to (0,0,0.005)
  4. We uncheck Display XYZ-planes,
  5. then click Add new data stream to record and select Object:
  6. absolute x-position for the Data stream type, and bubbleRob_graph for the Object / item to record (重复添加yz)
  7. We are able to track the minimum distance(添加距离数据流)
  8. we now rename Data to bubbleRob_x_pos, Data0 to bubbleRob_y_pos, Data1 to bubbleRob_z_pos, and Data2 to bubbleRob_obstacle_dist.
  9. We select bubbleRob_x_pos in the Data Stream recording list and in the Time graph properties section, uncheck Visible. We do the same for bubbleRob_y_pos and bubbleRob_z_pos. (xyz坐标将再3D显示)
  10. we will set-up a 3D curve that displays BubbleRob’s trajectory ,We rename the newly added curve from Curve to bubbleRob_path

9 We add cylinder (添加柱子)

  1. We add cylinder with following dimensions: (0.1, 0.1, 0.2)
  2. we disable Body is dynamic
  3. We to be Collidable, Measurable, Renderable and Detectable.
  4. We copy and paste the cylinder a few times, and move them to positions around BubbleRob(复制粘贴,把小球围上)
    直接设置速度可以工作 – 应该是代码问题

10 We now need to finish BubbleRob as a model definition****

  1. We select the model base
  2. then check items Object is model base and Object/model can transfer or accept DNA
  3. We select the two joints, the proximity sensor and the graph, then enable item Ignored by model bounding box and click Apply to selection?
  4. we disable camera visibility layer 2, and enable camera visibility layer 10 for the two joints and the force sensor:(隐藏电机和力传感器)

11 we will add a vision sensor,

  1. [Menu bar --> Add --> Vision sensor --> Perspective type],
  2. attach the vision sensor to the proximity sensor,
  3. set the local position and orientation of the vision sensor to (0,0,0).
  4. We also make sure the vision sensor is not not visible, not part of the model bounding box
  5. We add a floating view to the scene,
  6. [Popup menu --> View --> Associate view with selected vision sensor]
  7. 注意:千万不要把传感器嵌入到球里,放到表面即可(就像在安装摄像头)

12 问题与解决

  1. 视觉传感器不显示图像:因为把传感器嵌在球里了
  2. 小车启动立马翻车:将距离传感器数据打印后发现一直是1,说明距离传感器也嵌在球里了。
  3. 拉出传感器后后退还是会翻车:猜测是自己支点球放的位置不好,故差速太大就会翻车,减小速度后发现可以正常工作,假设正确
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值