本文整理汇总了C++中BaseSpineModelLearning::getNumberofMuslces方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseSpineModelLearning::getNumberofMuslces方法的具体用法?C++ BaseSpineModelLearning::getNumberofMuslces怎么用?C++ BaseSpineModelLearning::getNumberofMuslces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseSpineModelLearning
的用法示例。
在下文中一共展示了BaseSpineModelLearning::getNumberofMuslces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onStep
void JSONCPGControl::onStep(BaseSpineModelLearning& subject, double dt)
{
m_updateTime += dt;
if (m_updateTime >= m_config.controlTime)
{
std::size_t numControllers = subject.getNumberofMuslces();
double descendingCommand = 2.0;
std::vector<double> desComs (numControllers, descendingCommand);
m_pCPGSys->update(desComs, m_updateTime);
#ifdef LOGGING // Conditional compile for data logging
m_dataObserver.onStep(subject, m_updateTime);
#endif
notifyStep(m_updateTime);
m_updateTime = 0;
}
double currentHeight = subject.getSegmentCOM(m_config.segmentNumber)[1];
/// @todo add to config
if (currentHeight > 25 || currentHeight < 1.0)
{
/// @todo if bogus, stop trial (reset simulation)
bogus = true;
}
}
示例2: onStep
void JSONGoalTensionNNW::onStep(BaseSpineModelLearning& subject, double dt)
{
m_updateTime += dt;
m_totalTime += dt;
double currentHeight = subject.getSegmentCOM(m_config.segmentNumber)[1];
if (m_updateTime >= m_config.controlTime)
{
#if (1) // Goal and cable
std::vector<double> desComs = getFeedback(subject);
const BaseSpineModelGoal* goalSubject = tgCast::cast<BaseSpineModelLearning, BaseSpineModelGoal>(subject);
getGoalFeedback(goalSubject);
#else // Just goal
std::size_t numControllers = subject.getNumberofMuslces() * 3;
double descendingCommand = 0.0;
std::vector<double> desComs (numControllers, descendingCommand);
const BaseSpineModelGoal* goalSubject = tgCast::cast<BaseSpineModelLearning, BaseSpineModelGoal>(subject);
getGoalFeedback(goalSubject);
#endif
try
{
m_pCPGSys->update(desComs, m_updateTime);
}
catch (std::runtime_error& e)
{
// Stops the trial immediately, lets teardown know it broke
bogus = true;
throw (e);
}
#ifdef LOGGING // Conditional compile for data logging
m_dataObserver.onStep(subject, m_updateTime);
#endif
notifyStep(m_updateTime);
m_updateTime = 0;
//std::cout << m_totalTime << " " << currentHeight<< std::endl;
}
#if (0)
/// @todo add to config
if (currentHeight > 25 || currentHeight < 1.0)
{
/// @todo if bogus, stop trial (reset simulation)
bogus = true;
throw std::runtime_error("Height out of range");
}
#endif
}
示例3: onStep
void JSONQuadFeedbackControl::onStep(BaseSpineModelLearning& subject, double dt)
{
m_updateTime += dt;
if (m_updateTime >= m_config.controlTime)
{
#if (1)
std::vector<double> desComs = getFeedback(subject);
#else
std::size_t numControllers = subject.getNumberofMuslces() * 3;
double descendingCommand = 0.0;
std::vector<double> desComs (numControllers, descendingCommand);
#endif
try
{
m_pCPGSys->update(desComs, m_updateTime);
}
catch (std::runtime_error& e)
{
// Stops the trial immediately, lets teardown know it broke
bogus = true;
throw (e);
}
#ifdef LOGGING // Conditional compile for data logging
m_dataObserver.onStep(subject, m_updateTime);
#endif
notifyStep(m_updateTime);
m_updateTime = 0;
}
double currentHeight = subject.getSegmentCOM(m_config.segmentNumber)[1];
/// Max and min heights added to config
if (currentHeight > m_config.maxHeight || currentHeight < m_config.minHeight)
{
/// @todo if bogus, stop trial (reset simulation)
bogus = true;
throw std::runtime_error("Height out of range");
}
}