Hi Nick,
The debugger says osimSimulation.DLL is missing. But I'm not sure if that's the real issue because so far (until I began using path constraints), the moco problem was solved well, and dependencies were copied to the build file when I generated the problem with CMake.
On the other hand, I didn't build my customs goal in separate files; instead, I built them directly in the source code (as written below). Would this be a not good practice that might cause such an error?
I'm considering creating a custom path constraint that prevents contact forces on spheres from being greater than 0 (i.e. foot not leaving the ground). Would there be any function in Moco (or OpenSim) that can achieve this? For now, I'm trying to minimize the body accelerations of the feet but the toes are leaving the ground
Code: Select all
class MocoCOMGoal : public MocoGoal {
OpenSim_DECLARE_CONCRETE_OBJECT(MocoCOMGoal, MocoGoal);
public:
MocoCOMGoal() {}
MocoCOMGoal(std::string name) : MocoGoal(std::move(name)) {}
MocoCOMGoal(std::string name, double weight) : MocoGoal(std::move(name), weight) {}
protected:
Mode getDefaultModeImpl() const override { return Mode::Cost; }
bool getSupportsEndpointConstraintImpl() const override { return true; }
void initializeOnModelImpl(const Model&) const override { setRequirements(1, 1); }
void calcIntegrandImpl(
const IntegrandInput& input, double& integrand) const override {
getModel().realizeAcceleration(input.state);
//COM
const auto& CoM = getModel().getMatterSubsystem().calcSystemMassCenterLocationInGround(input.state);
integrand = CoM[1];
}
void calcGoalImpl(
const GoalInput& input, SimTK::Vector& cost) const override {
cost[0] = input.integral;
}
};