Skip to content

Commit

Permalink
Merge branch 'release-6.5'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CMakeLists.txt
#	examples/addDeleteSkels/CMakeLists.txt
#	examples/atlasSimbicon/CMakeLists.txt
#	examples/bipedStand/CMakeLists.txt
#	examples/hardcodedDesign/CMakeLists.txt
#	examples/hybridDynamics/CMakeLists.txt
#	examples/jointConstraints/CMakeLists.txt
#	examples/mixedChain/CMakeLists.txt
#	examples/operationalSpaceControl/CMakeLists.txt
#	examples/osgExamples/osgAtlasPuppet/CMakeLists.txt
#	examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt
#	examples/osgExamples/osgDragAndDrop/CMakeLists.txt
#	examples/osgExamples/osgEmpty/CMakeLists.txt
#	examples/osgExamples/osgHuboPuppet/CMakeLists.txt
#	examples/osgExamples/osgImGui/CMakeLists.txt
#	examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt
#	examples/osgExamples/osgSoftBodies/CMakeLists.txt
#	examples/osgExamples/osgTinkertoy/CMakeLists.txt
#	examples/rigidChain/CMakeLists.txt
#	examples/rigidLoop/CMakeLists.txt
#	examples/rigidShapes/CMakeLists.txt
#	examples/simpleFrames/CMakeLists.txt
#	examples/softBodies/CMakeLists.txt
#	examples/speedTest/CMakeLists.txt
#	examples/vehicle/CMakeLists.txt
#	package.xml
#	tutorials/tutorialBiped-Finished/CMakeLists.txt
#	tutorials/tutorialBiped/CMakeLists.txt
#	tutorials/tutorialCollisions-Finished/CMakeLists.txt
#	tutorials/tutorialCollisions/CMakeLists.txt
#	tutorials/tutorialDominoes-Finished/CMakeLists.txt
#	tutorials/tutorialDominoes/CMakeLists.txt
#	tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt
#	tutorials/tutorialMultiPendulum/CMakeLists.txt
  • Loading branch information
jslee02 committed Apr 29, 2018
2 parents ec04130 + 373434a commit 36a6a48
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 37 deletions.
27 changes: 0 additions & 27 deletions .ci/docker/ubuntu-artful

This file was deleted.

6 changes: 4 additions & 2 deletions .ci/docker/ubuntu-bionic
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ RUN apt-get install -y \
cmake \
pkg-config \
libassimp-dev \
libboost-all-dev \
libboost-filesystem-dev \
libboost-regex-dev \
libboost-system-dev \
libccd-dev \
libeigen3-dev \
libfcl-dev \
Expand All @@ -23,5 +25,5 @@ RUN apt-get install -y \
liburdfdom-dev \
liburdfdom-headers-dev \
libopenscenegraph-dev \
clang-format-3.8 \
# clang-format-3.8 \ # Disable until higher version is supported
lcov
4 changes: 3 additions & 1 deletion .ci/docker/ubuntu-xenial
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ RUN apt-get install -y \
cmake \
pkg-config \
libassimp-dev \
libboost-all-dev \
libboost-filesystem-dev \
libboost-regex-dev \
libboost-system-dev \
libccd-dev \
libeigen3-dev \
libfcl-dev \
Expand Down
4 changes: 3 additions & 1 deletion .ci/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ sudo apt-get -qq update
APT='
cmake
libassimp-dev
libboost-all-dev
libboost-filesystem-dev
libboost-regex-dev
libboost-system-dev
libccd-dev
libeigen3-dev
libfcl-dev
Expand Down
2 changes: 1 addition & 1 deletion .ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DDART_VERBOSE=ON -DDART_TREAT_WARNINGS_AS_ERRORS=ON -DDART_CODECOV=$CODECOV ..
if [ "$TRAVIS_OS_NAME" = "linux" ]; then make -j4 tutorials examples tests; else make -j4 tests; fi
if [ "$TRAVIS_OS_NAME" = "linux" ]; then make check-format; fi
if [ "$TRAVIS_OS_NAME" = "linux" ] && [ $(lsb_release -sc) = "trusty" ]; then make check-format; fi
if [ $CODECOV = ON ]; then make -j4 codecov; else ctest --output-on-failure -j4; fi

# Make sure we can install with no issues
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ matrix:
- os: linux
env: DOCKER_FILE="ubuntu-xenial" BUILD_TYPE=Release CODECOV=OFF COMPILER=GCC
services: docker
- os: linux
env: DOCKER_FILE="ubuntu-artful" BUILD_TYPE=Release CODECOV=OFF COMPILER=GCC
services: docker
- os: linux
env: DOCKER_FILE="ubuntu-bionic" BUILD_TYPE=Release CODECOV=OFF COMPILER=GCC
services: docker
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@

## DART 6

### DART 6.5.0 (201X-XX-XX)

* GUI

* Added FOV API to OSG viewer: [#1048](https://github.com/dartsim/dart/pull/1048)

* Simulation

* Added World::hasSkeleton(): [#1050](https://github.com/dartsim/dart/pull/1050)

### [DART 6.4.0 (2018-03-26)](https://github.com/dartsim/dart/milestone/39?closed=1)

* Common
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ if(TARGET dart)
add_subdirectory(unittests EXCLUDE_FROM_ALL)

# Add example subdirectories and an "examples" target.
add_subdirectory(examples)
add_subdirectory(examples EXCLUDE_FROM_ALL)
get_property(examples GLOBAL PROPERTY DART_EXAMPLES)
add_custom_target(examples DEPENDS ${examples})

Expand All @@ -291,7 +291,7 @@ if(TARGET dart)
endif(DART_VERBOSE)

# Add a "tutorials" target to build tutorials.
add_subdirectory(tutorials)
add_subdirectory(tutorials EXCLUDE_FROM_ALL)
get_property(tutorials GLOBAL PROPERTY DART_TUTORIALS)
add_custom_target(tutorials DEPENDS ${tutorials})

Expand Down
62 changes: 62 additions & 0 deletions dart/gui/osg/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,68 @@ const ::osg::ref_ptr<::osg::Group>& Viewer::getRootGroup() const
return mRootGroup;
}

//==============================================================================
void Viewer::setVerticalFieldOfView(const double fov)
{
double fovy;
double aspectRatio;
double zNear;
double zFar;

auto* camera = getCamera();

if (!camera)
{
dtwarn << "[Viewer::setMasterCameraFieldOfView] This viewer doesn't have "
<< "any cameras. Ignoring this request.\n";
return;
}

const bool result = camera->getProjectionMatrixAsPerspective(
fovy, aspectRatio, zNear, zFar);

if (!result)
{
dtwarn << "[Viewer::setMasterCameraFieldOfView] Attemping to set vertical "
<< "field of view while the camera isn't perspective view. "
<< "Ignoring this request.\n";
return;
}

camera->setProjectionMatrixAsPerspective(fov, aspectRatio, zNear, zFar);
}

//==============================================================================
double Viewer::getVerticalFieldOfView() const
{
double fovy;
double aspectRatio;
double zNear;
double zFar;

const auto* camera = getCamera();

if (!camera)
{
dtwarn << "[Viewer::getMasterCameraFieldOfView] This viewer doesn't have "
<< "any cameras. Returning 0.0.\n";
return 0.0;
}

const bool result = camera->getProjectionMatrixAsPerspective(
fovy, aspectRatio, zNear, zFar);

if (!result)
{
dtwarn << "[Viewer::getMasterCameraFieldOfView] Vertical field of view is "
<< "requested while the camera isn't perspective view. "
<< "Returning 0.0.\n";
return 0.0;
}

return fovy;
}

} // namespace osg
} // namespace gui
} // namespace dart
9 changes: 9 additions & 0 deletions dart/gui/osg/Viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ class Viewer : public osgViewer::Viewer, public dart::common::Subject
/// Get the root ::osg::Group of this Viewer
const ::osg::ref_ptr<::osg::Group>& getRootGroup() const;

/// Sets the vertical field of view of the master camera of the view.
/// \param[in] fov Vertical field of view in degrees.
void setVerticalFieldOfView(double fov);

/// Returns the vertical field of view of the master camera of the view.
/// \return Vertical field of view in degrees if the camera is perspective
/// view, 0.0 otherwise.
double getVerticalFieldOfView() const;

protected:

friend class SaveScreen;
Expand Down
7 changes: 7 additions & 0 deletions dart/simulation/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ std::set<dynamics::SkeletonPtr> World::removeAllSkeletons()
return ptrs;
}

//==============================================================================
bool World::hasSkeleton(const dynamics::ConstSkeletonPtr& skeleton) const
{
return std::find(mSkeletons.begin(), mSkeletons.end(), skeleton)
!= mSkeletons.end();
}

//==============================================================================
int World::getIndex(int _index) const
{
Expand Down
3 changes: 3 additions & 0 deletions dart/simulation/World.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class World : public virtual common::Subject
/// pointers to them, in case you want to recycle them
std::set<dynamics::SkeletonPtr> removeAllSkeletons();

/// Returns wether this World contains a Skeleton.
bool hasSkeleton(const dynamics::ConstSkeletonPtr& skeleton) const;

/// Get the dof index for the indexed skeleton
int getIndex(int _index) const;

Expand Down
9 changes: 9 additions & 0 deletions unittests/comprehensive/test_World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,16 @@ TEST(World, AddingAndRemovingSkeletons)
for (int i = 0; i < nSteps; ++i)
world->step();

EXPECT_FALSE(world->hasSkeleton(skeleton1));
EXPECT_FALSE(world->hasSkeleton(skeleton2));
EXPECT_FALSE(world->hasSkeleton(skeleton3));
EXPECT_FALSE(world->hasSkeleton(skeleton4));

// Add skeleton1, skeleton2
world->addSkeleton(skeleton1);
EXPECT_TRUE(world->hasSkeleton(skeleton1));
world->addSkeleton(skeleton2);
EXPECT_TRUE(world->hasSkeleton(skeleton2));
EXPECT_TRUE(world->getNumSkeletons() == 2);
for (int i = 0; i < nSteps; ++i)
world->step();
Expand All @@ -119,7 +126,9 @@ TEST(World, AddingAndRemovingSkeletons)

// Add skeleton3, skeleton4
world->addSkeleton(skeleton3);
EXPECT_TRUE(world->hasSkeleton(skeleton3));
world->addSkeleton(skeleton4);
EXPECT_TRUE(world->hasSkeleton(skeleton4));
EXPECT_TRUE(world->getNumSkeletons() == 3);
for (int i = 0; i < nSteps; ++i)
world->step();
Expand Down

0 comments on commit 36a6a48

Please sign in to comment.