Skip to content

Remove tropter #3988

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

Merged
merged 19 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ IncludeCategories:
Priority: 3
- Regex: '^(<OpenSim/)'
Priority: 4
- Regex: '^(<tropter/)'
Priority: 5
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
Expand Down
3 changes: 0 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
.git
opensim-models
Moco
tropter
dependencies/casadi
dependencies/colpack
dependencies/docopt
dependencies/eigen
dependencies/opensim-core
dependencies/simbody
43 changes: 19 additions & 24 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# /W0 disables warnings.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# TODO: CMake provides /W3, which overrides our /W0
cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_TROPTER=ON -DOPENSIM_WITH_CASADI=ON
cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_CASADI=ON
cmake --build . --config Release -- /maxcpucount:4

- name: Configure opensim-core
Expand All @@ -76,7 +76,7 @@ jobs:
# TODO: Can remove /WX when we use that in CMakeLists.txt.
# Set the CXXFLAGS environment variable to turn warnings into errors.
# Skip timing test section included by default.
cmake -E env CXXFLAGS="/WX -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DOPENSIM_WITH_TROPTER=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.10.11\x64
cmake -E env CXXFLAGS="/WX -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.10.11\x64
$env:match = cmake -L . | Select-String -Pattern OPENSIM_QUALIFIED_VERSION
$version = $env:match.split('=')[1]
echo $version
Expand All @@ -103,13 +103,13 @@ jobs:
Copy-Item -Path "~/opensim-core-install" -Destination "opensim-core-${{ steps.configure.outputs.version }}" -Recurse
7z a "opensim-core-${{ steps.configure.outputs.version }}.zip" "opensim-core-${{ steps.configure.outputs.version }}"

- name: Test Python bindings
run: |
echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# Move to the installed location of the python package.
cd ~/opensim-core-install/sdk/python
# Run python tests.
python -m unittest discover --start-directory opensim/tests --verbose
# - name: Test Python bindings
# run: |
# echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# # Move to the installed location of the python package.
# cd ~/opensim-core-install/sdk/python
# # Run python tests.
# python -m unittest discover --start-directory opensim/tests --verbose

- name: Upload opensim-core
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
# /W0 disables warnings.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# TODO: CMake provides /W3, which overrides our /W0
cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_TROPTER=ON -DOPENSIM_WITH_CASADI=ON
cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_CASADI=ON
cmake --build . --config Release -- /maxcpucount:4

- name: Configure opensim-core
Expand All @@ -181,7 +181,7 @@ jobs:
# TODO: Can remove /WX when we use that in CMakeLists.txt.
# Set the CXXFLAGS environment variable to turn warnings into errors.
# Skip timing test section included by default.
cmake -E env CXXFLAGS="/WX -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DOPENSIM_WITH_TROPTER=on -DOPENSIM_WITH_CASADI=on -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.10.11\x64
cmake -E env CXXFLAGS="/WX -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DOPENSIM_WITH_CASADI=on -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.10.11\x64
$env:match = cmake -L . | Select-String -Pattern OPENSIM_QUALIFIED_VERSION
$version = $env:match.split('=')[1]
echo $version
Expand Down Expand Up @@ -209,13 +209,13 @@ jobs:
Copy-Item -Path "~/opensim-core-install" -Destination "opensim-core-${{ steps.configure.outputs.version }}" -Recurse
7z a "opensim-core-${{ steps.configure.outputs.version }}.zip" "opensim-core-${{ steps.configure.outputs.version }}"

- name: Test Python bindings
run: |
echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# Move to the installed location of the python package.
cd ~/opensim-core-install/sdk/python
# Run python tests.
python -m unittest discover --start-directory opensim/tests --verbose
# - name: Test Python bindings
# run: |
# echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# # Move to the installed location of the python package.
# cd ~/opensim-core-install/sdk/python
# # Run python tests.
# python -m unittest discover --start-directory opensim/tests --verbose

- name: Upload opensim-core
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -277,7 +277,7 @@ jobs:
# /W0 disables warnings.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# TODO: CMake provides /W3, which overrides our /W0
cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_TROPTER=ON -DOPENSIM_WITH_CASADI=ON
cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_CASADI=ON
cmake --build . --config Release -- /maxcpucount:4

- name: Configure opensim-core
Expand Down Expand Up @@ -472,7 +472,6 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_TROPTER=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_DISABLE_LOG_FILE=ON)
DEP_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=11)
Expand Down Expand Up @@ -599,7 +598,6 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_TROPTER=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_DISABLE_LOG_FILE=ON)
DEP_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=11)
Expand Down Expand Up @@ -727,7 +725,6 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_TROPTER=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_DISABLE_LOG_FILE=ON)
DEP_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=11)
Expand Down Expand Up @@ -921,7 +918,6 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_TROPTER=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
printf '%s\n' "${DEP_CMAKE_ARGS[@]}"
cmake "${DEP_CMAKE_ARGS[@]}"
Expand Down Expand Up @@ -1034,7 +1030,6 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_TROPTER=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
printf '%s\n' "${DEP_CMAKE_ARGS[@]}"
cmake "${DEP_CMAKE_ARGS[@]}"
Expand Down
2 changes: 1 addition & 1 deletion Bindings/Java/Matlab/examples/Moco/exampleOptimizeMass.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

problem.addGoal(endpointCost);

solver = study.initTropterSolver();
solver = study.initCasADiSolver();

study.print('optimize_mass.omoco');

Expand Down
12 changes: 6 additions & 6 deletions Bindings/Java/Matlab/tests/testMocoWorkflow.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ function testChangingTimeBounds(testCase)
problem.setControlInfo('/actuator', [-10, 10]);
problem.addGoal(MocoFinalTimeGoal());

if MocoTropterSolver.isAvailable()
solver = study.initTropterSolver();
if MocoCasADiSolver.isAvailable()
solver = study.initCasADiSolver();
solver.set_transcription_scheme('trapezoidal')
solver.set_num_mesh_intervals(19);
guess = solver.createGuess('random');
Expand Down Expand Up @@ -133,8 +133,8 @@ function testChangingModel(testCase)
problem.setStateInfo('/slider/position/value', [0, 1], 0, 1);
problem.setStateInfo('/slider/position/speed', [-100, 100], 0, 0);
problem.addGoal(MocoFinalTimeGoal());
if MocoTropterSolver.isAvailable()
solver = study.initTropterSolver();
if MocoCasADiSolver.isAvailable()
solver = study.initCasADiSolver();
solver.set_num_mesh_intervals(20);
finalTime0 = study.solve().getFinalTime();

Expand All @@ -157,8 +157,8 @@ function testOrder(testCase)
problem.setStateInfo('/slider/position/speed', [-100, 100], 0, 0);
problem.addGoal(MocoFinalTimeGoal());
problem.setModel(createSlidingMassModel());
if MocoTropterSolver.isAvailable()
solver = study.initTropterSolver();
if MocoCasADiSolver.isAvailable()
solver = study.initCasADiSolver();
solver.set_num_mesh_intervals(20);
finalTime = study.solve().getFinalTime();

Expand Down
1 change: 0 additions & 1 deletion Bindings/OpenSimHeaders_moco.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <OpenSim/Moco/MocoStudyFactory.h>
#include <OpenSim/Moco/MocoTrack.h>
#include <OpenSim/Moco/MocoTrajectory.h>
#include <OpenSim/Moco/MocoTropterSolver.h>
#include <OpenSim/Moco/MocoUtilities.h>
#include <OpenSim/Moco/MocoWeightSet.h>
#include <OpenSim/Moco/ModelOperatorsDGF.h>
Expand Down
5 changes: 1 addition & 4 deletions Bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,11 @@ if(OPENSIM_WITH_CASADI)
list(APPEND PYTHON_EXAMPLES_UNITTEST_ARGS
Moco.exampleKinematicConstraints
Moco.exampleSlidingMass
)
endif()
if(OPENSIM_WITH_TROPTER)
list(APPEND PYTHON_EXAMPLES_UNITTEST_ARGS
Moco.exampleOptimizeMass
Moco.examplePredictAndTrack
)
endif()

# Similar as above, but for the example files. These files aren't named as
# test_*.py, so we must specify a more general search pattern.
add_test(NAME python_examples
Expand Down
2 changes: 1 addition & 1 deletion Bindings/Python/examples/Moco/exampleOptimizeMass.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

# Configure the solver.
# =====================
solver = moco.initTropterSolver()
solver = moco.initCasADiSolver()

# Now that we've finished setting up the study, print it to a file.
moco.printToXML('optimize_mass.omoco')
Expand Down
12 changes: 3 additions & 9 deletions Bindings/Python/examples/Moco/examplePredictAndTrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def solvePrediction():


# Configure the solver.
solver = study.initTropterSolver()
solver = study.initCasADiSolver()
solver.set_num_mesh_intervals(100)
solver.set_verbosity(2)
solver.set_optim_solver("ipopt")
Expand Down Expand Up @@ -230,13 +230,10 @@ def solveStateTracking(stateRef):
# TODO problem.addGoal(effort)

# Configure the solver.
solver = study.initTropterSolver()
solver = study.initCasADiSolver()
solver.set_num_mesh_intervals(50)
solver.set_verbosity(2)
solver.set_optim_solver("ipopt")
solver.set_optim_jacobian_approximation("exact")
solver.set_optim_hessian_approximation("exact")
solver.set_exact_hessian_block_sparsity_mode("dense")

# Save the problem to a setup file for reference.
study.printToXML("examplePredictAndTrack_track_states.omoco")
Expand Down Expand Up @@ -285,13 +282,10 @@ def solveMarkerTracking(markersRef, guess):
# problem.addGoal(effort)

# Configure the solver.
solver = study.initTropterSolver()
solver = study.initCasADiSolver()
solver.set_num_mesh_intervals(50)
solver.set_verbosity(2)
solver.set_optim_solver("ipopt")
solver.set_optim_jacobian_approximation("exact")
solver.set_optim_hessian_approximation("exact")
solver.set_exact_hessian_block_sparsity_mode("dense")

solver.setGuess(guess)

Expand Down
18 changes: 9 additions & 9 deletions Bindings/Python/tests/test_moco.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ def test_changing_time_bounds(self):
problem.setControlInfo("/actuator", [-10, 10])
problem.addGoal(osim.MocoFinalTimeGoal())

if osim.MocoTropterSolver.isAvailable():
solver = study.initTropterSolver()
if osim.MocoCasADiSolver.isAvailable():
solver = study.initCasADiSolver()
solver.set_transcription_scheme("trapezoidal")
solver.set_num_mesh_intervals(19)
guess = solver.createGuess("random")
Expand All @@ -364,8 +364,8 @@ def test_changing_model(self):
problem.setStateInfo("/slider/position/value", [0, 1], 0, 1)
problem.setStateInfo("/slider/position/speed", [-100, 100], 0, 0)
problem.addGoal(osim.MocoFinalTimeGoal())
if osim.MocoTropterSolver.isAvailable():
solver = study.initTropterSolver()
if osim.MocoCasADiSolver.isAvailable():
solver = study.initCasADiSolver()
solver.set_num_mesh_intervals(19)
solver.set_transcription_scheme("trapezoidal");
finalTime0 = study.solve().getFinalTime()
Expand All @@ -386,8 +386,8 @@ def test_order(self):
problem.setStateInfo("/slider/position/speed", [-100, 100], 0, 0)
problem.addGoal(osim.MocoFinalTimeGoal())
problem.setModel(createSlidingMassModel())
if osim.MocoTropterSolver.isAvailable():
solver = study.initTropterSolver()
if osim.MocoCasADiSolver.isAvailable():
solver = study.initCasADiSolver()
solver.set_num_mesh_intervals(19)
solver.set_transcription_scheme("trapezoidal")
finalTime = study.solve().getFinalTime()
Expand All @@ -404,8 +404,8 @@ def test_changing_costs(self):
problem.updPhase().addGoal(osim.MocoFinalTimeGoal())
effort = osim.MocoControlGoal("effort")
problem.updPhase().addGoal(effort)
if osim.MocoTropterSolver.isAvailable():
solver = study.initTropterSolver()
if osim.MocoCasADiSolver.isAvailable():
solver = study.initCasADiSolver()
solver.set_transcription_scheme("trapezoidal");
finalTime0 = study.solve().getFinalTime()

Expand Down Expand Up @@ -436,7 +436,7 @@ def test_expression_based_parameter_goal(self):
mass_goal.addParameter(parameter, "p")
mass_goal.addParameter(parameter2, "q")

ms = study.initTropterSolver()
ms = study.initCasADiSolver()
ms.set_num_mesh_intervals(25)
sol = study.solve()

Expand Down
4 changes: 0 additions & 4 deletions Bindings/moco.i
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ EXPOSE_BOUNDS_CONSTRUCTORS_HELPER(MocoFinalBounds);
%include <OpenSim/Moco/MocoDirectCollocationSolver.h>


namespace OpenSim {
%ignore MocoTropterSolver::MocoTropterSolver(const MocoProblem&);
}
%include <OpenSim/Moco/MocoTropterSolver.h>
%include <OpenSim/Moco/MocoCasADiSolver/MocoCasADiSolver.h>
%include <OpenSim/Moco/MocoStudy.h>
%template(analyzeVec3) OpenSim::MocoStudy::analyze<SimTK::Vec3>;
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ v4.6
The default behavior of `ModOpAddReserves` remains the same, but a new constructor has been added to enable skipping coordinates associated
with residual forces so that they can be set separately with `ModOpAddResiduals`. (#4008)
- Added convenience methods to `MocoTrack` to allow setting marker weights from a `Set<MarkerWeight>` or `IKTaskSet`. (#4008)
- Remove the `tropter` libraries, the Tropter solver in Moco, and all references to it from build system. As a result, the following
Tropter-related dependencies have been removed: `adolc`, `colpack`, and `eigen`. (#3988)


v4.5.1
Expand Down
Loading
Loading