diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ae2d1b10..8a209882 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -150,12 +150,12 @@ jobs:
if: ${{ runner.os != 'Windows' }}
working-directory: build
run: mkdir -p ${{ matrix.tmpdir }}/mujoco_install/plugin &&
- cp lib/libcable.* ${{ matrix.tmpdir }}/mujoco_install/plugin
+ cp lib/libelasticity.* ${{ matrix.tmpdir }}/mujoco_install/plugin
- name: Copy plugins (Windows)
if: ${{ runner.os == 'Windows' }}
working-directory: build
run: mkdir -p ${{ matrix.tmpdir }}/mujoco_install/plugin &&
- cp bin/Release/cable.dll ${{ matrix.tmpdir }}/mujoco_install/plugin
+ cp bin/Release/elasticity.dll ${{ matrix.tmpdir }}/mujoco_install/plugin
- name: Configure samples
working-directory: sample
run: >
diff --git a/doc/changelog.rst b/doc/changelog.rst
index 72a1f268..c42f6595 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -29,6 +29,7 @@ General
- Added :ref:`mju_fill`, :ref:`mju_symmetrize` and :ref:`mju_eye` utility functions.
- Added :at:`gravcomp` attribute to :ref:`body
`, implementing gravity compensation and bouyancy.
See `balloons.xml `_ example model.
+- Renamed the cable plugin library to elasticity.
Version 2.3.0 (October 18, 2022)
--------------------------------
diff --git a/plugin/elasticity/CMakeLists.txt b/plugin/elasticity/CMakeLists.txt
index 7d25ffcf..8dc89c65 100644
--- a/plugin/elasticity/CMakeLists.txt
+++ b/plugin/elasticity/CMakeLists.txt
@@ -22,19 +22,19 @@ set(MUJOCO_ELASTICITY_SRCS
cable.h
)
-add_library(cable SHARED)
-target_sources(cable PRIVATE ${MUJOCO_ELASTICITY_SRCS})
-target_include_directories(cable PRIVATE ${MUJOCO_ELASTICITY_INCLUDE})
-target_link_libraries(cable PRIVATE mujoco)
+add_library(elasticity SHARED)
+target_sources(elasticity PRIVATE ${MUJOCO_ELASTICITY_SRCS})
+target_include_directories(elasticity PRIVATE ${MUJOCO_ELASTICITY_INCLUDE})
+target_link_libraries(elasticity PRIVATE mujoco)
target_compile_options(
- cable
+ elasticity
PRIVATE ${AVX_COMPILE_OPTIONS}
${MUJOCO_MACOS_COMPILE_OPTIONS}
${EXTRA_COMPILE_OPTIONS}
${MUJOCO_CXX_FLAGS}
)
target_link_options(
- cable
+ elasticity
PRIVATE
${MUJOCO_MACOS_LINK_OPTIONS}
${EXTRA_LINK_OPTIONS}
diff --git a/plugin/elasticity/cable.cc b/plugin/elasticity/cable.cc
index 25e12806..dca45dc6 100644
--- a/plugin/elasticity/cable.cc
+++ b/plugin/elasticity/cable.cc
@@ -89,10 +89,10 @@ bool CheckAttr(const char* name, const mjModel* m, int instance) {
// factory function
-std::optional Elasticity::Create(
+std::optional Cable::Create(
const mjModel* m, mjData* d, int instance) {
if (CheckAttr("twist", m, instance) && CheckAttr("bend", m, instance)) {
- return Elasticity(m, d, instance);
+ return Cable(m, d, instance);
} else {
mju_warning("Invalid parameter specification in cable plugin");
return std::nullopt;
@@ -100,7 +100,7 @@ std::optional Elasticity::Create(
}
// plugin constructor
-Elasticity::Elasticity(const mjModel* m, mjData* d, int instance) {
+Cable::Cable(const mjModel* m, mjData* d, int instance) {
// parameters were validated by the factor function
std::string flat = mj_getPluginConfig(m, instance, "flat");
mjtNum G = strtod(mj_getPluginConfig(m, instance, "twist"), nullptr);
@@ -173,7 +173,7 @@ Elasticity::Elasticity(const mjModel* m, mjData* d, int instance) {
}
}
-void Elasticity::Compute(const mjModel* m, mjData* d, int instance) {
+void Cable::Compute(const mjModel* m, mjData* d, int instance) {
for (int b = 0; b < n; b++) {
// index into body array
int i = i0 + b;
@@ -234,20 +234,20 @@ mjPLUGIN_DYNAMIC_LIBRARY_INIT {
plugin.nstate = +[](const mjModel* m, int instance) { return 0; };
plugin.init = +[](const mjModel* m, mjData* d, int instance) {
- auto elasticity_or_null = Elasticity::Create(m, d, instance);
+ auto elasticity_or_null = Cable::Create(m, d, instance);
if (!elasticity_or_null.has_value()) {
return -1;
}
d->plugin_data[instance] = reinterpret_cast(
- new Elasticity(std::move(*elasticity_or_null)));
+ new Cable(std::move(*elasticity_or_null)));
return 0;
};
plugin.destroy = +[](mjData* d, int instance) {
- delete reinterpret_cast(d->plugin_data[instance]);
+ delete reinterpret_cast(d->plugin_data[instance]);
d->plugin_data[instance] = 0;
};
plugin.compute = +[](const mjModel* m, mjData* d, int instance, int type) {
- auto* elasticity = reinterpret_cast(d->plugin_data[instance]);
+ auto* elasticity = reinterpret_cast(d->plugin_data[instance]);
elasticity->Compute(m, d, instance);
};
diff --git a/plugin/elasticity/cable.h b/plugin/elasticity/cable.h
index b7e001f0..9c419deb 100644
--- a/plugin/elasticity/cable.h
+++ b/plugin/elasticity/cable.h
@@ -25,14 +25,14 @@
namespace mujoco::plugin::elasticity {
-class Elasticity {
+class Cable {
public:
- // Creates a new Elasticity instance (allocated with `new`) or
+ // Creates a new Cable instance (allocated with `new`) or
// returns null on failure.
- static std::optional Create(const mjModel* m, mjData* d,
+ static std::optional Create(const mjModel* m, mjData* d,
int instance);
- Elasticity(Elasticity&&) = default;
- ~Elasticity() = default;
+ Cable(Cable&&) = default;
+ ~Cable() = default;
void Compute(const mjModel* m, mjData* d, int instance);
@@ -44,7 +44,7 @@ class Elasticity {
std::vector omega0; // reference curvature (n x 3)
private:
- Elasticity(const mjModel* m, mjData* d, int instance);
+ Cable(const mjModel* m, mjData* d, int instance);
};
} // namespace mujoco::plugin::elasticity
diff --git a/test/plugin/elasticity/CMakeLists.txt b/test/plugin/elasticity/CMakeLists.txt
index 0b24696b..e62dae06 100644
--- a/test/plugin/elasticity/CMakeLists.txt
+++ b/test/plugin/elasticity/CMakeLists.txt
@@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-mujoco_test(cable_test)
-target_link_libraries(cable_test fixture gmock cable)
+mujoco_test(elasticity_test)
+target_link_libraries(elasticity_test fixture gmock elasticity)
diff --git a/test/plugin/elasticity/cable_test.cc b/test/plugin/elasticity/elasticity_test.cc
similarity index 100%
rename from test/plugin/elasticity/cable_test.cc
rename to test/plugin/elasticity/elasticity_test.cc