Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ba80a54
Fix module name
alxbilger Jul 11, 2024
7895f03
Merge pull request #113 from alxbilger/modulename
adagolodjo Jul 16, 2024
b875dc4
Remove references to python (2)
hugtalbot Jul 23, 2024
9dd53c3
Rename the docs folder to tutorial and testScene to tutorial_scenes a…
adagolodjo Jul 24, 2024
f11e8e8
Merge pull request #118 from SofaDefrost/hugtalbot-patch-2
adagolodjo Jul 25, 2024
f929c17
Fix aliases due to SOFA changes
alxbilger Jul 26, 2024
64532bc
fix for gcc (#1)
fredroy Jul 29, 2024
d4dd51d
Merge pull request #119 from alxbilger/fixaliases
fredroy Jul 31, 2024
52c6d20
[Scenes] Remove merge symbols in cosseratObject.py (#116)
fredroy Jul 31, 2024
dd6da7d
Fix compilation with SoftRobots (#122)
fredroy Jul 31, 2024
36d90df
Resolve remaining bugs related to SoftRobot plugin compilation issues…
adagolodjo Sep 2, 2024
88316a4
Fix compilation after rename
alxbilger Sep 2, 2024
aab47ca
more fixes
alxbilger Sep 3, 2024
4b4ec43
Merge pull request #126 from alxbilger/fixafterrename
adagolodjo Sep 5, 2024
152f475
Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows …
dependabot[bot] Sep 6, 2024
0d1dcdf
Update README.md (#131)
hugtalbot Sep 16, 2024
5d27dd5
Deprecated `CosseratObject` prefab (#130)
adagolodjo Sep 20, 2024
54ea0dd
Cleaning RigidDistanceMapping (#133)
alxbilger Nov 14, 2024
213e4c4
Prevent crash in unit tests (#132)
alxbilger Nov 14, 2024
b102dd9
Fix argument name after rename (#134)
alxbilger Nov 14, 2024
3ac0327
Fix PCS and PNLS scenes (#140)
alxbilger Nov 29, 2024
6fcce88
Fix cosseratObject.py (#139)
alxbilger Nov 29, 2024
05d1dd8
Fix needle insertion due to module path not updated (#138)
alxbilger Nov 29, 2024
65960d0
fix scene nonLinearCosserat.py (#137)
alxbilger Nov 29, 2024
ad8b012
Fix init of LegendrePolynomialsMapping (#136)
alxbilger Nov 29, 2024
cf5ac13
Remove unused import of gmsh
alxbilger Dec 3, 2024
5a6fd97
Merge pull request #142 from alxbilger/gmsh
adagolodjo Dec 3, 2024
1570460
Refactor PCS_Example3.py: Remove unused code, fix variable names, and…
adagolodjo Dec 4, 2024
129c9b1
Remove createScene as the scene is empty (#143)
alxbilger Dec 6, 2024
622e3c6
disable one test (#146)
alxbilger Dec 6, 2024
bac7519
Update scene completDirectNeedleInsertion (#144)
alxbilger Dec 6, 2024
0daabee
Apply new registration mechanism (#141)
bakpaul Jan 9, 2025
112626d
Update runner from macos-12 to macos-13 because it is deprecated
alxbilger Jan 9, 2025
b3c1039
Merge pull request #151 from alxbilger/updaterunner
bakpaul Jan 9, 2025
c03c058
Merge pull request #152
damienmarchal Jan 23, 2025
9ef7da8
refactor(mapping): improve documentation and code organization in map…
adagolodjo Jan 23, 2025
880bf14
Fix compilation further to Lifecycle v25.06 (#154)
hugtalbot Feb 18, 2025
be73e1e
Update ci.yml
EulalieCoevoet Mar 28, 2025
25c83c4
[ci] adds nightly builds
EulalieCoevoet Apr 4, 2025
17d7ded
Merge pull request #155 from SofaDefrost/EulalieCoevoet-patch-1
adagolodjo Apr 4, 2025
4a99254
Apply changes from SOFA PR 5666 regarding GenericConstraintSolver
bakpaul Aug 26, 2025
3d63275
Add missing example
bakpaul Aug 26, 2025
9320bd1
[forcefield] implements buildStiffnessMatrix
EulalieCoevoet Oct 14, 2025
f70ede0
cleaning
EulalieCoevoet Oct 14, 2025
16fbad9
cleaning
EulalieCoevoet Oct 14, 2025
f6a4f35
Merge pull request #158 from bakpaul/25_08_apply_changes_from_5666
hugtalbot Oct 16, 2025
31aaf6d
Merge pull request #160 from EulalieCoevoet/pr_buildstiffnessmatrix
hugtalbot Feb 26, 2026
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
33 changes: 24 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Cosserat-CI

# Controls when the action will run.
on:
# This is used to automatically publish nightlies at UTC nighttime
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
workflow_dispatch:
pull_request:
push:
Expand All @@ -14,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
os: [ubuntu-22.04, macos-14, windows-2022]
sofa_branch: [master]
python_version: ['3.10']

Expand Down Expand Up @@ -62,16 +65,28 @@ jobs:
ccache -s
fi

- name: Sanitize artifact name
id: sanitize
# This step removes special characters from the artifact name to ensure compatibility with upload-artifact
# Characters removed: " : < > | * ? \r \n \ /
# Spaces are replaced with underscores
# This sanitization prevents errors in artifact creation and retrieval
shell: pwsh
run: |
$originalName = "Cosserat_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
$artifact_name = $originalName -replace '[":;<>|*?\r\n\\/]', '' -replace ' ', '_'
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT

- name: Create artifact
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4.4.0
with:
name: CosseratPlugin_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
name: ${{ steps.sanitize.outputs.artifact_name }}
path: ${{ env.WORKSPACE_INSTALL_PATH }}

- name: Install artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4.1.7
with:
name: CosseratPlugin_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
name: ${{ steps.sanitize.outputs.artifact_name }}
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}

# - name: Set env vars for tests
Expand Down Expand Up @@ -119,7 +134,7 @@ jobs:
continue-on-error: true
steps:
- name: Get artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4.1.7
with:
path: artifacts

Expand All @@ -138,6 +153,6 @@ jobs:
fail_on_unmatched_files: false
target_commitish: ${{ github.sha }}
files: |
artifacts/CosseratPlugin_*_Linux.zip
artifacts/CosseratPlugin_*_Windows.zip
artifacts/CosseratPlugin_*_macOS.zip
artifacts/Cosserat_*_Linux.zip
artifacts/Cosserat_*_Windows.zip
artifacts/Cosserat_*_macOS.zip
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ sofa_find_package(Sofa.GL REQUIRED)
sofa_find_package(Sofa.Component.Topology.Container.Dynamic REQUIRED)

sofa_find_package(STLIB QUIET)

if(STLIB_FOUND)
message("-- Found dependency : 'STLIB' plugin .")
else()
Expand Down Expand Up @@ -67,8 +68,12 @@ set(SOURCE_FILES
${SRC_ROOT_DIR}/constraint/CosseratNeedleSlidingConstraint.cpp
)


sofa_find_package(SoftRobots QUIET)
if(SoftRobots_FOUND)
message("-- Found dependency : 'SoftRobots' plugin .")

set(COSSERAT_USES_SOFTROBOTS ON)
list(APPEND HEADER_FILES
${SRC_ROOT_DIR}/constraint/CosseratActuatorConstraint.h
${SRC_ROOT_DIR}/constraint/CosseratActuatorConstraint.inl
Expand All @@ -81,14 +86,19 @@ if(SoftRobots_FOUND)

${SRC_ROOT_DIR}/constraint/QPSlidingConstraint.cpp
)
else()
message("-- SoftRobots dependency has not been found, some features like QPSlidingConstraint and CosseratActuatorConstraint will not be available. ")
endif()


file(GLOB_RECURSE RESOURCE_FILES "*.md" "*.psl" "*.py" "*.pyscn" "*.py3scn" "*.scn" "*.ah")


if(WIN32)
add_definitions(-D_WINSOCKAPI_)
endif()


add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${DOC_FILES} )
target_link_libraries(${PROJECT_NAME}
Sofa.Component.Constraint.Lagrangian.Model
Expand All @@ -98,16 +108,15 @@ target_link_libraries(${PROJECT_NAME}
Sofa.Component.Topology.Container.Dynamic
)


if(Sofa.GL_FOUND)
target_link_libraries(${PROJECT_NAME} Sofa.GL)
endif()

if(SoftRobots_FOUND)
target_link_libraries(${PROJECT_NAME} SoftRobots)
message("-- Found dependency: 'SoftRobots' plugin.")
endif()

sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")

find_file(SofaPython3Tools NAMES "SofaPython3/lib/cmake/SofaPython3/SofaPython3Tools.cmake")
if(SofaPython3Tools)
Expand All @@ -130,7 +139,6 @@ if(SofaPython3Tools OR SofaPython3_FOUND)
endif()



## Install rules for the library and headers; CMake package configurations files
sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
Expand All @@ -150,6 +158,7 @@ if(COSSERAT_BUILD_TESTS)
add_subdirectory(Tests)
endif()


# Config files and install rules for pythons scripts
sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "examples/python3/")

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ In contrast, many other models in continuum media mechanics tend to treat materi
When modeling linear structures, this framework enables the creation of a structure closely resembling articulated solids, consisting of a series of rigid bodies whose relative positions are defined by their strain states.
Consequently, this model serves as a versatile tool for modeling and controlling a variety of systems, including concentric tube robots, continuum robots driven by cables, or pneumatic soft robots with constant cross-sections.

Go into theorotical part of the plugin [Theory](docs/text/Theory.md)
Go into theorotical part of the plugin [Theory](examples/python3/tutorial/Writerside/topics/Theory.mdexamples/python3/tutorial/Writerside/topics/Theory.md)

Follow the tutorial : [cosserat_tutorial](docs/text/cosserat_tutorial.md)
Follow the tutorial : [cosserat_tutorial](tutorial/text/cosserat_tutorial.md)
## Some use cases


Expand All @@ -40,27 +40,27 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i

| View 1 | View 2 | View 3 |
|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
| ![333](docs/images/multiSectionWithColorMap1.png) | ![333](docs/images/multiSectionWithColorMap2.png) | ![333](docs/images/multiSectionWithColorMap3.png) |
| ![333](tutorial/images/multiSectionWithColorMap1.png) | ![333](tutorial/images/multiSectionWithColorMap2.png) | ![333](tutorial/images/multiSectionWithColorMap3.png) |


## Utilizing the Discrete Cosserat Model for Cable Modeling in Deformable Robot Control:


| Direct simulation of a soft gripper | The study of the model convergence |
|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| ![400](docs/images/cosseratgripper_2.png) | ![400](../../../../Templater/images/tenCossseratSections.png.md) |
| ![400](tutorial/images/cosseratgripper_2.png) | ![400](tutorial/images/tenCossseratSections.png) |


---

<strong> Actuation </strong>

| <img src="/docs/images/actuationConstraint_2.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="docs/images/circleActuationConstraint.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="/docs/images/actuationConstraint_1.png" width="300" title="DCM Beam actuation using a cable"> |
| <img src="/tutorial/images/actuationConstraint_2.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="tutorial/images/circleActuationConstraint.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="/tutorial/images/actuationConstraint_1.png" width="300" title="DCM Beam actuation using a cable"> |
|---------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------------------------------------------------------:|
| DCM Beam actuation using a cable ```d =``` | DCM Beam actuation using a cable ```d =``` | Beam actuation using a cable ```d =``` |


| <img src="/docs/images/example1.gif" width="300" title="PCS_Example1.py "> | <img src="./docs/images/example2.gif" widt="300" title="PCS_Example2.py"> | <img src="./docs/images/example2.gif" width="300" title="PCS_Example3.PCS"> |
| <img src="/tutorial/images/example1.gif" width="300" title="PCS_Example1.py "> | <img src="./tutorial/images/example2.gif" widt="300" title="PCS_Example2.py"> | <img src="./tutorial/images/example2.gif" width="300" title="PCS_Example3.PCS"> |
|----------------------------------------------------------------------------|:-------------------------------------------------------------------------:|----------------------------------------------------------------------------:|
| DCM Beam actuation using a cable ```d =``` | DCM Beam actuation using a cable ```d =``` | Beam actuation using a cable ```d =``` |

Expand Down Expand Up @@ -124,21 +124,21 @@ with a constant cross-section.

| View 1 | View 2 | View 3 |
|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| <img src="/doc/images/multiSectionWithColorMap1.png" width="300" title="DCM as an implant"> | <img src="/doc/images/multiSectionWithColorMap2.png" width="300" title="DCM as an implant"> | <img src="/doc/images/multiSectionWithColorMap3.png" width="300" title="DCM as an implant"> |
| <img src="/tutorial/images/multiSectionWithColorMap1.png" width="300" title="DCM as an implant"> | <img src="/tutorial/images/multiSectionWithColorMap2.png" width="300" title="DCM as an implant"> | <img src="/tutorial/images/multiSectionWithColorMap3.png" width="300" title="DCM as an implant"> |

### DCM for cable modeling to control deformable robots:
| Direct simulation of a soft gripper | The study the model convergence |
|------------------------------------------------------------------------------------------| --- |
| <img src="/doc/images/cosseratgripper_2.png" width="400" title="DCM for cable modeling"> | <img src="/doc/images/tenCossseratSections.png" width="400" title="DCM for cable modeling ">|
| <img src="/tutorial/images/cosseratgripper_2.png" width="400" title="DCM for cable modeling"> | <img src="/tutorial/images/tenCossseratSections.png" width="400" title="DCM for cable modeling ">|

### Some use cases

| <img src="/doc/images/actuationConstraint_2.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="doc/images/circleActuationConstraint.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="/doc/images/actuationConstraint_1.png" width="300" title="DCM Beam actuation using a cable"> |
| <img src="/tutorial/images/actuationConstraint_2.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="tutorial/images/circleActuationConstraint.png" width="300" title="DCM Beam actuation using a given cable"> | <img src="/tutorial/images/actuationConstraint_1.png" width="300" title="DCM Beam actuation using a cable"> |
| ------------- |:-------------:| -----:|
| DCM Beam actuation using a cable ```d =``` | DCM Beam actuation using a cable ```d =```| Beam actuation using a cable ```d =```|


| <img src="/doc/images/example1.gif" width="300" title="PCS_Example1.py "> | <img src="./doc/images/example2.gif" widt="300" title="PCS_Example2.py"> | <img src="./doc/images/example2.gif" width="300" title="PCS_Example3.PCS"> |
| <img src="/tutorial/images/example1.gif" width="300" title="PCS_Example1.py "> | <img src="./tutorial/images/example2.gif" widt="300" title="PCS_Example2.py"> | <img src="./tutorial/images/example2.gif" width="300" title="PCS_Example3.PCS"> |
| ------------- |:-------------:| -------------:|
| DCM Beam actuation using a cable ```d =``` | DCM Beam actuation using a cable ```d =```| Beam actuation using a cable ```d =```|

Expand Down
19 changes: 14 additions & 5 deletions Tests/forcefield/BeamHookeLawForceFieldTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,28 @@ struct BeamHookeLawForceFieldTest : public testing::NumericTest<> {
typedef typename DataTypes::Coord Coord;
typedef typename Coord::value_type Real;

BeamHookeLawForceFieldTest()
{
root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root");

createObject(root, "DefaultAnimationLoop");
createObject(root, "DefaultVisualManagerLoop");
}



typedef sofa::component::forcefield::BeamHookeLawForceField<DataTypes> TheBeamHookeLawForceField;

// Sets up the test fixture.
void SetUp() override {
void doSetUp() override {
// initialization or some code to run before each test
fprintf(stderr, "Starting up ! \n");
sofa::simpleapi::importPlugin("Sofa.Component");
sofa::simpleapi::importPlugin("Cosserat");
}

// Tears down the test fixture.
void TearDown() override {
void doTearDown() override {
// code to run after each test;
// can be used instead of a destructor,
// but exceptions can be handled in this function only
Expand Down Expand Up @@ -109,6 +117,7 @@ struct BeamHookeLawForceFieldTest : public testing::NumericTest<> {
template<>
void BeamHookeLawForceFieldTest<defaulttype::Vec3Types>::testFonctionnel() {
EXPECT_MSG_NOEMIT(Error, Warning) ;
ASSERT_NE(root, nullptr);
createObject(root, "MechanicalObject", {{"position", "-1 0 1 1 0 1 -1 0 -1 1 0 -1 0 0 1 0 0 -1 -1 0 0 1 0 0 0 0 0"}});
createObject(root, "TriangleSetTopologyContainer", {{"triangles", "7 5 8 8 2 6 4 6 0 1 8 4 7 3 5 8 5 2 4 8 6 1 7 8"}});

Expand All @@ -118,7 +127,7 @@ void BeamHookeLawForceFieldTest<defaulttype::Vec3Types>::testFonctionnel() {
{"lengthY", "35e-5"},
{"lengthZ", "1374e-5"},
{"radius", "0.25"},
{"varianteSections", "true"}}).get()
{"variantSections", "true"}}).get()
);

EXPECT_NE(traction, nullptr);
Expand Down Expand Up @@ -161,7 +170,7 @@ void BeamHookeLawForceFieldTest<defaulttype::Vec3Types>::basicAttributesTest(){
/// This list needs to be updated if you add an attribute.
sofa::type::vector<std::string> attrnames = {
"crossSectionShape","youngModulus","poissonRatio","length", "radius",
"innerRadius", "lengthY", "lengthZ", "varianteSections", "youngModululsList", "poissonRatioList"
"innerRadius", "lengthY", "lengthZ", "variantSections", "youngModulusList", "poissonRatioList"
};

for(auto& attrname : attrnames)
Expand Down Expand Up @@ -190,7 +199,7 @@ TYPED_TEST( BeamHookeLawForceFieldTest , basicAttributesTest )
ASSERT_NO_THROW (this->basicAttributesTest());
}

TYPED_TEST(BeamHookeLawForceFieldTest, testFonctionnel) {
TYPED_TEST(BeamHookeLawForceFieldTest, DISABLED_testFonctionnel) {
ASSERT_NO_THROW (this->testFonctionnel());
}

Expand Down
Loading
Loading