Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrimitiveShapeItemの使い方? #32

Open
y-masutani opened this issue Apr 1, 2016 · 2 comments
Open

PrimitiveShapeItemの使い方? #32

y-masutani opened this issue Apr 1, 2016 · 2 comments

Comments

@y-masutani
Copy link

http://fkanehiro.github.io/choreonoid-editor-doc/html-ja/manual.html#linkitem
では,LinkItemのプロパティでPrimitive typeを選ぶとなっていますが,そのような項目はありません.
メニューの新規にPrimitiveShapeItemがあるので,これに代わったのではないかと推測しています.
これはどのように使うのでしょうか?

LinkItem(Segmentノード)の子ノードにすると,Shapeがファイルに保存されません.

test4 (EditableBodyItem)
→FreeJoint (JointItem)
→→Base (LinkItem)
→→→Box (PrimitiveShapeItem)

Humanoid {
  humanoidBody [
    DEF FreeJoint Joint {
      jointType "free"
      gearRatio 1
      rotorInertia 0
      rotorResistor 0
      torqueConst 1
      encoderPulse 1
      center 0 0 0
      rotation 1 0 0 0
      scale 1 1 1
      scaleOrientation 0 0 1 0
      translation 0 0 0
      children [
        DEF Base Segment {
          mass 0
          centerOfMass 0 0 0
          momentsOfInertia
            [
              0 0 0 
              0 0 0 
              0 0 0 
            ]
          children [
            Transform {
              center 0 0 0
              rotation 1 0 0 0
              scale 1 1 1
              scaleOrientation 0 0 1 0
              translation 0 0 0
            }
          ]
        }
      ]
    }
  ]
}

JointItem(Jointノード)の子ノードにすると,勝手に新たなSegmentノードが作られ,Shapeがファイルに保存されるようになりました.

test4 (EditableBodyItem)
→FreeJoint (JointItem)
→→Base (LinkItem)
→→Box (PrimitiveShapeItem)

Humanoid {
  humanoidBody [
    DEF FreeJoint Joint {
      jointType "free"
      gearRatio 1
      rotorInertia 0
      rotorResistor 0
      torqueConst 1
      encoderPulse 1
      center 0 0 0
      rotation 1 0 0 0
      scale 1 1 1
      scaleOrientation 0 0 1 0
      translation 0 0 0
      children [
        DEF Base Segment {
          mass 0
          centerOfMass 0 0 0
          momentsOfInertia
            [
              0 0 0 
              0 0 0 
              0 0 0 
            ]
          children [
            Transform {
              center 0 0 0
              rotation 1 0 0 0
              scale 1 1 1
              scaleOrientation 0 0 1 0
              translation 0 0 0
            }
          ]
        }
        DEF FreeJoint_LINK Segment {
          mass 0
          centerOfMass 0 0 0
          momentsOfInertia
            [
              0 0 0 
              0 0 0 
              0 0 0 
            ]
          children [
            Transform {
              center 0 0 0
              rotation 1 0 0 0
              scale 1 1 1
              scaleOrientation 0 0 1 0
              translation 0 0 0
              children [
                Shape {
                  geometry
                    Box {
                      size 0.1 0.1 0.1
                    }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

このwrlファイルを再び読み込むと,勝手に作られたFreeJoint_LINKに対応するLinkItemや,PrimitiveShapeItemがアイテムビューに表示されません.

test4 (EditableBodyItem)
→FreeJoint (JointItem)
→→Base (LinkItem)

Baseのチェックを入れると,何故かシーンビューにBoxが表示されます.

仕様がよく理解できません.

今私が実際にやりたいことは,既存のモデルに関節や力センサを追加することです.基本的なことで恐縮ですが,ご助言をいただけると幸いです.

@y-masutani
Copy link
Author

choreonoid-editorで以下のようなモデルを作成しました.

test5 (EditableBodyItem)
→FreeJoint (JointItem)
→→Base (PrimitiveShapeItem)
→→Joint0 (JointItem)
→→→Box0 (PrimitiveShapeItem)
→→→Joint1 (JointItem)
→→→→Box1 (PrimitiveShapeItem)

これをwrlに保存し,再びchoreonoid-editorで読み込むと,以下のように表示されます.

test5 (EditableBodyItem)
→FreeJoint (JointItem)
→→FreeJoint_LINK (LinkItem)
→→Joint0 (JointItem)
→→→Joint0_LINK (LinkItem)
→→→Joint1 (JointItem)
→→→→Joint1_LINK (LinkItem)

よくわかりません.

@yosuke
Copy link
Contributor

yosuke commented Apr 4, 2016

LinkItem = PrimitiveShapeItem と思ってください。

以前は両者は同じものだったのですが、メッシュ形状とプリミティブ形状を同居させるとSegment faultが起きることが多かったので今は分離しています。ただわかりにくいのでもう一度同居を考えてみます。

ロード後PrimitiveShapeItemが復元できなくてLinkItemになってしまうのもおかしいのでデバッグします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants