示例#1
0
gint main(gint argc, gchar* argv[]){
  char* hw = "`r```````````.H.e.l.l.o. .w.o.r.l.di";
  char* fib =  "```s``s``sii`ki\n"
"`k.*``s``s`ks\n"
"``s`k`s`ks``s``s`ks``s`k`s`kr``s`k`sikk\n"
"`k``s`ksk";
  /*
   * http://www.madore.org/~david/programs/unlambda/
   */
  World* world;
  UnlambdaEval* ue;
  GOptionContext *context;
  GError *error = NULL;

  context = g_option_context_new("This line is appeared after Uagese's command line");
  g_option_context_set_summary(context, "This line is appeared before options");
  g_option_context_set_description(context, "This line is appeared after options");
  if(!g_option_context_parse(context, &argc, &argv, &error)){
    g_printerr("option parsing failed: %s\n", error->message);
    return 1;
  }

  world = CreateWorld(MAXOBJECTS);
  setWorld(world);
  ue = NewUnlambdaEval(world);

  printf("%s\n", fib);
  //eval(hw);
  UnlambdaEval_eval(ue, fib);
  DeleteWorld(world);

  return 0;
}
/*
 *	Cleanup
 */
int CGuiThread::ExitInstance()
{
	UpdateRegistry();
	CloseSockets();	// buggy old clients do not close sockets on exit. So we imitate closing manually
	UnloadPlugins();
	DeleteWorld();

	return CWinThread::ExitInstance();
}
示例#3
0
文件: GRIPFrame.cpp 项目: Sosi/grip
/**
 * @function DoLoad
 * @brief Load world from RSDH file
 */
void GRIPFrame::DoLoad(string filename, bool savelastload)
{
    continueSimulation = false;

    size_t numPages = tabView->GetPageCount();
    if (mWorld) {
        // fire SceneUnloaded hooks
        for(size_t i=0; i< numPages; i++) {
            GRIPTab* tab = (GRIPTab*)tabView->GetPage(i);
            tab->GRIPEventSceneUnloaded();
        }
        // delete the world
        DeleteWorld();
    }

    dart::utils::DartLoader dl;

    mWorld = dl.parseWorld( filename.c_str() );
    // NULL World
    if( !mWorld ) {
        std::cout<< "[GRIP] World pointer null. Try again with a good URDF file"<<std::endl;
        return;
    }
    else if(mWorld->getNumSkeletons() == 0) {
        std::cout<< "[GRIP] Empty world? Neither robots nor objects loaded. Try again loading a world urdf"<< std::endl;
        return;
    }

    // Add floor
    dart::dynamics::Skeleton* ground = new dart::dynamics::Skeleton();
    ground->setName("ground");

    dart::dynamics::BodyNode* node = new dart::dynamics::BodyNode("ground");
    node->setMass(1.0);
    
    dart::dynamics::Shape* shape = new dart::dynamics::BoxShape(Eigen::Vector3d(10.0, 10.0, 0.0001));
    shape->setColor(Eigen::Vector3d(0.5, 0.5, 1.0));
    node->addCollisionShape(shape);
    
    dart::dynamics::Joint* joint = new dart::dynamics::WeldJoint();
    joint->setName("groundJoint");
    joint->setTransformFromParentBodyNode(Eigen::Isometry3d::Identity());
    joint->setTransformFromChildBodyNode(Eigen::Isometry3d::Identity());
    node->setParentJoint(joint);

    ground->addBodyNode(node);
    ground->setMobile(false);
    mWorld->addSkeleton(ground);
    
    // Compile OpenGL displaylists
    for(int i=0; i < mWorld->getNumSkeletons(); i++) {
        viewer->renderer.compileList(mWorld->getSkeleton(i));
    }

    // UpdateTreeView();
    cout << "--(v) Done Parsing World information (v)--" << endl;
    treeView->CreateFromWorld();
    cout << "--(v) Done Updating TreeView (v)--" << endl;
    SetStatusText(wxT("--(i) Done Loading and updating the View (i)--"));

    /// Extract path to executable & save "lastload" there
    if (savelastload) {
        cout << "--(i) Saving " << filename << " to .lastload file (i)--" << endl;
        wxString filename_string(filename.c_str(), wxConvUTF8);
        saveText(filename_string,".lastload");
    }

    selectedTreeNode = 0;
    treeView->ExpandAll();
    updateAllTabs();

    // fire SceneLoaded hooks
    for(size_t i=0; i< numPages; i++) {
        GRIPTab* tab = (GRIPTab*)tabView->GetPage(i);
        tab->GRIPEventSceneLoaded();
    }

    viewer->DrawGLScene();
}
示例#4
0
文件: GRIPFrame.cpp 项目: Sosi/grip
/**
 * @function OnClose
 * @brief
 * @date 2011-10-13
 */
void GRIPFrame::OnClose(wxCommandEvent& WXUNUSED(event)){
    DeleteWorld();
    //viewer->UpdateCamera();
    //exit(0);
    //DeleteWorld();
}
CWorldInfo::~CWorldInfo()
{
	DeleteWorld(m_pWorld, m_dwCookie);
	SAFERELEASE(m_pWorld);
}