Skip to content

Commit

Permalink
[math] Merge integration into math
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Mar 23, 2024
1 parent f33fd04 commit 119b543
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 61 deletions.
2 changes: 0 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ IncludeCategories:
Priority: 28
- Regex: '^<dart\/lcpsolver\/.*\.h(pp)?>$'
Priority: 29
- Regex: '^<dart\/integration\/.*\.h(pp)?>$'
Priority: 30
- Regex: '^<dart\/math\/.*\.h(pp)?>$'
Priority: 31
- Regex: '^<dart\/common\/.*\.h(pp)?>$'
Expand Down
4 changes: 1 addition & 3 deletions dart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${DART_BINARY_DIR}/lib")
#===============================================================================
# common
# math
# integration
# lcpsolver
# optimizer
# ipopt
Expand All @@ -37,7 +36,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${DART_BINARY_DIR}/lib")
#===============================================================================
# Targets - {dependency targets}, source directories, [external dependency libs]
#===============================================================================
# dart - common, math, integration, lcpsolver, optimizer, dynamics, collision,
# dart - common, math, lcpsolver, optimizer, dynamics, collision,
# collision/dart, collision/fcl, constraint, simulation, [assimp, eigen3,
# fcl, fmt]
# dart-optimizer-ipopt - {dart}, optimizer/ipopt, [ipopt]
Expand Down Expand Up @@ -74,7 +73,6 @@ endfunction(dart_add_core_sources)
# Add subdirectories
add_subdirectory(common)
add_subdirectory(math)
add_subdirectory(integration)
add_subdirectory(lcpsolver)
add_subdirectory(optimizer)
add_subdirectory(dynamics)
Expand Down
2 changes: 1 addition & 1 deletion dart/dart.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <dart/config.hpp>
#include <dart/common/common.hpp>
#include <dart/math/math.hpp>
#include <dart/integration/integration.hpp>
#include <dart/math/math.hpp>
#include <dart/collision/collision.hpp>
#include <dart/lcpsolver/lcpsolver.hpp>
#include <dart/constraint/constraint.hpp>
Expand Down
20 changes: 0 additions & 20 deletions dart/integration/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/integration/EulerIntegrator.hpp"
#include "dart/math/EulerIntegrator.hpp"

namespace dart {
namespace integration {
namespace math {

//==============================================================================
EulerIntegrator::EulerIntegrator() : Integrator() {}
Expand All @@ -60,5 +60,5 @@ void EulerIntegrator::integrateVel(IntegrableSystem* _system, double _dt)
_system->integrateGenVels(_system->evalGenAccs(), _dt);
}

} // namespace integration
} // namespace math
} // namespace dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
#ifndef DART_INTEGRATION_EULERINTEGRATOR_HPP_
#define DART_INTEGRATION_EULERINTEGRATOR_HPP_

#include <dart/integration/Integrator.hpp>
#include <dart/math/Integrator.hpp>

namespace dart {
namespace integration {
namespace math {

/// \brief class EulerIntegrator
class EulerIntegrator : public Integrator
Expand All @@ -58,7 +58,7 @@ class EulerIntegrator : public Integrator
void integrateVel(IntegrableSystem* _system, double _dt) override;
};

} // namespace integration
} // namespace math
} // namespace dart

#endif // DART_INTEGRATION_EULERINTEGRATOR_HPP_
6 changes: 3 additions & 3 deletions dart/integration/Integrator.cpp → dart/math/Integrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/integration/Integrator.hpp"
#include "dart/math/Integrator.hpp"

namespace dart {
namespace integration {
namespace math {

//==============================================================================
IntegrableSystem::IntegrableSystem() {}
Expand All @@ -47,5 +47,5 @@ Integrator::Integrator() {}
//==============================================================================
Integrator::~Integrator() {}

} // namespace integration
} // namespace math
} // namespace dart
4 changes: 2 additions & 2 deletions dart/integration/Integrator.hpp → dart/math/Integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <vector>

namespace dart {
namespace integration {
namespace math {

/// \brief Any class that uses an integrator should implement this interface
class IntegrableSystem
Expand Down Expand Up @@ -98,7 +98,7 @@ class Integrator
virtual void integrateVel(IntegrableSystem* _system, double _dt) = 0;
};

} // namespace integration
} // namespace math
} // namespace dart

#endif // DART_INTEGRATION_INTEGRATOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/integration/RK4Integrator.hpp"
#include "dart/math/RK4Integrator.hpp"

namespace dart {
namespace integration {
namespace math {

//==============================================================================
RK4Integrator::RK4Integrator() {}
Expand Down Expand Up @@ -100,5 +100,5 @@ void RK4Integrator::integrate(IntegrableSystem* _system, double _dt)
1.0 / 6.0 * (ddq1 + (2.0 * ddq2) + (2.0 * ddq3) + ddq4), _dt);
}

} // namespace integration
} // namespace math
} // namespace dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
#ifndef DART_INTEGRATION_RK4INTEGRATOR_HPP_
#define DART_INTEGRATION_RK4INTEGRATOR_HPP_

#include <dart/integration/Integrator.hpp>
#include <dart/math/Integrator.hpp>

namespace dart {
namespace integration {
namespace math {

/// \brief class RK4Integrator
class RK4Integrator : public Integrator
Expand All @@ -62,7 +62,7 @@ class RK4Integrator : public Integrator
Eigen::VectorXd ddq1, ddq2, ddq3, ddq4;
};

} // namespace integration
} // namespace math
} // namespace dart

#endif // DART_INTEGRATION_RK4INTEGRATOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/integration/SemiImplicitEulerIntegrator.hpp"
#include "dart/math/SemiImplicitEulerIntegrator.hpp"

namespace dart {
namespace integration {
namespace math {

//==============================================================================
SemiImplicitEulerIntegrator::SemiImplicitEulerIntegrator() : Integrator() {}
Expand Down Expand Up @@ -63,5 +63,5 @@ void SemiImplicitEulerIntegrator::integrateVel(
_system->integrateGenVels(_system->evalGenAccs(), _dt);
}

} // namespace integration
} // namespace math
} // namespace dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
#ifndef DART_INTEGRATION_SEMIIMPLICITEULERINTEGRATOR_HPP_
#define DART_INTEGRATION_SEMIIMPLICITEULERINTEGRATOR_HPP_

#include <dart/integration/Integrator.hpp>
#include <dart/math/Integrator.hpp>

namespace dart {
namespace integration {
namespace math {

/// \brief class SemiImplicitEulerIntegrator
class SemiImplicitEulerIntegrator : public Integrator
Expand All @@ -58,7 +58,7 @@ class SemiImplicitEulerIntegrator : public Integrator
void integrateVel(IntegrableSystem* _system, double _dt) override;
};

} // namespace integration
} // namespace math
} // namespace dart

#endif // DART_INTEGRATION_SEMIIMPLICITEULERINTEGRATOR_HPP_
2 changes: 1 addition & 1 deletion dart/simulation/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "dart/constraint/BoxedLcpConstraintSolver.hpp"
#include "dart/constraint/ConstrainedGroup.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/integration/SemiImplicitEulerIntegrator.hpp"
#include "dart/math/SemiImplicitEulerIntegrator.hpp"

#include <iostream>
#include <string>
Expand Down
4 changes: 0 additions & 4 deletions dart/simulation/World.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@

namespace dart {

namespace integration {
class Integrator;
} // namespace integration

namespace dynamics {
class Skeleton;
} // namespace dynamics
Expand Down
10 changes: 5 additions & 5 deletions examples/deprecated_examples/glut_joint_constraints/MyWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ class MyWindow : public dart::gui::glut::SimWindow
/*
#include "Controller.hpp"
#include "dynamics/SkeletonDynamics.hpp"
#include "integration/EulerIntegrator.hpp"
#include "integration/RK4Integrator.hpp"
#include "math/EulerIntegrator.hpp"
#include "math/RK4Integrator.hpp"
#include "yui/Win3D.hpp"
#include <stdarg.h>
class MyWindow : public yui::Win3D, public integration::IntegrableSystem {
class MyWindow : public yui::Win3D, public math::IntegrableSystem {
public:
// MyWindow(dynamics::SkeletonDynamics* _m1, dynamics::SkeletonDynamics*
_m2) MyWindow(dynamics::SkeletonDynamics* _mList = 0, ...): Win3D() {
Expand Down Expand Up @@ -145,8 +145,8 @@ dynamics::SkeletonDynamics*); if(skel) mSkels.push_back(skel); else break;
int mPlayFrame;
bool mPlay;
bool mShowMarkers;
integration::EulerIntegrator mIntegrator;
// integration::RK4Integrator mIntegrator;
math::EulerIntegrator mIntegrator;
// math::RK4Integrator mIntegrator;
std::vector<Eigen::VectorXd> mBakedStates;
std::vector<dynamics::SkeletonDynamics*> mSkels;
Expand Down
1 change: 0 additions & 1 deletion scripts/code_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CHECK_DIRS="#../dart/collision\
../dart/constraint\
#../dart/dynamics\
#../dart/gui\
#../dart/integration\
#../dart/lcpsolver\
#../dart/math\
#../dart/optimizer\
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_MjcfParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TEST(MjcfParserTest, ParseDetailMujocoAnt)
EXPECT_EQ(compiler.getCoordinate(), Coordinate::LOCAL);

const auto& option = mujoco.getOption();
EXPECT_EQ(option.getIntegrator(), Integrator::RK4);
EXPECT_EQ(option.getIntegrator(), MjcfParser::detail::Integrator::RK4);
EXPECT_DOUBLE_EQ(option.getTimestep(), 0.01);

const auto& worldbody = mujoco.getWorldbody();
Expand Down

0 comments on commit 119b543

Please sign in to comment.