void PhysicsClientExample::initPhysics() { if (m_guiHelper && m_guiHelper->getParameterInterface()) { int upAxis = 2; m_guiHelper->setUpAxis(upAxis); createButtons(); } else { MyCallback(CMD_LOAD_URDF, true, this); MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this); MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this); MyCallback(CMD_RESET_SIMULATION,true,this); } m_selectedBody = -1; m_prevSelectedBody = -1; m_physicsClientHandle = b3ConnectSharedMemory(m_sharedMemoryKey); //m_physicsClientHandle = b3ConnectPhysicsLoopback(SHARED_MEMORY_KEY); //m_physicsClientHandle = b3ConnectPhysicsDirect(); if (!b3CanSubmitCommand(m_physicsClientHandle)) { b3Warning("Cannot connect to physics client"); } }
int main (int argc, char **argv) { IloEnv env; try { IloModel model(env, "example"); IloNumVarArray var(env); IloRangeArray rng(env); populatebycolumn (model, var, rng); IloCplex cplex(model); cplex.setOut(env.getNullStream()); cplex.setParam(IloCplex::Param::RootAlgorithm, IloCplex::Primal); cplex.use(MyCallback(env)); cplex.solve(); env.out() << "Solution status = " << cplex.getStatus() << endl; env.out() << "Solution value = " << cplex.getObjValue() << endl; IloNumArray vals(env); cplex.getValues(vals, var); env.out() << "Values = " << vals << endl; cplex.getSlacks(vals, rng); env.out() << "Slacks = " << vals << endl; cplex.getDuals(vals, rng); env.out() << "Duals = " << vals << endl; cplex.getReducedCosts(vals, var); env.out() << "Reduced Costs = " << vals << endl; cplex.exportModel("lpex4.lp"); } catch (IloException& e) { cerr << "Concert exception caught: " << e << endl; } catch (...) { cerr << "Unknown exception caught" << endl; } env.end(); return 0; } // END main
void PhysicsClientExample::initPhysics() { if (m_guiHelper && m_guiHelper->getParameterInterface()) { int upAxis = 2; m_guiHelper->setUpAxis(upAxis); createButtons(); } else { MyCallback(CMD_LOAD_URDF, true, this); MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this); MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this); MyCallback(CMD_RESET_SIMULATION,true,this); } m_selectedBody = -1; m_prevSelectedBody = -1; if (m_options == eCLIENTEXAMPLE_SERVER) { m_canvas = m_guiHelper->get2dCanvasInterface(); if (m_canvas) { m_canvasIndex = m_canvas->createCanvas("Synthetic Camera",camVisualizerWidth, camVisualizerHeight); for (int i=0;i<camVisualizerWidth;i++) { for (int j=0;j<camVisualizerHeight;j++) { unsigned char red=255; unsigned char green=255; unsigned char blue=255; unsigned char alpha=255; if (i==j) { red = 0; green=0; blue=0; } m_canvas->setPixel(m_canvasIndex,i,j,red,green,blue,alpha); } } m_canvas->refreshImageData(m_canvasIndex); } m_isOptionalServerConnected = m_physicsServer.connectSharedMemory( m_guiHelper); } m_physicsClientHandle = b3ConnectSharedMemory(m_sharedMemoryKey); //m_physicsClientHandle = b3ConnectPhysicsLoopback(SHARED_MEMORY_KEY); //m_physicsClientHandle = b3ConnectPhysicsDirect(); if (!b3CanSubmitCommand(m_physicsClientHandle)) { b3Warning("Cannot connect to physics client"); } }