Skip to content

Commit

Permalink
Merge pull request #309 from dartsim/release-4.3_fix_api_compatibility
Browse files Browse the repository at this point in the history
Fix API compatibility of dart 4.3
  • Loading branch information
jslee02 committed Jan 22, 2015
2 parents b0e0a74 + 150f226 commit bdc7000
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 15 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,17 @@ if(HAVE_BULLET_COLLISION)
link_directories("${BULLET_LIBRARY_DIRS}")
endif()

#===============================================================================
# Check for non-case-sensitive filesystems
#===============================================================================
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/case_sensitive_filesystem
RESULT_VARIABLE FILESYSTEM_CASE_SENSITIVE_RETURN)
if (${FILESYSTEM_CASE_SENSITIVE_RETURN} EQUAL 0)
set(FILESYSTEM_CASE_SENSITIVE TRUE)
else()
set(FILESYSTEM_CASE_SENSITIVE FALSE)
endif()

#===============================================================================
# Compiler flags
#===============================================================================
Expand Down
30 changes: 30 additions & 0 deletions cmake/DARTMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,33 @@ macro(dart_add_library _name)
VERSION "${DART_VERSION}"
)
endmacro()

#===============================================================================
# Copied from https://bitbucket.org/osrf/gazebo/pull-request/638 and will be
# removed by DART 5.0
#===============================================================================
macro (dt_install_includes _subdir)
install(FILES ${ARGN} DESTINATION include/dart/${_subdir} COMPONENT headers)
endmacro()

#===============================================================================
# Deprecated header files
# Install until next gazebo version on case-sensitive filesystems
# Copied from https://bitbucket.org/osrf/gazebo/pull-request/638 and will be
# removed by DART 5.0
#===============================================================================
macro(dt_issue_303 _name _output_name)
if (FILESYSTEM_CASE_SENSITIVE)
if (${DART_VERSION} VERSION_GREATER 4.3)
message(WARNING "Installing deprecated ${_name}.hh. This should be removed after DART 4.3")
endif()
set(generated_file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.h")
execute_process(
COMMAND bash ${PROJECT_SOURCE_DIR}/tools/issue_303_generator.bash ${_name} ${_output_name}
OUTPUT_FILE ${generated_file}
)
string(TOLOWER ${_name} nameLower)
dt_install_includes(${nameLower} ${generated_file})
endif()
endmacro()

3 changes: 3 additions & 0 deletions dart/constraint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ install(
#install(TARGETS dart_constraint EXPORT DARTCoreTargets DESTINATION lib)
#install(TARGETS dart_constraint EXPORT DARTTargets DESTINATION lib)

# Deprecated Constraint.h
dt_issue_303("Constraint" "ConstraintBase")

5 changes: 5 additions & 0 deletions dart/constraint/ConstraintBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

#include <cstddef>

#include "dart/common/Deprecated.h"

namespace dart {

namespace dynamics {
Expand Down Expand Up @@ -134,6 +136,9 @@ class ConstraintBase
size_t mDim;
};

DEPRECATED(4.3)
typedef ConstraintBase Constraint;

} // namespace constraint
} // namespace dart

Expand Down
1 change: 0 additions & 1 deletion dart/constraint/DantzigLCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "dart/common/Console.h"
#include "dart/constraint/ConstraintBase.h"
#include "dart/constraint/ConstrainedGroup.h"
#include "dart/lcpsolver/LCPSolver.h"
#include "dart/lcpsolver/Lemke.h"
#include "dart/lcpsolver/lcp.h"

Expand Down
1 change: 0 additions & 1 deletion dart/constraint/PGSLCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "dart/common/Console.h"
#include "dart/constraint/ConstraintBase.h"
#include "dart/constraint/ConstrainedGroup.h"
#include "dart/lcpsolver/LCPSolver.h"
#include "dart/lcpsolver/Lemke.h"
#include "dart/lcpsolver/lcp.h"

Expand Down
3 changes: 3 additions & 0 deletions dart/lcpsolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ install(
#install(TARGETS dart_lcpsolver EXPORT DARTCoreTargets DESTINATION lib)
#install(TARGETS dart_lcpsolver EXPORT DARTTargets DESTINATION lib)

# Deprecated LCPSolver.h
dt_issue_303("LCPSolver" "ODELCPSolver")

14 changes: 7 additions & 7 deletions dart/lcpsolver/LCPSolver.cpp → dart/lcpsolver/ODELCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/lcpsolver/LCPSolver.h"
#include "dart/lcpsolver/ODELCPSolver.h"

#include <cstdio>

Expand All @@ -45,13 +45,13 @@
namespace dart {
namespace lcpsolver {

LCPSolver::LCPSolver() {
ODELCPSolver::ODELCPSolver() {
}

LCPSolver::~LCPSolver() {
ODELCPSolver::~ODELCPSolver() {
}

bool LCPSolver::Solve(const Eigen::MatrixXd& _A,
bool ODELCPSolver::Solve(const Eigen::MatrixXd& _A,
const Eigen::VectorXd& _b,
Eigen::VectorXd* _x,
int _numContacts,
Expand Down Expand Up @@ -129,7 +129,7 @@ bool LCPSolver::Solve(const Eigen::MatrixXd& _A,
}
}

void LCPSolver::transferToODEFormulation(const Eigen::MatrixXd& _A,
void ODELCPSolver::transferToODEFormulation(const Eigen::MatrixXd& _A,
const Eigen::VectorXd& _b,
Eigen::MatrixXd* _AOut,
Eigen::VectorXd* _bOut,
Expand Down Expand Up @@ -170,7 +170,7 @@ void LCPSolver::transferToODEFormulation(const Eigen::MatrixXd& _A,
AIntermediate.col(_numContacts * (_numDir + 2) + i);
}

void LCPSolver::transferSolFromODEFormulation(const Eigen::VectorXd& _x,
void ODELCPSolver::transferSolFromODEFormulation(const Eigen::VectorXd& _x,
Eigen::VectorXd* _xOut,
int _numDir,
int _numContacts) {
Expand All @@ -190,7 +190,7 @@ void LCPSolver::transferSolFromODEFormulation(const Eigen::VectorXd& _x,
(*_xOut)[_numContacts * (2 + _numDir) + i] = _x[_numContacts * 3 + i];
}

bool LCPSolver::checkIfSolution(const Eigen::MatrixXd& _A,
bool ODELCPSolver::checkIfSolution(const Eigen::MatrixXd& _A,
const Eigen::VectorXd& _b,
const Eigen::VectorXd& _x) {
const double threshold = 1e-4;
Expand Down
16 changes: 10 additions & 6 deletions dart/lcpsolver/LCPSolver.h → dart/lcpsolver/ODELCPSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef DART_LCPSOLVER_LCPSOLVER_H_
#define DART_LCPSOLVER_LCPSOLVER_H_
#ifndef DART_LCPSOLVER_ODELCPSOLVER_H_
#define DART_LCPSOLVER_ODELCPSOLVER_H_

#include <Eigen/Dense>
#include "dart/common/Deprecated.h"

namespace dart {
namespace lcpsolver {

/// \brief
class LCPSolver {
class ODELCPSolver {
public:
/// \brief
LCPSolver();
ODELCPSolver();

/// \brief
virtual ~LCPSolver();
virtual ~ODELCPSolver();

/// \brief
bool Solve(const Eigen::MatrixXd& _A,
Expand Down Expand Up @@ -81,7 +82,10 @@ class LCPSolver {
const Eigen::VectorXd& _x);
};

DEPRECATED(4.3)
typedef ODELCPSolver LCPSolver;

} // namespace lcpsolver
} // namespace dart

#endif // DART_LCPSOLVER_LCPSOLVER_H_
#endif // DART_LCPSOLVER_ODELCPSOLVER_H_
12 changes: 12 additions & 0 deletions tools/case_sensitive_filesystem
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Create a temporary file
tmpFile=`mktemp /tmp/CaseSensitiveXXXXXXXX`
if [ -f `echo $tmpFile | tr '[A-Z]' '[a-z]'` ]
then
#echo Not Case Sensitive
rm $tmpFile
exit 1
fi
#echo Case Sensitive
rm $tmpFile
32 changes: 32 additions & 0 deletions tools/issue_303_generator.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
lower=`echo $1 | tr '[:upper:]' '[:lower:]'`
guard=DART_`echo $1 | tr '[:lower:]' '[:upper:]'`_`echo $1 | tr '[:lower:]' '[:upper:]'`_H_
cat <<END
/*
* Copyright 2013 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef $guard
#define $guard
// Deprecated header file for case-sensitive filesystems
#warning The dart/$lower/$1.h header file is deprecated \\
as of dart 4.3 and will be removed in the next release. \\
Please include dart/$lower/$2.h instead.
#include "dart/$lower/$2.h"
#endif
END

0 comments on commit bdc7000

Please sign in to comment.