如何在MATLAB中使用碰撞检测

如何在MATLAB中使用碰撞检测

工具/原料

  • MATLAB
  • 电脑

方式/步骤

  1. 1

    号令行键入:

    w = vrworld('vrcollisions');

    def72c6c576699cfbdaad8d1a885e036e3915e4c.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  2. 2

    号令行键入:

    open(w);

    91091efc77f7980e51dab4c3d4db3620b83a914c.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  3. 3

    号令行键入:

    fig = view(w, '-internal');

    a9338a1fbee434dac9a4bd91f271fe1d97d8e44c.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  4. 4

    号令行键入:

    col = vrnode(w,'Collision_Sensor')

    18aebc5f0c14c27bb478713b2a46b7b1eff9394d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  5. 5

    号令行键入:

    rob = vrnode(w,'Robot')

    b955ead0b503c8d23804b0fc498333bf3aef214d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  6. 6

    号令行键入:

    color = vrnode(w,'Robot_color')

    b1454a1bd10ff226f460c6bc9c99e92abbb8a44d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  7. 7

    号令行键入:

    col.isActive

    for ii = 1:30

    % Move robot

    rob.translation = rob.translation + [0.05 0 0];

    vrdrawnow

    % If collision is detected, change color to red.

    if col.isActive

    color.diffuseColor = [1 0 0];

    end

    end

    3bcdb808a50f94fc71776c7c4cf88a775cddfc4d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  • 发表于 2020-05-06 17:01
  • 阅读 ( 432 )
  • 分类:其他类型

相关问题

0 条评论

请先 登录 后评论