Main Content

importrobot

URDF ファイル、Xacro ファイル、SDF ファイル、テキストまたは Simscape Multibody モデルから剛体ツリー モデルをインポート

説明

URDF、Xacro、または SDF のインポート

robot = importrobot(filename) は、filename によって指定された Unified Robot Description Format (URDF)、XML Macros (Xacro)、または Simulation Description Format (SDF) ファイルを解析することにより、rigidBodyTree オブジェクトを返します。

robot = importrobot(text) は、URDF、Xacro、または SDF テキストのロボット記述を解析します。

robot = importrobot(___,format) は、前述の構文の入力引数の任意の組み合わせに加え、ロボットの記述のタイプを明示的に指定します。テキスト ファイルの形式が format 引数で指定された形式と一致しない場合、この関数はエラーを返します。

robot = importrobot(___,Name,Value) は、前述の構文の入力引数の任意の組み合わせに加え、1 つ以上の名前と値のペアの引数を使用してオプションを指定します。URDF ファイル、Xacro ファイル、SDF ファイル、またはテキストからモデルをインポートするには、名前と値のペアURDF、Xacro、または SDF のインポートを使用します。

Simscape Multibody モデルのインポート

[robot,importInfo] = importrobot(model) は、Simscape™ Multibody™ モデルをインポートして、等価の rigidBodyTree オブジェクトおよびインポートに関する情報を importInfo に返します。出力される rigidBodyTree オブジェクトでは、固定ジョイント、直進ジョイントおよび回転ジョイントのみがサポートされています。

[robot,importInfo] = importrobot(___,Name,Value) は、前述の構文からの Simscape Multibody モデルに加え、1 つ以上の名前と値のペアの引数を使用してオプションを指定します。その他のジョイント タイプ、拘束ブロックまたは可変慣性を使用するモデルをインポートするには、Simscape Multibody モデルのインポートの名前と値のペアを使用します。

すべて折りたたむ

URDF ファイルを rigidBodyTree オブジェクトとしてインポートします。

robot = importrobot('iiwa14.urdf')
robot = 
  rigidBodyTree with properties:

     NumBodies: 10
        Bodies: {[1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]  [1x1 rigidBody]}
          Base: [1x1 rigidBody]
     BodyNames: {'iiwa_link_0'  'iiwa_link_1'  'iiwa_link_2'  'iiwa_link_3'  'iiwa_link_4'  'iiwa_link_5'  'iiwa_link_6'  'iiwa_link_7'  'iiwa_link_ee'  'iiwa_link_ee_kuka'}
      BaseName: 'world'
       Gravity: [0 0 0]
    DataFormat: 'struct'

show(robot)

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 29 objects of type patch, line. These objects represent world, iiwa_link_0, iiwa_link_1, iiwa_link_2, iiwa_link_3, iiwa_link_4, iiwa_link_5, iiwa_link_6, iiwa_link_7, iiwa_link_ee, iiwa_link_ee_kuka, iiwa_link_0_mesh, iiwa_link_1_mesh, iiwa_link_2_mesh, iiwa_link_3_mesh, iiwa_link_4_mesh, iiwa_link_5_mesh, iiwa_link_6_mesh, iiwa_link_7_mesh.

ans = 
  Axes (Primary) with properties:

             XLim: [-1.5000 1.5000]
             YLim: [-1.5000 1.5000]
           XScale: 'linear'
           YScale: 'linear'
    GridLineStyle: '-'
         Position: [0.1300 0.1100 0.7750 0.8150]
            Units: 'normalized'

  Show all properties

URDF 文字ベクトルを指定します。この文字ベクトルは、有効なロボット モデルを作成するための必要最低限の記述です。

URDFtext = '<?xml version="1.0" ?><robot name="min"><link name="L0"/></robot>';

ロボット モデルをインポートします。この記述では、'L0' というロボット ベース リンクのみをもつ rigidBodyTree オブジェクトが作成されます。

robot = importrobot(URDFtext)
robot = 
  rigidBodyTree with properties:

     NumBodies: 0
        Bodies: {1x0 cell}
          Base: [1x1 rigidBody]
     BodyNames: {1x0 cell}
      BaseName: 'L0'
       Gravity: [0 0 0]
    DataFormat: 'struct'

ロボットのビジュアル ジオメトリを記述するために、Unified Robot Description format (URDF) ファイルと関連付けられた .stl ファイルをもつロボットをインポートできます。各剛体には、個別のビジュアル ジオメトリが指定されています。関数 importrobot は、URDF ファイルを解析してロボット モデルとビジュアル ジオメトリを取得します。この関数は、ロボットのビジュアル ジオメトリと衝突ジオメトリが同じであると想定し、対応するボディの衝突ジオメトリとしてビジュアル ジオメトリを割り当てます。

関数 show を使用して、Figure 内でロボット モデルのビジュアル ジオメトリと衝突ジオメトリを表示します。その後、コンポーネントをクリックして検査したり、右クリックして表示状態を切り替えたりして、モデルを操作できます。

ロボット モデルを URDF ファイルとしてインポートします。.stl ファイルの場所が、この URDF 内で正しく指定されていなければなりません。他の .stl ファイルを個別の剛体に追加する方法の詳細については、addVisualを参照してください。

robot = importrobot('iiwa14.urdf');

関連付けられたビジュアル モデルを使用してロボットを可視化します。ボディまたは座標系を検査するには、それらをクリックします。各ビジュアル ジオメトリの表示状態を切り替えるには、ボディを右クリックします。

show(robot,'visuals','on','collision','off');

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 29 objects of type patch, line. These objects represent world, iiwa_link_0, iiwa_link_1, iiwa_link_2, iiwa_link_3, iiwa_link_4, iiwa_link_5, iiwa_link_6, iiwa_link_7, iiwa_link_ee, iiwa_link_ee_kuka, iiwa_link_0_mesh, iiwa_link_1_mesh, iiwa_link_2_mesh, iiwa_link_3_mesh, iiwa_link_4_mesh, iiwa_link_5_mesh, iiwa_link_6_mesh, iiwa_link_7_mesh.

関連付けられた衝突ジオメトリを使用してロボットを可視化します。ボディまたは座標系を検査するには、それらをクリックします。各衝突ジオメトリの表示状態を切り替えるには、ボディを右クリックします。

show(robot,'visuals','off','collision','on'); 

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 29 objects of type patch, line. These objects represent world, iiwa_link_0, iiwa_link_1, iiwa_link_2, iiwa_link_3, iiwa_link_4, iiwa_link_5, iiwa_link_6, iiwa_link_7, iiwa_link_ee, iiwa_link_ee_kuka, iiwa_link_0_mesh, iiwa_link_1_mesh, iiwa_link_2_mesh, iiwa_link_3_mesh, iiwa_link_4_mesh, iiwa_link_5_mesh, iiwa_link_6_mesh, iiwa_link_7_mesh, iiwa_link_0_coll_mesh, iiwa_link_1_coll_mesh, iiwa_link_2_coll_mesh, iiwa_link_3_coll_mesh, iiwa_link_4_coll_mesh, iiwa_link_5_coll_mesh, iiwa_link_6_coll_mesh, iiwa_link_7_coll_mesh.

既存の Simscape™ Multibody™ ロボット モデルを、rigidBodyTree オブジェクトとして Robotics System Toolbox™ にインポートします。

Simscape™ Multibody™ モデルを開きます。これはヒューマノイド ロボットのモデルです。

open_system('example_smhumanoidrobot.slx')

モデルをインポートします。

[robot,importInfo] = importrobot(gcs)
robot = 
  rigidBodyTree with properties:

     NumBodies: 21
        Bodies: {1x21 cell}
          Base: [1x1 rigidBody]
     BodyNames: {'Body01'  'Body02'  'Body03'  'Body04'  'Body05'  'Body06'  'Body07'  'Body08'  'Body09'  'Body10'  'Body11'  'Body12'  'Body13'  'Body14'  'Body15'  'Body16'  'Body17'  'Body18'  'Body19'  'Body20'  'Body21'}
      BaseName: 'Base'
       Gravity: [0 0 -9.8066]
    DataFormat: 'struct'

importInfo = 
  rigidBodyTreeImportInfo with properties:

        SourceModelName: 'example_smhumanoidrobot'
          RigidBodyTree: [1x1 rigidBodyTree]
    BlockConversionInfo: [1x1 struct]

作成された rigidBodyTree オブジェクトに関する詳細を表示します。

showdetails(importInfo)
--------------------
Robot: (21 bodies)

 Idx     Body Name     Simulink Source Blocks     Joint Name     Simulink Source Blocks   Joint Type     Parent Name(Idx)   Children Name(s)
 ---     ---------     ----------------------     ----------     ----------------------   ----------     ----------------   ----------------
   1        Body01    Info | List | Highlight        Joint01    Info | List | Highlight     revolute              Base(0)   Body02(2)  
   2        Body02    Info | List | Highlight        Joint02    Info | List | Highlight     revolute            Body01(1)   Body03(3)  
   3        Body03    Info | List | Highlight        Joint03    Info | List | Highlight     revolute            Body02(2)   Body04(4)  
   4        Body04    Info | List | Highlight        Joint04    Info | List | Highlight     revolute            Body03(3)   
   5        Body05    Info | List | Highlight        Joint05    Info | List | Highlight     revolute              Base(0)   Body06(6)  
   6        Body06    Info | List | Highlight        Joint06    Info | List | Highlight     revolute            Body05(5)   Body07(7)  
   7        Body07    Info | List | Highlight        Joint07    Info | List | Highlight     revolute            Body06(6)   Body08(8)  
   8        Body08    Info | List | Highlight        Joint08    Info | List | Highlight     revolute            Body07(7)   
   9        Body09    Info | List | Highlight        Joint09    Info | List | Highlight     revolute              Base(0)   Body10(10)  
  10        Body10    Info | List | Highlight        Joint10    Info | List | Highlight     revolute            Body09(9)   Body11(11)  
  11        Body11    Info | List | Highlight        Joint11    Info | List | Highlight     revolute           Body10(10)   Body12(12)  
  12        Body12    Info | List | Highlight        Joint12    Info | List | Highlight     revolute           Body11(11)   
  13        Body13    Info | List | Highlight        Joint13    Info | List | Highlight     revolute              Base(0)   Body14(14)  
  14        Body14    Info | List | Highlight        Joint14    Info | List | Highlight     revolute           Body13(13)   Body15(15)  
  15        Body15    Info | List | Highlight        Joint15    Info | List | Highlight     revolute           Body14(14)   Body16(16)  
  16        Body16    Info | List | Highlight        Joint16    Info | List | Highlight     revolute           Body15(15)   
  17        Body17    Info | List | Highlight        Joint17    Info | List | Highlight     revolute              Base(0)   Body18(18)  
  18        Body18    Info | List | Highlight        Joint18    Info | List | Highlight     revolute           Body17(17)   Body19(19)  
  19        Body19    Info | List | Highlight        Joint19    Info | List | Highlight        fixed           Body18(18)   Body20(20)  
  20        Body20    Info | List | Highlight        Joint20    Info | List | Highlight        fixed           Body19(19)   
  21        Body21    Info | List | Highlight        Joint21    Info | List | Highlight        fixed              Base(0)   
--------------------

入力引数

すべて折りたたむ

ロボット記述ファイルの名前。string スカラーまたは文字ベクトルとして指定します。このファイルは有効な URDF ロボット記述、Xacro ロボット記述、または SDF モデル記述である必要があります。

メッシュ データをもつ付属のロボット モデル

ロボット モデルメッシュの可視化説明
"iiwa7.urdf"

Figure contains the mesh of KUKA LBR iiwa 7 R800 7-axis robot

KUKA LBR iiwa 7 R800 7 軸ロボット

"iiwa14.urdf"

Figure contains the mesh of URDF version of KUKA LBR iiwa 14 R820 7-axis robot

KUKA LBR iiwa 14 R820 7 軸ロボットの URDF バージョン

"iiwa14.xacro"

Figure contains the mesh of Xacro version of KUKA LBR iiwa 14 R820 7-axis robot

KUKA LBR iiwa 14 R820 7 軸ロボットの Xacro バージョン

"iiwa14.sdf"

Figure contains the mesh of SDF version of KUKA LBR iiwa 14 R820 7-axis robot

KUKA LBR iiwa 14 R820 7 軸ロボットの SDF バージョン

"sawyer.urdf"

Figure contains the mesh of Rethink Robotics Sawyer 7-axis robot

Rethink Robotics Sawyer 7 軸ロボット

メモ

メッシュ データがない付属のロボット モデル用のメッシュ データをダウンロードするには、Robotics System Toolbox Robot Library Data サポート パッケージのインストールを参照してください。

メッシュ データがない付属のロボット モデル

ロボット モデルメッシュの可視化説明
"abbIrb120.urdf"

Figure contains the mesh of ABB IRB 120 6-axis robot

ABB IRB 120 6 軸ロボット

"abbIrb120T.urdf"

Figure contains the mesh of ABB IRB 120T 6-axis robot

ABB IRB 120T 6 軸ロボット

"abbIrb1600.urdf"

Figure contains the mesh of ABB IRB 1600 6-axis robot

ABB IRB 1600 6 軸ロボット

"abbYuMi.urdf"

Figure contains the mesh of ABB YuMi 2-armed robot

ABB YuMi 2 腕ロボット

"amrPioneer3AT.urdf"

Figure contains the mesh of Adept MobileRobots Pioneer 3-AT mobile robot

Adept MobileRobots Pioneer 3-AT モバイル ロボット

"amrPioneer3DX.urdf"

Figure contains the mesh of Adept MobileRobots Pioneer 3-DX mobile robot

Adept MobileRobots Pioneer 3-DX モバイル ロボット

"amrPioneerLX.urdf"

Figure contains the mesh of Adept MobileRobots Pioneer LX mobile robot

Adept MobileRobots Pioneer LX モバイル ロボット

"atlas.urdf"

Figure contains the mesh of Boston Dynamics ATLAS Humanoid robot

Boston Dynamics ATLAS® ヒューマノイド ロボット

"clearpathHusky.urdf"

Figure contains the mesh of Clearpath Robotics Husky mobile robot

Clearpath Robotics Husky モバイル ロボット

"clearpathJackal.urdf"

Figure contains the mesh of Clearpath Robotics Jackal mobile robot

Clearpath Robotics Jackal モバイル ロボット

"clearpathTurtleBot2.urdf"

Figure contains the mesh of Clearpath Robotics TurtleBot 2 mobile robot

Clearpath Robotics TurtleBot 2 モバイル ロボット

"fanucLRMate200ib.urdf"

Figure contains the mesh of FANUC LR Mate 200iB 6-axis robot

FANUC LR Mate 200iB 6 軸ロボット

"fanucM16ib.urdf"

Figure contains the mesh of FANUC M-16iB 6-axis robot

FANUC M-16iB 6 軸ロボット

"frankaEmikaPanda.urdf"

Figure contains the mesh of Franka Emika Panda 7-axis robot

Franka Emika Panda 7 軸ロボット

"kinovaGen3.urdf"

Figure contains the mesh of version 1 of KINOVA Gen3 7-axis robot

KINOVA® Gen3 7 軸ロボットの Version 1

"kinovaGen3V12.urdf"

Figure contains the mesh of version 2 of KINOVA Gen3 7-axis robot

KINOVA® Gen3 7 軸ロボットの Version 2

"kinovaJacoJ2N6S200.urdf"

Figure contains the mesh of KINOVA JACO 2-fingered 6 DOF robot with non-spherical wrist

KINOVA JACO® 2 指 6 DOF ロボット (手首は非球面)

"kinovaJacoJ2N6S300.urdf"

Figure contains the mesh of KINOVA JACO 3-fingered 6 DOF robot with non-spherical wrist

KINOVA JACO® 3 指 6 DOF ロボット (手首は非球面)

"kinovaJacoJ2N7S300.urdf"

Figure contains the mesh of KINOVA JACO 3-fingered 7 DOF robot with non-spherical wrist

KINOVA JACO® 3 指 7 DOF ロボット (手首は非球面)

"kinovaJacoJ2S6S300.urdf"

Figure contains the mesh of KINOVA JACO 3-fingered 6 DOF robot with spherical wrist

KINOVA JACO® 3 指 6 DOF ロボット (手首は球面)

"kinovaJacoJ2S7S300.urdf"

Figure contains the mesh of KINOVA JACO 3-fingered 7 DOF robot with spherical wrist

KINOVA JACO® 3 指 7 DOF ロボット (手首は球面)

"kinovaJacoTwoArmExample.urdf"

Figure contains the mesh of Two KINOVA JACO 3-fingered 6 DOF robots with non-spherical wrist

KINOVA JACO® 3 指 6 DOF ロボット 2 台 (手首は非球面)

"kinovaMicoM1N4S200.urdf"

Figure contains the mesh of KINOVA MICO 2-fingered 4 DOF robot

KINOVA MICO® 2 指 4 DOF ロボット

"kinovaMicoM1N6S200.urdf"

Figure contains the mesh of KINOVA MICO 2-fingered 6 DOF robot

KINOVA MICO® 2 指 6 DOF ロボット

"kinovaMicoM1N6S300.urdf"

Figure contains the mesh of KINOVA MICO 3-fingered 6 DOF robot

KINOVA MICO® 3 指 6 DOF ロボット

"kinovaMovo.urdf"

Figure contains the mesh of KINOVA MOVO 2-armed mobile robot

KINOVA MOVO® 2 腕モバイル ロボット

"kukaIiwa7.urdf"

Figure contains the mesh of KUKA LBR iiwa 7 R800 7-axis robot

KUKA LBR iiwa 7 R800 7 軸ロボット

"kukaIiwa14.urdf"

Figure contains the mesh of KUKA LBR iiwa 14 R820 7-axis robot

KUKA LBR iiwa 14 R820 7 軸ロボット

"meca500r3.urdf"

Figure contains the mesh of Mecademic Meca500 R3 6-axis robot

Mecademic Meca500 R3 6 軸ロボット

"omronEcobra600.urdf"

Figure contains the mesh of Omron eCobra 600 4-axis SCARA robot

Omron eCobra 600 4 軸 SCARA ロボット

"puma560.urdf"

Figure contains the mesh of PUMA 560 6-axis robot

PUMA 560 6 軸ロボット

"quanserQArm.urdf"

Figure contains the mesh of Quanser QArm 4 DOF robot

Quanser QArm 4 DOF ロボット

"quanserQBot2e.urdf"

Figure contains the mesh of Quanser QBot 2e mobile robot

Quanser QBot 2e モバイル ロボット

"quanserQCar.urdf"

Figure contains the mesh of Quanser QCar mobile robot

Quanser QCar モバイル ロボット

"rethinkBaxter.urdf"

Figure contains the mesh of Rethink Robotics Baxter 2-armed robot

Rethink Robotics Baxter 2 腕ロボット

"rethinkSawyer.urdf"

Figure contains the mesh of Rethink Robotics Sawyer 7-axis robot

Rethink Robotics Sawyer 7 軸ロボット

"robotiq2F85.urdf"

Figure contains the mesh of Robotiq 2F-85 2-finger gripper

Robotiq 2F-85 2 指グリッパー

このグリッパーは以下のマニピュレーターで使用できます。

  • Universal Robots UR3

  • Universal Robots UR3e

  • Universal Robots UR5

  • Universal Robots UR5e

  • Universal Robots UR10

  • Universal Robots UR10e

  • Universal Robots UR16e

  • KINOVA® Gen3 (Version 1 および 2)

"robotisOP2.urdf"

Figure contains the mesh of ROBOTIS OP2 Humanoid robot

ROBOTIS OP2 ヒューマノイド ロボット

"robotisOpenManipulator.urdf"

Figure contains the mesh of ROBOTIS OpenMANIPULATOR 4-axis robot with gripper

ROBOTIS OpenMANIPULATOR 4 軸ロボット (グリッパー付属)

"robotisTurtleBot3Burger.urdf"

Figure contains the mesh of ROBOTIS TurtleBot 3 Burger robot

ROBOTIS TurtleBot 3 Burger ロボット

"robotisTurtleBot3Waffle.urdf"

Figure contains the mesh of ROBOTIS TurtleBot 3 Waffle robot

ROBOTIS TurtleBot 3 Waffle ロボット

"robotisTurtleBot3WaffleForOpenManipulator.urdf"

Figure contains the mesh of ROBOTIS TurtleBot 3 Waffle robot for OpenMANIPULATOR

ROBOTIS TurtleBot 3 Waffle ロボット (OpenMANIPULATOR 付属)

"robotisTurtleBot3WafflePi.urdf"

Figure contains the mesh of ROBOTIS TurtleBot 3 Waffle Pi robot

ROBOTIS TurtleBot 3 Waffle Pi ロボット

"robotisTurtleBot3WafflePiForOpenManipulator.urdf"

Figure contains the mesh of ROBOTIS TurtleBot 3 Waffle Pi robot for OpenMANIPULATOR

ROBOTIS TurtleBot 3 Waffle Pi ロボット (OpenMANIPULATOR 付属)

"universalUR3.urdf"

Figure contains the mesh of Universal Robots UR3 6-axis robot

Universal Robots UR3 6 軸ロボット

"universalUR3e.urdf"

Figure contains the mesh of Universal Robots UR3e 6-axis robot

Universal Robots UR3e 6 軸ロボット

"universalUR5.urdf"

Figure contains the mesh of Universal Robots UR5 6-axis robot

Universal Robots UR5 6 軸ロボット

"universalUR5e.urdf"

Figure contains the mesh of Universal Robots UR5e 6-axis robot

Universal Robots UR5e 6 軸ロボット

"universalUR10.urdf"

Figure contains the mesh of Universal Robots UR10 6-axis robot

Universal Robots UR10 6 軸ロボット

"universalUR10e.urdf"

Figure contains the mesh of Universal Robots UR10e 6-axis robot

Universal Robots UR10e 6 軸ロボット

"universalUR16e.urdf"

Figure contains the mesh of Universal Robots UR16e 6-axis robot

Universal Robots UR16e 6 軸ロボット

"valkyrie.urdf"

Figure contains the mesh of NASA Valkyrie Humanoid robot

NASA Valkyrie ヒューマノイド ロボット

"willowgaragePR2.urdf"

Figure contains the mesh of Willow Garage PR2 mobile robot

Willow Garage PR2 モバイル ロボット

"yaskawaMotomanMH5.urdf"

Figure contains the mesh of Yaskawa Motoman MH5 6-axis robot

Yaskawa Motoman MH5 6 軸ロボット

例: "robot_file.urdf"

例: "robot_file.xacro"

例: "robot_file.sdf"

データ型: char | string

ロボット記述テキスト。string スカラーまたは文字ベクトルとして指定します。このテキストは有効な URDF ロボット記述、Xacro ロボット記述、または SDF モデル記述である必要があります。

テキストからの URDF ロボット記述の解析

URDF テキストからロボット モデルをインポートします。

% Specify URDF text as a character vector.
text = ['<?xml version="1.0" ?>', ...
        '<robot name="min">', ...
        '<link name="L0"/>', ...
        '</robot>'];
% Import the robot model from the URDF text.
robot = importrobot(text);

URDF テキスト ファイルからロボット モデルをインポートします。

% Specify URDF text as a character vector.
text = ['<?xml version="1.0" ?>', ...
        '<robot name="min">', ...
        '<link name="L0"/>', ...
        '</robot>'];
% Write the text to file.
writelines(text,"URDF_robot.txt")
% Import the robot model from the URDF text file. Specify the format of
% the robot description text file.
robot = importrobot("URDF_robot.txt","urdf");

テキストからの Xacro ロボット記述の解析

Xacro テキストからロボット モデルをインポートします。

% Specify Xacro text as a character vector.
text = ['<?xml version="1.0" ?>', ...
        '<robot name="min" ', ...
        'xmlns:xacro="http://www.ros.org/wiki/xacro">', ...
        '<link name="L0"/>', ...
        '</robot>'];
% Import the robot model from the Xacro text.
robot = importrobot(text);

Xacro テキスト ファイルからロボット モデルをインポートします。

% Specify Xacro text as a character vector.
text = ['<?xml version="1.0" ?>', ...
        '<robot name="min" ', ...
        'xmlns:xacro="http://www.ros.org/wiki/xacro">', ...
        '<link name="L0"/>', ...
        '</robot>'];
% Write the text to file.
writelines(text,"Xacro_robot.txt")
% Import the robot model from the Xacro text file. Specify the format of
% the robot description text file.
robot = importrobot("Xacro_robot.txt","xacro");

テキストからの SDF モデル記述の解析

SDF テキストからロボット モデルをインポートします。

% Specify SDF text as a character vector.
text = ['<?xml version="1.0" ?>', ...
        '<sdf version="1.6">', ...
        '<model name="min">', ...
        '<link name="L0"/>', ...
        '</model>', ...
        '</sdf>'];
% Import the robot model from the SDF text.
robot = importrobot(text);

SDF テキスト ファイルからロボット モデルをインポートします。

% Specify SDF text as a character vector.
text = ['<?xml version="1.0" ?>', ...
        '<sdf version="1.6">', ...
        '<model name="min">', ...
        '<link name="L0"/>', ...
        '</model>', ...
        '</sdf>'];
% Write the text to file.
writelines(text,"SDF_robot.txt")
% Import the robot model from the SDF text file. Specify the format of
% the robot description text file.
robot = importrobot("SDF_robot.txt","sdf");

データ型: char | string

ロボット記述テキスト ファイルのファイル形式。string スカラーまたは文字ベクトルとして指定します。ロボット記述ファイルに必要な形式を明示的に指定するには、この引数を使用します。

例: "robot_file.txt","urdf"

例: "robot_file.txt","xacro"

例: "robot_file.txt","sdf"

データ型: char | string

Simscape Multibody モデル。モデル ハンドル、string スカラーまたは文字ベクトルとして指定します。

データ型: char | string

名前と値の引数

オプションの引数のペアを Name1=Value1,...,NameN=ValueN として指定します。ここで、Name は引数名、Value は対応する値です。名前と値の引数は他の引数の後に表示されなければなりませんが、ペアの順序は重要ではありません。

R2021a より前は、名前と値をそれぞれコンマを使って区切り、Name引用符で囲みます。

例: "MeshPath",{"../arm_meshes","../body_meshes"}

URDF、Xacro、または SDF のインポート

すべて折りたたむ

メッシュ ファイルの相対検索パス。string スカラー、文字ベクトル、あるいは string スカラーまたは文字ベクトルの cell 配列として指定します。メッシュ ファイルは URDF、Xacro、または SDF ファイル内で指定する必要がありますが、MeshPath はこれらの指定されたファイルへの相対パスを定義します。

データ型: char | string | cell

ロボット モデルの運動学およびダイナミクス関数の入出力データ形式。'DataFormat'"struct""row"、または "column" で構成されるコンマ区切りのペアとして指定します。ダイナミクス関数を使用するには、"row" または "column" を指定する必要があります。この名前と値のペアは、rigidBodyTree ロボット モデルの DataFormat プロパティを設定します。

データ型: char | string

複数のモデルが含まれる SDF からモデルを選択します。string スカラーまたは文字ベクトルとして指定します。

メモ

この名前と値のペアは、SDF モデルおよびテキストにのみ適用されます。

データ型: char | string

コード生成時にインポートされたロボットで許可される最大ボディ数。整数として指定します。MaxNumBodies を使用して、コード生成をサポートする関数内のインポートされたツリーに剛体を追加します。追加できるボディの数は、MaxNumBodies とインポートされたツリー rigidBodyTree.NumBodies のボディの数の差です。

メモ

この名前と値のペアはコード生成ワークフローでのみ必要です。

Simscape Multibody モデルのインポート

すべて折りたたむ

指定された model 入力で閉連鎖を解除するかどうかを示します。"error" または "remove-joints" として指定します。"remove-joints" を指定した場合、結果の robot 出力ではチェーン クロージャ ジョイントが削除されます。それ以外の場合、関数はエラーをスローします。

データ型: char | string

指定された model 入力で、サポートされていないジョイントを固定ジョイントに変換するかどうかを示します。"error" または "convert-to-fixed" として指定します。"convert-to-fixed" を指定した場合、結果の robot 出力では、サポートされていないジョイントが固定ジョイントに変換されます。出力される rigidBodyTree オブジェクトでは、固定ジョイント、直進ジョイントおよび回転ジョイントのみがサポートされています。それ以外で、model にサポートされていないジョイントが含まれている場合、関数はエラーをスローします。

データ型: char | string

指定された model 入力で、拘束ブロックを削除するかどうかを示します。"error" または "remove" として指定します。"remove" を指定した場合、結果の robot 出力では、拘束が削除されます。それ以外で、model に拘束ブロックが含まれている場合、関数はエラーをスローします。

データ型: char | string

指定された model 入力で、可変慣性ブロックを削除するかどうかを示します。"error" または "remove" として指定します。"remove" を指定した場合、結果の robot 出力では、可変慣性が削除されます。それ以外で、model に可変慣性ブロックが含まれている場合、関数はエラーをスローします。

データ型: char | string

ロボット モデルの運動学およびダイナミクス関数の入出力データ形式。'DataFormat'"struct""row"、または "column" で構成されるコンマ区切りのペアとして指定します。ダイナミクス関数を使用するには、"row" または "column" を指定する必要があります。この名前と値のペアは、rigidBodyTree ロボット モデルの DataFormat プロパティを設定します。

データ型: char | string

出力引数

すべて折りたたむ

ロボット モデル。rigidBodyTree オブジェクトとして返されます。

メモ

URDF ファイル内に重力が指定されていない場合、既定の Gravity プロパティは [0 0 0] に設定されます。Simscape Multibody では、smimport を使用して URDF をインポートするときに既定の [0 0 -9.80665] m/s2 を使用します。

インポート情報を保存するためのオブジェクト。rigidBodyTreeImportInfo オブジェクトとして返されます。このオブジェクトには、入力 model と結果の robot 出力の間の関係が含まれます。

robot 内の各ボディのインポート情報をすべて表示するには、showdetails を使用します。剛体の情報を表示するリンク、それらに対応するモデル内のブロック、モデル内の特定のブロックの強調表示がコマンド ウィンドウに出力されます。

robot 出力または model 入力の特定のコンポーネントに関する情報を取得するには、bodyInfobodyInfoFromBlock、または bodyInfoFromJoint を使用します。

ヒント

ビジュアル メッシュを含むロボット モデルをインポートするとき、関数 importrobot は、各剛体に割り当てる .stl または .dae ファイルを、以下の規則を使用して検索します。

  • この関数は、生メッシュ パスで、URDF、Xacro、または SDF ファイルの指定された剛体を検索します。ROS パッケージへの参照で package:\\<pkg_name> が削除されます。

  • 絶対パスは、変更なしで直接チェックされます。

  • 相対パスは、以下のディレクトリを順番に使用してチェックされます。

    • ユーザー指定の MeshPath

    • 現在のフォルダー

    • MATLAB® パス

    • URDF、Xacro、または SDF ファイルを含むフォルダー

    • URDF、Xacro、または SDF ファイルを含むフォルダーの 1 つ上のレベル

  • URDF、Xacro、または SDF ファイル内のメッシュ パスからのファイル名が、MeshPath 入力引数に付加されます。

メッシュ ファイルがまだ見つからない場合、パーサーはメッシュ ファイルを無視して、ビジュアルのない rigidBodyTree オブジェクトを返します。

バージョン履歴

R2017a で導入