日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Gazebo使用笔记(6) —— 摩擦力特性与碰撞位掩码

發布時間:2024/3/12 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Gazebo使用笔记(6) —— 摩擦力特性与碰撞位掩码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 1. 平移摩擦
        • 摩擦力的工作原理
        • SDF中指定摩擦
  • 2. 轉動摩擦
        • 轉動摩擦方程:
            • SDF參數
            • 默認值
        • SDF中的設置
  • 3. 碰撞位掩碼
        • 介紹
        • 碰撞位掩碼設置
        • 默認值

1. 平移摩擦

Gazebo的物理引擎(如ODE,Bullet,Simbody,DART)都有不同的摩擦模型,摩擦力參數列表可參見傳送門。

假設使用的默認物理引擎ODE

摩擦力的工作原理

ODE中由兩部分組成,mu和mu2,ODE將自動計算第一、第二摩擦方向:

  • mu是第一摩擦方向的庫倫摩擦系數
  • mu2是垂直于第一摩擦方向的第二摩擦方向摩擦系數

兩個對象發生碰撞,Gazebo將從兩個對象中選擇最小的mu和mu2。

mu和mu2的范圍為任何非負數,where,0表示無摩擦接觸,較大值表示具有無限摩擦的表面。

各種材料的摩擦特性可從工程工具箱獲取

SDF中指定摩擦

栗子1:

<model name="box"><pose>0 0 0.5 0 0 0</pose><link name="link"><collision name="collision"><geometry><box><size>1 1 1</size></box></geometry><surface><!--###########################--><friction><ode><mu>0.01</mu><mu2>0.01</mu2></ode></friction> <!--###########################--></surface></collision><visual name="visual"><geometry><box><size>1 1 1</size></box></geometry></visual></link> </model>

栗子2:

<sdf version="1.4"><world name="default"><scene><ambient>1.000000 1.000000 1.000000 1.000000</ambient><background>0.700000 0.700000 0.700000 1.000000</background><shadows>1</shadows></scene><physics type="ode"><gravity>0.000000 -1.000000 -1.000000</gravity><ode><solver><type>quick</type><iters>50</iters><precon_iters>0</precon_iters><sor>1.300000</sor></solver><constraints><cfm>0.000000</cfm><erp>0.200000</erp><contact_max_correcting_vel>100.000000</contact_max_correcting_vel><contact_surface_layer>0.001000</contact_surface_layer></constraints></ode><real_time_update_rate>0.000000</real_time_update_rate><max_step_size>0.001000</max_step_size></physics><model name="gplane"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><link name="plane"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><collision name="plane"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><plane><normal>0.000000 0.000000 1.000000</normal></plane></geometry><surface><friction><ode><mu>50.000000</mu><mu2>50.000000</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>1000000000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>1</static></model><model name="box_01_model"><allow_auto_disable>0</allow_auto_disable><pose>2.000000 8.000000 0.500000 0.000000 -0.000000 0.000000</pose><link name="box_01_body"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><inertial><pose>0.000000 0.000000 -0.500000 0.000000 -0.000000 0.000000</pose><inertia><ixx>10.000000</ixx><ixy>0.000000</ixy><ixz>0.000000</ixz><iyy>10.000000</iyy><iyz>0.000000</iyz><izz>10.000000</izz></inertia><mass>1.000000</mass></inertial><collision name="box_01_geom"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><surface><friction><ode><mu>0.998000</mu><mu2>0.998000</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>100000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><visual name="box_01_geom_visual"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><material><script>Gazebo/Rocky</script></material><cast_shadows>1</cast_shadows><laser_retro>0.000000</laser_retro><transparency>0.000000</transparency></visual><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>0</static></model><model name="box_02_model"><allow_auto_disable>0</allow_auto_disable><pose>4.000000 8.000000 0.500000 0.000000 -0.000000 0.000000</pose><link name="box_02_body"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><inertial><pose>0.000000 0.000000 -0.500000 0.000000 -0.000000 0.000000</pose><inertia><ixx>10.000000</ixx><ixy>0.000000</ixy><ixz>0.000000</ixz><iyy>10.000000</iyy><iyz>0.000000</iyz><izz>10.000000</izz></inertia><mass>1.000000</mass></inertial><collision name="box_02_geom"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><surface><friction><ode><mu>0.998500</mu><mu2>0.998500</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>100000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><visual name="box_02_geom_visual"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><material><script>Gazebo/Rocky</script></material><cast_shadows>1</cast_shadows><laser_retro>0.000000</laser_retro><transparency>0.000000</transparency></visual><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>0</static></model><model name="box_03_model"><allow_auto_disable>0</allow_auto_disable><pose>6.000000 8.000000 0.500000 0.000000 -0.000000 0.000000</pose><link name="box_03_body"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><inertial><pose>0.000000 0.000000 -0.500000 0.000000 -0.000000 0.000000</pose><inertia><ixx>10.000000</ixx><ixy>0.000000</ixy><ixz>0.000000</ixz><iyy>10.000000</iyy><iyz>0.000000</iyz><izz>10.000000</izz></inertia><mass>1.000000</mass></inertial><collision name="box_03_geom"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><surface><friction><ode><mu>0.999000</mu><mu2>0.999000</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>100000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><visual name="box_03_geom_visual"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><material><script>Gazebo/Rocky</script></material><cast_shadows>1</cast_shadows><laser_retro>0.000000</laser_retro><transparency>0.000000</transparency></visual><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>0</static></model><model name="box_04_model"><allow_auto_disable>0</allow_auto_disable><pose>8.000000 8.000000 0.500000 0.000000 -0.000000 0.000000</pose><link name="box_04_body"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><inertial><pose>0.000000 0.000000 -0.500000 0.000000 -0.000000 0.000000</pose><inertia><ixx>10.000000</ixx><ixy>0.000000</ixy><ixz>0.000000</ixz><iyy>10.000000</iyy><iyz>0.000000</iyz><izz>10.000000</izz></inertia><mass>1.000000</mass></inertial><collision name="box_04_geom"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><surface><friction><ode><mu>0.999500</mu><mu2>0.999500</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>100000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><visual name="box_04_geom_visual"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><material><script>Gazebo/Rocky</script></material><cast_shadows>1</cast_shadows><laser_retro>0.000000</laser_retro><transparency>0.000000</transparency></visual><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>0</static></model><model name="box_05_model"><allow_auto_disable>0</allow_auto_disable><pose>10.000000 8.000000 0.500000 0.000000 -0.000000 0.000000</pose><link name="box_05_body"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><inertial><pose>0.000000 0.000000 -0.500000 0.000000 -0.000000 0.000000</pose><inertia><ixx>10.000000</ixx><ixy>0.000000</ixy><ixz>0.000000</ixz><iyy>10.000000</iyy><iyz>0.000000</iyz><izz>10.000000</izz></inertia><mass>1.000000</mass></inertial><collision name="box_05_geom"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><surface><friction><ode><mu>1.000000</mu><mu2>1.000000</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>100000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><visual name="box_05_geom_visual"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><material><script>Gazebo/Rocky</script></material><cast_shadows>1</cast_shadows><laser_retro>0.000000</laser_retro><transparency>0.000000</transparency></visual><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>0</static></model><model name="box_06_model"><allow_auto_disable>0</allow_auto_disable><pose>12.000000 8.000000 0.500000 0.000000 -0.000000 0.000000</pose><link name="box_06_body"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><inertial><pose>0.000000 0.000000 -0.500000 0.000000 -0.000000 0.000000</pose><inertia><ixx>10.000000</ixx><ixy>0.000000</ixy><ixz>0.000000</ixz><iyy>10.000000</iyy><iyz>0.000000</iyz><izz>10.000000</izz></inertia><mass>1.000000</mass></inertial><collision name="box_06_geom"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><surface><friction><ode><mu>1.010000</mu><mu2>1.010000</mu2><fdir1>0.000000 0.000000 0.000000</fdir1><slip1>0.000000</slip1><slip2>0.000000</slip2></ode></friction><bounce><restitution_coefficient>0.000000</restitution_coefficient><threshold>100000.000000</threshold></bounce><contact><ode><soft_cfm>0.000000</soft_cfm><soft_erp>0.200000</soft_erp><kp>100000.000000</kp><kd>1.000000</kd><max_vel>100.000000</max_vel><min_depth>0.001000</min_depth></ode></contact></surface><laser_retro>0.000000</laser_retro></collision><visual name="box_06_geom_visual"><pose>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</pose><geometry><box><size>1.000000 1.000000 1.000000</size></box></geometry><material><script>Gazebo/Rocky</script></material><cast_shadows>1</cast_shadows><laser_retro>0.000000</laser_retro><transparency>0.000000</transparency></visual><gravity>1</gravity><self_collide>0</self_collide><kinematic>0</kinematic></link><static>0</static></model></world> </sdf>

2. 轉動摩擦

注意:轉動摩擦當前僅適用于ODE物理引擎

轉動摩擦方程:

轉動摩擦的扭矩是根據接觸深度和表面半徑計算的,具體參考傳送門:

T = 3*PI/16 * a * coefficient * N a = sqrt(R * d)

where,

  • 3*PI/16:常數≈0.589
  • T:由于轉動摩擦產生的扭矩
  • N:接觸時的法向力
  • 系數:轉動摩擦系數,通常與平移摩擦系數mu和mu2相同
  • a:接觸面半徑(patch_radius in SDF),這是表面之間的接觸區域的半徑。平面頂部的球體會生成一個圓形的補丁區域,該區域取決于球體半徑和接觸深度
  • R:接觸點表面半徑(patch_radius in SDF)
  • d:接觸深度

由上可知,與平移摩擦不同,扭轉摩擦不僅取決于法向力和摩擦系數。它還取決于表面之間的接觸面積。

SDF參數

SDF提供了兩種參數化接觸表面的方法。 用戶可以定義一個patch_radius(上面的a)(與接觸深度無關)總是相同的,也可以定義一個surface_radius(上面的R)(與接觸深度一起使用)。 請注意,在這兩種情況下,用戶都為整個曲面指定了一個值,因此為非球形曲面選取值可能需要微調。

要在方法之間進行選擇,可以將patch_radius的use_patch_radius標簽設置為true,而將surface_radius設置為false,或反之。

默認值
  • coefficient:和mu,mu2一樣,默認值為1.0
  • use_patch_radius:默認值為true,因此patch_radius使用。
  • patch_radius:默認值為0,因此即使coefficient設置為零,也不會出現扭轉摩擦。
  • surface_radius:默認值為0,因此即使coefficient設置為零,也不會存在扭轉摩擦。

SDF中的設置

<model ...>...<link ...><collision ...>...<surface> <!--##################################--><friction><torsional><coefficient>1.0</coefficient><surface_radius>0.5</surface_radius><use_patch_radius>false</use_patch_radius></torsional></friction> <!--##################################-->...</surface></collision></link> </model>

測試:

gazebo -u worlds/torsional_friction_demo.world

3. 碰撞位掩碼

介紹

位掩碼是與某個對象相關聯的數字,通常以十六進制指定。

假設對象是碰撞幾何。當比較兩個位掩碼時,通過按位與運算,結果將用于控制所應用的邏輯。

  • BoxA:01
  • BoxB:10
  • BoxC:11
gazebo -u worlds/shapes_bitmask.world

C(最頂端)→B(中)→A(最底端),仿真結果:boxA和boxB將發生碰撞。但按位及其位掩碼將產生零值。這表明,以仿真引擎,碰撞也應該被忽略,其結果是盒B通過BOXA。此時,boxA和boxB都位于同一地點并擱在地面上。同時,boxC從其起始位置下降。BoxC最終會命中boxA和boxB。boxC的位掩碼的按位與和以及屬于boxA和boxB的位掩碼將導致一個大于零的值。這個非零的結果,也被編程語言視為“ true”,它向模擬引擎指示應該生成沖突。結果是boxC將停留在boxA和boxB的頂部。

碰撞位掩碼設置

<model name="box"><link name="link"><collision name="collision"><geometry> ... </geometry><surface><contact><collide_bitmask>0x01</collide_bitmask></contact></surface></collision><visual name="visual"> ... </visual></link> </model>

默認值

每個幾何體(包括接地平面)的碰撞位掩碼的默認值為0xffff。您可以將高16位用于不想與接地層碰撞的對象以及其他默認對象。


參考文獻:

  • http://gazebosim.org/tutorials?tut=friction&cat=physics
  • http://gazebosim.org/tutorials?tut=torsional_friction&cat=physics
  • http://gazebosim.org/tutorials?tut=collide_bitmask&cat=physics

總結

以上是生活随笔為你收集整理的Gazebo使用笔记(6) —— 摩擦力特性与碰撞位掩码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。