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

Tutorials #504

Merged
merged 79 commits into from
Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
f7cbe31
created basic compound pendulum tutorial and started domino tutorial
mxgrey Jun 15, 2015
7a470d3
final touches on pendulum tutorial
mxgrey Jun 15, 2015
027c2a1
adding damping to the tutorial
mxgrey Jun 16, 2015
3fd483d
Merge branch 'dofAPI' into tutorials
mxgrey Jun 16, 2015
54e1d37
finished multi pendulum tutorial and added skeleton code
mxgrey Jun 16, 2015
ec8e9e2
renamed gui window
mxgrey Jun 16, 2015
76fbf24
finished domino portion of the domino tutorial
mxgrey Jun 16, 2015
dd21616
minor changes on style
ckarenliu Jun 16, 2015
1491e78
improvements to multi-pendulum tutorial
mxgrey Jun 16, 2015
8cf601f
fixed wording in comment
mxgrey Jun 16, 2015
72253b2
added a line of instruction
mxgrey Jun 16, 2015
51e414c
added instruction line
mxgrey Jun 17, 2015
41b52b9
adding manipulator to the dominoes tutorial
mxgrey Jun 17, 2015
a3f56da
more realistic dominoes
mxgrey Jun 18, 2015
c558097
implemented controllers for manipulator
mxgrey Jun 18, 2015
00a6369
improved operational space controller
mxgrey Jun 18, 2015
3d83424
finished domino tutorial
mxgrey Jun 18, 2015
aca6e39
merged
ckarenliu Jun 19, 2015
f9819fd
modified style
ckarenliu Jun 21, 2015
3e33675
modified style for domino and pendulum tutorials
ckarenliu Jun 21, 2015
ed7f141
added biped tutorial; modified styles
ckarenliu Jun 22, 2015
0c743f5
added Biped tutorial and associated files
ckarenliu Jun 24, 2015
b710756
reverted vehicle app
ckarenliu Jun 24, 2015
71763eb
minor style changes on tutorialBiped-Finished.cpp
ckarenliu Jun 25, 2015
beef607
Add initial work for readthedocs
jslee02 Jun 25, 2015
3af870b
Add readthedocs badge to README.md
jslee02 Jun 25, 2015
f568f24
Merge branch 'tutorials_readthedocs' into tutorials
jslee02 Jun 25, 2015
966af76
added tutorials/introduction.md; modified mkdocs.yml
ckarenliu Jun 26, 2015
7bc9b60
Merge pull request #423 from dartsim/tutorials_readthedocs
jslee02 Jun 26, 2015
a81b3e5
Merge remote-tracking branch 'origin/release-5.0' into tutorials
jslee02 Jun 27, 2015
5e33c29
avoiding bullet if it is not available
mxgrey Jun 28, 2015
c09c97c
added manipulator loading as a lesson
mxgrey Jun 28, 2015
5dc233e
edited biped tutorial; small changes in tutorialBiped-Finished.cpp
ckarenliu Jun 29, 2015
94ec483
spacing fix
mxgrey Jun 30, 2015
c6b1e69
adding collisions tutorial
mxgrey Jun 30, 2015
a96bc35
Merge branch 'tutorials' of http://github.com/dartsim/dart into tutor…
mxgrey Jun 30, 2015
50e717b
filling in faces of SoftBodyNodes
mxgrey Jun 30, 2015
14bec82
tossing rings and soft chains
mxgrey Jun 30, 2015
67cb2fb
nicer colors for the softBodies demo
mxgrey Jun 30, 2015
3d32915
added accessor function for BodyNodes
mxgrey Jun 30, 2015
0307a6e
experimenting with collisions
mxgrey Jun 30, 2015
da3a168
passing ShapePtr by const ref
mxgrey Jun 30, 2015
19708b3
copying SoftMeshShape properties over when cloning
mxgrey Jun 30, 2015
b6cdfe5
finished collisions tutorial
mxgrey Jun 30, 2015
ad35287
moved ShapePtr to the SmartPointers file
mxgrey Jul 1, 2015
f112215
final touches to collisions tutorial
mxgrey Jul 1, 2015
d464123
created documentation for collisions tutorial
mxgrey Jul 1, 2015
3332edd
including smart pointers in Shape.h
mxgrey Jul 1, 2015
d1911c1
finished biped tuotial document; modified tutorialBiped-Finished.cpp
ckarenliu Jul 1, 2015
1258c15
merged
ckarenliu Jul 1, 2015
f38907f
included random library in tutorialCollisions
ckarenliu Jul 1, 2015
116a3ae
fixed the collisions tutorial to be more realistic
mxgrey Jul 1, 2015
9e91b31
update collisions tutorial documentation
mxgrey Jul 1, 2015
0c5ed5a
some small cleanup
mxgrey Jul 1, 2015
7f5b5e3
beginning documentation for pendulum tutorial
mxgrey Jul 1, 2015
7a67fd1
finished pendulum tutorial documentation
mxgrey Jul 1, 2015
eee1c76
beginning dominoes tutorial
mxgrey Jul 2, 2015
261dad5
merged
ckarenliu Jul 2, 2015
cc91301
fixed up some inconsistencies
mxgrey Jul 2, 2015
b5d6bdd
added Fuschia color
mxgrey Jul 2, 2015
b5ee84c
added a standard soft body shape option
mxgrey Jul 2, 2015
23d3413
added random header just in case
mxgrey Jul 2, 2015
1034fef
finished documenation for domino tutorial
mxgrey Jul 3, 2015
6bfc19d
fixed typo
mxgrey Jul 3, 2015
33f88bf
updated introduction for DART
mxgrey Jul 3, 2015
9b1e09f
merged
ckarenliu Jul 3, 2015
2329367
edited multi-pendulum tutorial document
ckarenliu Jul 6, 2015
74346c0
Merge branch 'master' into tutorials
mxgrey Jul 16, 2015
52ac1fc
edited tutorial docs
ckarenliu Jul 17, 2015
0880efa
Add facebook comment and "like" button to the tutorial pages
jslee02 Aug 4, 2015
0ed5f64
Replace comment system from Facebook to Disqus to allow anonymous com…
jslee02 Aug 5, 2015
9267aa4
Merge remote-tracking branch 'origin/master' into tutorials
jslee02 Aug 5, 2015
b693fc0
Merge remote-tracking branch 'origin/tutorials' into tutorials_commen…
jslee02 Aug 5, 2015
6e06410
Merge pull request #484 from dartsim/tutorials_comment_system
jslee02 Aug 9, 2015
a556cea
Fill uncompleted API tables
jslee02 Sep 28, 2015
26cc82d
Merge remote-tracking branch 'origin/release-5.1' into tutorials
jslee02 Sep 28, 2015
1127f24
Delete unnecessary whitespaces
jslee02 Sep 30, 2015
2a04bc8
Add newline at EOF of .gitignore
jslee02 Sep 30, 2015
12be7a1
Add hyper links
jslee02 Sep 30, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ syntax: glob
CPack*
CTest*
Testing/
docs/
TAGS
.DS_Store
.cproject
Expand All @@ -23,3 +22,4 @@ TAGS
*~
/nbproject/
/doxygen/html/
docs/readthedocs/site
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline at EOF?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 added

7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ else()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
option(DART_BUILD_EXAMPLES "Build examples" ON)
option(DART_BUILD_TUTORIALS "Build tutorials" ON)
option(DART_BUILD_UNITTESTS "Build unit tests" ON)

#===============================================================================
Expand Down Expand Up @@ -315,6 +316,7 @@ endif()
if(BULLET_FOUND)
message(STATUS "Looking for BulletCollision - ${BULLET_VERSION} found")
set(HAVE_BULLET_COLLISION TRUE)
add_definitions(-DHAVE_BULLET_COLLISION)
else()
message(STATUS "Looking for BulletCollision - NOT found, please install libbullet-dev")
set(HAVE_BULLET_COLLISION FALSE)
Expand Down Expand Up @@ -482,6 +484,7 @@ message(STATUS "BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
message(STATUS "ENABLE_OPENMP : ${ENABLE_OPENMP}")
message(STATUS "Build core only : ${BUILD_CORE_ONLY}")
message(STATUS "Build examples : ${DART_BUILD_EXAMPLES}")
message(STATUS "Build tutorials : ${DART_BUILD_TUTORIALS}")
message(STATUS "Build unit tests : ${DART_BUILD_UNITTESTS}")
message(STATUS "Install path : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "CXX_FLAGS : ${CMAKE_CXX_FLAGS}")
Expand Down Expand Up @@ -558,6 +561,10 @@ if(NOT BUILD_CORE_ONLY)
add_subdirectory(apps)
endif()

if(DART_BUILD_TUTORIALS)
add_subdirectory(tutorials)
endif()

endif()

#===============================================================================
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[![Build Status](https://travis-ci.org/dartsim/dart.png?branch=master)](https://travis-ci.org/dartsim/dart)
[![Build status](https://ci.appveyor.com/api/projects/status/6rta8olo95bpu84r?svg=true)](https://ci.appveyor.com/project/jslee02/dart)
[![Documentation Status](https://readthedocs.org/projects/dart/badge/?version=latest)](https://readthedocs.org/projects/dart/?badge=latest)
3 changes: 2 additions & 1 deletion apps/softBodies/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ int main(int argc, char* argv[])
for(size_t j=0; j<skel->getNumBodyNodes(); ++j)
{
dart::dynamics::BodyNode* bn = skel->getBodyNode(j);
Eigen::Vector3d color = dart::Color::Random();
for(size_t k=0; k<bn->getNumVisualizationShapes(); ++k)
{
dart::dynamics::ShapePtr vs = bn->getVisualizationShape(k);
vs->setColor(dart::Color::Random());
vs->setColor(color);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions dart/collision/CollisionDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ bool CollisionDetector::getPairCollidable(const CollisionNode* _node1,
if (!isValidIndex(mCollidablePairs, index1, index2))
return false;

if (index1 == index2)
return false;

return mCollidablePairs[index1][index2];
}

Expand Down
12 changes: 12 additions & 0 deletions dart/constraint/JointConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,17 @@ double JointConstraint::getConstraintForceMixing()
return mConstraintForceMixing;
}

//==============================================================================
dynamics::BodyNode* JointConstraint::getBodyNode1() const
{
return mBodyNode1;
}

//==============================================================================
dynamics::BodyNode* JointConstraint::getBodyNode2() const
{
return mBodyNode2;
}

} // namespace constraint
} // namespace dart
6 changes: 6 additions & 0 deletions dart/constraint/JointConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ class JointConstraint : public ConstraintBase
/// Get global constraint force mixing parameter
static double getConstraintForceMixing();

/// Get the first BodyNode that this constraint is associated with
dynamics::BodyNode* getBodyNode1() const;

/// Get the second BodyNode that this constraint is associated with
dynamics::BodyNode* getBodyNode2() const;

protected:
/// First body node
dynamics::BodyNode* mBodyNode1;
Expand Down
4 changes: 2 additions & 2 deletions dart/dynamics/BodyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ double BodyNode::getRestitutionCoeff() const
}

//==============================================================================
void BodyNode::addCollisionShape(ShapePtr _shape)
void BodyNode::addCollisionShape(const ShapePtr& _shape)
{
if(nullptr == _shape)
{
Expand Down Expand Up @@ -491,7 +491,7 @@ void BodyNode::addCollisionShape(ShapePtr _shape)
}

//==============================================================================
void BodyNode::removeCollisionShape(ShapePtr _shape)
void BodyNode::removeCollisionShape(const ShapePtr& _shape)
{
if (nullptr == _shape)
return;
Expand Down
4 changes: 2 additions & 2 deletions dart/dynamics/BodyNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ class BodyNode : public Frame, public SkeletonRefCountingBase
//--------------------------------------------------------------------------

/// Add a collision Shape into the BodyNode
void addCollisionShape(ShapePtr _shape);
void addCollisionShape(const ShapePtr& _shape);

/// Remove a collision Shape from this BodyNode
void removeCollisionShape(ShapePtr _shape);
void removeCollisionShape(const ShapePtr& _shape);

/// Remove all collision Shapes from this BodyNode
void removeAllCollisionShapes();
Expand Down
4 changes: 2 additions & 2 deletions dart/dynamics/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const std::string& Entity::getName() const
}

//==============================================================================
void Entity::addVisualizationShape(ShapePtr _shape)
void Entity::addVisualizationShape(const ShapePtr& _shape)
{
if (nullptr == _shape)
return;
Expand All @@ -179,7 +179,7 @@ void Entity::addVisualizationShape(ShapePtr _shape)
}

//==============================================================================
void Entity::removeVisualizationShape(ShapePtr _shape)
void Entity::removeVisualizationShape(const ShapePtr& _shape)
{
if (nullptr == _shape)
return;
Expand Down
5 changes: 3 additions & 2 deletions dart/dynamics/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "dart/common/Subject.h"
#include "dart/common/Signal.h"
#include "dart/dynamics/Shape.h"
#include "dart/dynamics/SmartPointer.h"

namespace dart {
namespace renderer {
Expand Down Expand Up @@ -129,10 +130,10 @@ class Entity : public virtual common::Subject
virtual const std::string& getName() const;

/// Add a visualization Shape for this Entity
virtual void addVisualizationShape(ShapePtr _shape);
virtual void addVisualizationShape(const ShapePtr& _shape);

/// Remove a visualization Shape from this Entity
virtual void removeVisualizationShape(ShapePtr _shape);
virtual void removeVisualizationShape(const ShapePtr& _shape);

/// Remove all visualization Shapes from this Entity
virtual void removeAllVisualizationShapes();
Expand Down
4 changes: 1 addition & 3 deletions dart/dynamics/Shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#include "dart/math/Geometry.h"
#include "dart/common/Subject.h"
#include "dart/dynamics/SmartPointer.h"

namespace dart {
namespace renderer {
Expand Down Expand Up @@ -176,9 +177,6 @@ class Shape : public virtual common::Subject
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

typedef std::shared_ptr<Shape> ShapePtr;
typedef std::shared_ptr<const Shape> ConstShapePtr;

} // namespace dynamics
} // namespace dart

Expand Down
35 changes: 27 additions & 8 deletions dart/dynamics/SoftBodyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,32 @@ SoftBodyNode::~SoftBodyNode()
}

//==============================================================================
void SoftBodyNode::removeSoftBodyShapes()
ShapePtr SoftBodyNode::removeSoftBodyShapes()
{
for(size_t i=0; i<mEntityP.mVizShapes.size(); )
ShapePtr oldShape;
for(size_t i=0; i<mBodyP.mColShapes.size(); )
{
if(dynamic_cast<dynamics::SoftMeshShape*>(mEntityP.mVizShapes[i].get()))
removeVisualizationShape(mEntityP.mVizShapes[i]);
if(dynamic_cast<dynamics::SoftMeshShape*>(mBodyP.mColShapes[i].get()))
{
oldShape = mBodyP.mColShapes[i];
removeCollisionShape(oldShape);
}
else
++i;
}

for(size_t i=0; i<mBodyP.mColShapes.size(); )
for(size_t i=0; i<mEntityP.mVizShapes.size(); )
{
if(dynamic_cast<dynamics::SoftMeshShape*>(mBodyP.mColShapes[i].get()))
removeCollisionShape(mBodyP.mColShapes[i]);
if(dynamic_cast<dynamics::SoftMeshShape*>(mEntityP.mVizShapes[i].get()))
{
oldShape = mEntityP.mVizShapes[i];
removeVisualizationShape(oldShape);
}
else
++i;
}

return oldShape;
}

//==============================================================================
Expand All @@ -163,7 +172,7 @@ void SoftBodyNode::setProperties(const Properties& _properties)
void SoftBodyNode::setProperties(const UniqueProperties& _properties)
{
// SoftMeshShape pointers should not be copied between bodies
removeSoftBodyShapes();
ShapePtr oldShape = removeSoftBodyShapes();

size_t newCount = _properties.mPointProps.size();
size_t oldCount = mPointMasses.size();
Expand Down Expand Up @@ -207,6 +216,12 @@ void SoftBodyNode::setProperties(const UniqueProperties& _properties)
mSoftShape = std::shared_ptr<SoftMeshShape>(new SoftMeshShape(this));
addVisualizationShape(mSoftShape);
addCollisionShape(mSoftShape);

if(oldShape) // Copy the properties of the previous soft shape, if it exists
{
mSoftShape->setColor(oldShape->getRGBA());
mSoftShape->setLocalTransform(oldShape->getLocalTransform());
}
}

//==============================================================================
Expand Down Expand Up @@ -1175,6 +1190,10 @@ void SoftBodyNode::draw(renderer::RenderInterface* _ri,
// _ri->setPenColor(fleshColor);
// if (_showMeshs)
{
_ri->setPenColor(mSoftShape->getRGBA());
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

Eigen::Vector3d pos;
Eigen::Vector3d pos_normalized;
for (size_t i = 0; i < mSoftP.mFaces.size(); ++i)
Expand Down
4 changes: 2 additions & 2 deletions dart/dynamics/SoftBodyNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ class SoftBodyNode : public BodyNode
/// Set the Properties of this SoftBodyNode
void setProperties(const UniqueProperties& _properties);

/// Remove any unwarranted SoftBodyShapes
/// Remove all SoftBodyShapes and return the last one that was encountered
/// Note: This will be deprecated once VisualizationNodes and CollisionNodes
/// are implemented. Please see #394.
void removeSoftBodyShapes();
ShapePtr removeSoftBodyShapes();


/// Get the Properties of this SoftBodyNode
Expand Down
20 changes: 20 additions & 0 deletions dart/math/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,26 @@ inline Eigen::Vector3d Red()
return Eigen::Vector3d(0.9, 0.1, 0.1);
}

inline Eigen::Vector3d Fuschia()
{
return Eigen::Vector3d(1.0, 0.0, 0.5);
}

inline Eigen::Vector4d Fuschia(double alpha)
{
return Eigen::Vector4d(1.0, 0.0, 0.5, alpha);
}

inline Eigen::Vector4d Orange(double alpha)
{
return Eigen::Vector4d(1.0, 0.63, 0.0, alpha);
}

inline Eigen::Vector3d Orange()
{
return Eigen::Vector3d(1.0, 0.63, 0.0);
}

inline Eigen::Vector4d Green(double alpha)
{
return Eigen::Vector4d(0.1, 0.9, 0.1, alpha);
Expand Down
Loading