diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ab8fc7..8d83deb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,20 +79,24 @@ target_link_libraries(demo_vgoswec PRIVATE vgoswec_chrono SEAStack::ChronoAdapter SEAStack::HydroIO - ${_demo_extra_libs} ) target_compile_features(demo_vgoswec PRIVATE cxx_std_17) target_compile_options(demo_vgoswec PRIVATE -Wall -Wextra -Wpedantic) # Prefer imported VSG targets when available (avoid manual low-level find_library). +set(_demo_gui_libs "") if(TARGET vsg::vsg) - target_link_libraries(demo_vgoswec PRIVATE vsg::vsg) + list(APPEND _demo_gui_libs vsg::vsg) endif() if(TARGET vsgXchange::vsgXchange) - target_link_libraries(demo_vgoswec PRIVATE vsgXchange::vsgXchange) + list(APPEND _demo_gui_libs vsgXchange::vsgXchange) +elseif(TARGET vsgXchange) + list(APPEND _demo_gui_libs vsgXchange) endif() if(TARGET vsgImGui::vsgImGui) - target_link_libraries(demo_vgoswec PRIVATE vsgImGui::vsgImGui) + list(APPEND _demo_gui_libs vsgImGui::vsgImGui) +elseif(TARGET vsgImGui) + list(APPEND _demo_gui_libs vsgImGui) endif() # SEA-Stack app library import (parity with working SEA-Stack/HIL integration path). @@ -134,6 +138,12 @@ else() message(WARNING "demo_vgoswec: seastack_app_lib not found; continuing with headless-safe build path") endif() +# Link GUI/VSG dependencies after SEAStack::app_lib so static-library consumers +# resolve Chrono VSG and ImGui symbols in left-to-right link order. +if(_demo_extra_libs OR _demo_gui_libs) + target_link_libraries(demo_vgoswec PRIVATE ${_demo_extra_libs} ${_demo_gui_libs}) +endif() + if(EXISTS "${SEASTACK_SOURCE_DIR_HINT}/apps/seastack/gui/guihelper.h") target_include_directories(demo_vgoswec PRIVATE "${SEASTACK_SOURCE_DIR_HINT}/apps/seastack" diff --git a/src/rsda_pto_functor.cpp b/src/rsda_pto_functor.cpp index f29022e..f4f6160 100644 --- a/src/rsda_pto_functor.cpp +++ b/src/rsda_pto_functor.cpp @@ -6,8 +6,11 @@ namespace vgoswec { RsdaPtoFunctor::RsdaPtoFunctor(std::shared_ptr model) : model_(std::move(model)) {} -double RsdaPtoFunctor::evaluate(double time, double angle, double vel, +double RsdaPtoFunctor::evaluate(double time, double /*rest_angle*/, double angle, double vel, const ::chrono::ChLinkRSDA& /*link*/) { + // angle -> flap deviation theta [rad] (displacement); vel -> theta_dot [rad/s]. + // rest_angle is unused: the controllers reference theta from the initialized-at-rest + // configuration (rest_angle = 0), matching theta_ref = 0 in the exc_ff_pid controller. return model_->ComputeForce(angle, vel, time); } diff --git a/src/rsda_pto_functor.h b/src/rsda_pto_functor.h index 87662f5..73b0da4 100644 --- a/src/rsda_pto_functor.h +++ b/src/rsda_pto_functor.h @@ -6,8 +6,9 @@ // ChLinkRSDA (Rotational Spring-Damper-Actuator) is Chrono 10's rotational // counterpart to ChLinkTSDA. Its TorqueFunctor callback receives: // time — current simulation time [s] -// angle — relative rotation angle [rad] (maps to IPTOModel::displacement) -// vel — relative angular velocity [rad/s] (maps to IPTOModel::velocity) +// rest_angle — undeformed angle [rad] (Chrono 10 signature; unused here) +// angle — relative rotation angle [rad] (maps to IPTOModel::displacement) +// vel — relative angular velocity [rad/s] (maps to IPTOModel::velocity) // // Typical wiring (Y-axis hinge): // auto rsda = chrono_types::make_shared(); @@ -39,7 +40,10 @@ class RsdaPtoFunctor : public ::chrono::ChLinkRSDA::TorqueFunctor { explicit RsdaPtoFunctor(std::shared_ptr model); /// Called by Chrono at each force-assembly sub-step. + /// Signature matches chrono::ChLinkRSDA::TorqueFunctor::evaluate in Chrono 10 + /// (note the `rest_angle` parameter between `time` and `angle`). double evaluate(double time, + double rest_angle, double angle, double vel, const ::chrono::ChLinkRSDA& link) override;