Skip to content
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
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion src/rsda_pto_functor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ namespace vgoswec {
RsdaPtoFunctor::RsdaPtoFunctor(std::shared_ptr<seastack::pto::IPTOModel> 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);
}

Expand Down
8 changes: 6 additions & 2 deletions src/rsda_pto_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChLinkRSDA>();
Expand Down Expand Up @@ -39,7 +40,10 @@ class RsdaPtoFunctor : public ::chrono::ChLinkRSDA::TorqueFunctor {
explicit RsdaPtoFunctor(std::shared_ptr<seastack::pto::IPTOModel> 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;
Expand Down