本文整理汇总了C++中Viewer::createEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer::createEnvironment方法的具体用法?C++ Viewer::createEnvironment怎么用?C++ Viewer::createEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer
的用法示例。
在下文中一共展示了Viewer::createEnvironment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// SET UP THE MPC CONTROLLER:
// --------------------------
RealTimeAlgorithm alg(ocp);
alg.set(INTEGRATOR_TYPE, INT_RK45);
alg.set(MAX_NUM_ITERATIONS,1);
alg.set(PRINT_COPYRIGHT, false);
alg.set(DISCRETIZATION_TYPE, SINGLE_SHOOTING);
Controller controller(alg);
// SETTING UP THE SIMULATION ENVIRONMENT:
// --------------------------------------
DVector X(12), U(4), U0(4);
X.setZero();
X(2) = 4.;
// X(12) = X(13) = X(14) = X(15) = 58.;
U.setZero();
U0.setZero();
controller.init(0., X);
process.init(0., X, U);
// VariablesGrid graph;
VariablesGrid Y;
Y.setZero();
// END OF ACADO SOLVER SETUP
// -------------------------
// Initialise input from keyboard
Input input(false);
// Gepetto viewer over corba
Viewer viewer;
viewer.createEnvironment(cylinders);
viewer.createDrone(PIE_SOURCE_DIR"/data/quadrotor_base.stl");
double t = 0;
std::clock_t previousTime;
previousTime = std::clock();
auto refInput = input.getReference();
DVector LastRefVec(10);
LastRefVec.setZero();
while(true)
{
// getting reference from input and passing it to the algorithm
refInput = input.getReference();
if (abs(refInput[0]-LastRefVec(0))>1.)
{
if (refInput[0]>LastRefVec(0)) { refInput[0] = LastRefVec(0)+1.;}
else {refInput[0] = LastRefVec(0)-1.;}
}
if (abs(refInput[1]-LastRefVec(1))>1.)
{
if (refInput[1]>LastRefVec(1)) { refInput[1] = LastRefVec(1)+1.;}
else {refInput[1] = LastRefVec(1)-1.;}
}
if (abs(refInput[0]-LastRefVec(0))>1.)
{
if (refInput[2]>LastRefVec(2)) { refInput[2] = LastRefVec(2)+1.;}
else {refInput[2] = LastRefVec(2)-1.;}
}
double refT[10] = {refInput[0], refInput[1], refInput[2], 0., 0., 0., 0., 0., 0., 0.};
DVector refVec(10, refT);
VariablesGrid referenceVG (refVec, Grid{t, t+1., 2});
referenceVG.setVector(0, LastRefVec);