Skip to content

Commit

Permalink
Expose a better API to allow any render engine to be used for the phy…
Browse files Browse the repository at this point in the history
…sics simulation when loading URDF/SDF files.

See bullet3/examples/Importers/ImportURDFDemo/DefaultVisualShapeConverter.h
Give the kuka_iiwa/model.urdf some blue color, not just orange, to mimick the original a bit better
Preparation for the CMD_CAMERA_IMAGE_COMPLETED command, to expose a virtual camera to the robotics API
  • Loading branch information
erwin coumans committed May 20, 2016
1 parent f4775c3 commit 2fc0358
Show file tree
Hide file tree
Showing 23 changed files with 575 additions and 437 deletions.
4 changes: 3 additions & 1 deletion Extras/InverseDynamics/btMultiBodyFromURDF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "../Importers/ImportURDFDemo/URDF2Bullet.h"
#include "../Importers/ImportURDFDemo/MyMultiBodyCreator.h"
#include "../Importers/ImportURDFDemo/URDF2Bullet.h"
#include "../Importers/ImportURDFDemo/DefaultVisualShapeConverter.h"

/// Create a btMultiBody model from URDF.
/// This is adapted from Bullet URDF loader example
Expand Down Expand Up @@ -44,7 +45,8 @@ class MyBtMultiBodyFromURDF {
void init() {
this->createEmptyDynamicsWorld();
m_dynamicsWorld->setGravity(m_gravity);
BulletURDFImporter urdf_importer(&m_nogfx);
DefaultVisualShapeConverter visualConverter(&m_nogfx);
BulletURDFImporter urdf_importer(&m_nogfx, &visualConverter);
URDFImporterInterface &u2b(urdf_importer);
bool loadOk = u2b.loadURDF(m_filename.c_str(), m_base_fixed);

Expand Down
12 changes: 8 additions & 4 deletions data/kuka_iiwa/model.urdf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
<material name="Orange">
<color rgba="1.0 0.423529411765 0.0392156862745 1.0"/>
</material>
<material name="Blue">
<color rgba="0.5 0.7 1.0 1.0"/>
</material>

<!--Import the lbr iiwa macro -->
<!--Import Transmissions -->
<!--Include Utilities -->
Expand Down Expand Up @@ -97,7 +101,7 @@
<geometry>
<mesh filename="meshes/link_1.stl"/>
</geometry>
<material name="Orange"/>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
Expand Down Expand Up @@ -126,7 +130,7 @@
<geometry>
<mesh filename="meshes/link_2.stl"/>
</geometry>
<material name="Orange"/>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
Expand Down Expand Up @@ -184,7 +188,7 @@
<geometry>
<mesh filename="meshes/link_4.stl"/>
</geometry>
<material name="Orange"/>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
Expand Down Expand Up @@ -213,7 +217,7 @@
<geometry>
<mesh filename="meshes/link_5.stl"/>
</geometry>
<material name="Orange"/>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
Expand Down
2 changes: 2 additions & 0 deletions examples/ExampleBrowser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ SET(BulletExampleBrowser_SRCS
../Importers/ImportURDFDemo/urdfStringSplit.h
../Importers/ImportURDFDemo/BulletUrdfImporter.cpp
../Importers/ImportURDFDemo/BulletUrdfImporter.h
../Importers/ImportURDFDemo/DefaultVisualShapeConverter.cpp
../Importers/ImportURDFDemo/DefaultVisualShapeConverter.h
../VoronoiFracture/VoronoiFractureDemo.cpp
../VoronoiFracture/VoronoiFractureDemo.h
../VoronoiFracture/btConvexConvexMprAlgorithm.cpp
Expand Down
2 changes: 0 additions & 2 deletions examples/ExampleBrowser/OpenGLGuiHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ void OpenGLGuiHelper::createCollisionShapeGraphicsObject(btCollisionShape* colli
{
gfxVertices[i].uv[j] = 0.5;//we don't have UV info...
}


}
}

Expand Down
5 changes: 3 additions & 2 deletions examples/Importers/ImportSDFDemo/ImportSDFSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../../Utils/b3ResourcePath.h"

#include "../ImportURDFDemo/BulletUrdfImporter.h"

#include "../Importers/ImportURDFDemo/DefaultVisualShapeConverter.h"

#include "../ImportURDFDemo/URDF2Bullet.h"

Expand Down Expand Up @@ -203,7 +203,8 @@ void ImportSDFSetup::initPhysics()

m_dynamicsWorld->setGravity(gravity);

BulletURDFImporter u2b(m_guiHelper);
DefaultVisualShapeConverter visualConverter(m_guiHelper);
BulletURDFImporter u2b(m_guiHelper, &visualConverter);

bool loadOk = u2b.loadSDF(m_fileName);

Expand Down
Loading

0 comments on commit 2fc0358

Please sign in to comment.