2021年3月15日 星期一

[ROS] URDF: 解決 Gazebo 模擬 Camera 時的錯誤

使用 Gazebo 模擬 Camera,在讀取 Camera 影像時會報錯:

 

gzserver: /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreRenderSystem.cpp:546: virtual void Ogre::RenderSystem::setDepthBufferFor(Ogre::RenderTarget*): Assertion `bAttached && "A new DepthBuffer for a RenderTarget was created, but after creation" "it says it's incompatible with that RT"' failed.

Aborted (core dumped)

[gazebo-2] process has died [pid 13762, exit code 134, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -e ode /home/ros/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/worlds/turtlebot3_world.world __name:=gazebo __log:=/home/ros/.ros/log/f9912bf6-854e-11eb-a61c-08002750e906/gazebo-2.log].

log file: /home/ros/.ros/log/f9912bf6-854e-11eb-a61c-08002750e906/gazebo-2*.log

 

2021年2月19日 星期五

[ROS] URDF: 慣性張量的效果演示

四個相同質量、相同半徑的物體,使用 Gazebo 模擬滾下坡道,由於四個物體的轉動慣量不同,最後導致滾下的速度有快有慢。

 

  1. Spherical Shell
  2. Solid Sphere
  3. Cylindrical Ring
  4. Solid Cylinder

 

[ROS] URDF: 實心圓柱模型 (Solid Cylinder)

URDF code for solid cylinder:

<robot name="solid_cylinder">

 

<link name="link1">

  <visual>

    <geometry>

      <cylinder radius="0.5" length="1" />

    </geometry>

  </visual>

  <inertial>

    <mass value="10"/>

    <inertia ixx="1.46" ixy="0" ixz="0" iyy="1.46" iyz="0" izz="1.25" />

  </inertial>

  <collision>

    <geometry>

      <cylinder radius="0.5" length="1" />

    </geometry>

  </collision>

</link>

 

<gazebo reference="link1">

  <material>Gazebo/Green</material>

</gazebo>

 

</robot>

 

[ROS] URDF: 圓柱管模型 (Cylindrical Ring)

URDF code for cylindrical ring:

<robot name="cylindrical_ring">

 

<link name="link1">

  <visual>

    <geometry>

      <cylinder radius="0.5" length="1" />

    </geometry>

  </visual>

  <inertial>

    <mass value="10"/>

    <inertia ixx="1.86" ixy="0" ixz="0" iyy="1.86" iyz="0" izz="2.05" />

  </inertial>

  <collision>

    <geometry>

      <cylinder radius="0.5" length="1" />

    </geometry>

  </collision>

</link>

 

<gazebo reference="link1">

  <material>Gazebo/Yellow</material>

</gazebo>

 

</robot>

 

[ROS] URDF: 實心球模型 (Solid Sphere)

URDF code for solid sphere:

<robot name="solid_sphere">

 

<link name="link1">

  <visual>

    <geometry>

      <sphere radius="0.5" />

    </geometry>

  </visual>

  <inertial>

    <mass value="10"/>

    <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" />

  </inertial>

  <collision>

    <geometry>

      <sphere radius="0.5" />

    </geometry>

  </collision>

</link>

 

<gazebo reference="link1">

  <material>Gazebo/Orange</material>

</gazebo>

 

</robot>

 

[ROS] URDF: 空心球模型 (Spherical Shell)

URDF code for spherical shell:

<robot name="spherical_shell">

 

<link name="link1">

  <visual>

    <geometry>

      <sphere radius="0.5" />

    </geometry>

  </visual>

  <inertial>

    <mass value="10"/>

    <inertia ixx="1.67" ixy="0" ixz="0" iyy="1.67" iyz="0" izz="1.67" />

  </inertial>

  <collision>

    <geometry>

      <sphere radius="0.5" />

    </geometry>

  </collision>

</link>

 

<gazebo reference="link1">

  <material>Gazebo/Red</material>

</gazebo>

 

</robot>

 

2021年1月18日 星期一

[ROS] Gazebo: 解決無法開啟並顯示 waiting 的問題

使用 Gazebo 開啟一個 world 文件,結果 Gazebo 卡住並且顯示 waiting 訊息,如下:

 

waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...

 

[ROS] Gazebo: 下載模型文件

Gazebo 裡面有許多現成的模型可以使用,不過第一次使用時,這些模型文件都放在伺服端。只有當我們點選某個模型之後,才會從伺服端下載該模型文件。如果這個模型文件比較大,就會需要比較長的時間進行下載,有時候會看到 Gazebo 停住,好像掛掉了,其實只是在等待模型文件下載到本機端。

 

2020年12月29日 星期二

[ROS] RViz: 修正透明度 (transparency) 顯示

在練習 urdf_tutorial 範例的時候,範例 04-materials.urdf 裡面,如下定義 material "blue" "white" 這兩個 color alpha 值都是 1

 

-- urdf_tutorial/urdf/04-materials.urdf

  … …

  <material name="blue">

    <color rgba="0 0 0.8 1"/>

  </material>

 

  <material name="white">

    <color rgba="1 1 1 1"/>

  </material>

  … …

 

[ROS] Gazebo: 使用 Building Editor 建立建物模型

啟動 Gazebo

$ gazebo

 

在【Edit】選單上,點選【Building Editor】或按下【Ctrl+B】打開編輯器。

 

2020年12月28日 星期一

[ROS] Gazebo: 開啟 turtlebot3_burger 的 SDF 模型

設定 GAZEBO_MODEL_PATH 環境變數

 

因為 turtlebot3_burger SDF 模型位於:

 

~/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models

 

必須把這個路徑添加到 GAZEBO_MODEL_PATH 環境變數,執行指令:

 

$ export GAZEBO_MODEL_PATH=~/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models:${GAZEBO_MODEL_PATH}

 

[ROS] Gazebo: 開啟 turtlebot3_world.world

直接使用 Gazebo 指令開啟

 

使用 Gazebo 開啟 turtlebot3_gazebo 套件中的 turtlebot3_world.world,執行指令:

 

$ roscd turtlebot3_gazebo

$ gazebo worlds/turtlebot3_world.world

 

2020年11月4日 星期三

[ROS] roslaunch: <test> 標籤的用法

<test> 標籤在語法上和 <node> 標籤很相似,他們都是用來指定要運行的 ROS 節點,雖然 <test> 標籤指定的是要運行的測試節點。更多關於測試節點的資訊,請參考 rostest 文件。

 

[ROS] roslaunch: if 和 unless 屬性

這兩個屬性算是比較特別的,所有的標籤都支援這兩個屬性。使用這兩個屬性的標籤,會根據 if/unless 屬性值的運算結果 ("true" "false"),來決定該標籤被引入 (include) 或排除 (exclude)

 

2020年11月3日 星期二

[ROS] roslaunch: <arg> 標籤的用法

使用 <arg> 標籤可以宣告一些 arg 參數,這些參數有點像是 launch 文件裡面的區域變數。除了可以直接在 launch 文件指定參數值之外,還可以從命令列或是 <include> 標籤帶入參數值,讓 launch 文件能夠更加靈活的配置與運用。

 

[ROS] roslaunch: <machine> 標籤的用法

<machine> 標籤可以用來宣告一台設備,以便可以在這台設備上啟動節點。若你只要在本地端啟動所有的節點,就不需要使用到此標籤。這個 <machine> 標籤主要用來宣告遠端設備的 SSH 登入和環境變數等設定。

 

[ROS] roslaunch: <remap> 標籤的用法

使用 <remap> 標籤可以對一個名稱進行重新映射 (remapping),有點像是把一個名稱改為另外一個名稱,在某些情況下是很方便的小技巧。舉例來說,有一個節點訂閱或發佈一個主題,但是簡單的透過 <remap> 標籤的設定,就可以讓這個節點實際訂閱或發佈到另外一個主題。

 

2020年11月2日 星期一

[ROS] roslaunch: <node> 標籤的用法

可以使用 <node> 標籤來指定你想要啟動的節點,這是最常使用的 roslaunch 標籤。在使用 <node> 標籤時,有一點必須要特別注意,就是 roslaunch 不保證節點的啟動順序,也就是節點不一定會依照在 Launch 文件中編排的順序來啟動。這是可以理解的,因為節點的初始化需要一些時間,而每個節點初始化的時間不一樣,roslaunch 從程式外部無法得知節點初始化的狀況。所以,必須自行確保撰寫的 Launch 文件夠嚴謹,不管節點以任何的順序執行都要能夠正常啟動。

 

2020年10月30日 星期五

[ROS] roslaunch: 在新的 Terminal 視窗啟動節點

使用 roslaunch 啟動節點時,預設所有節點都使用相同的 Terminal 視窗。若要開啟新的 Terminal 視窗來啟動節點,可以使用 <node> 標籤的 launch-prefix 屬性。如下所示,依據使用的 Terminal 來做設定。

 

[ROS] roslaunch: <group> 標籤的用法

當你想要把設定套用在一組節點上的時候,使用 <group> 標籤將會方便許多。它具有 ns 屬性,可以讓你將這組節點放到個別的命名空間中。另外,還可以使用 <remap> 標籤,對整組節點套用重新映射的設定。

 

和我聯絡

名稱

以電子郵件傳送 *

訊息 *