raisimTech / raisimLib

Visit www.raisim.com
http://www.raisim.com
Other
341 stars 91 forks source link

How to import urdf-kind map to RaiSim #478

Closed Czworldy closed 1 year ago

Czworldy commented 1 year ago

Hi, there! I'm try to import map in this repo ICRA2023_Quadruped_Competition but i can not find correct API in RaiSim::World. So how should use those urdf-kind terrain in RaiSim? Thanks a lot!

jhwangbo commented 1 year ago

Can you just load it as an articulated system?

jhwangbo commented 1 year ago

I saw other group loading this map in Raisim. I think they used addArticulatedSystem method

Czworldy commented 1 year ago

Thanks for your reply. but when i load this map by addArticulatedSystem i only get segmentation fault

here is my code

#include "raisim/RaisimServer.hpp"

int main(int argc, char* argv[]) {
  auto binaryPath = raisim::Path::setFromArgv(argv[0]);
  raisim::World::setActivationKey(binaryPath.getDirectory() + "\\rsc\\activation.raisim");
  raisim::RaiSimMsg::setFatalCallback([](){throw;});

  /// create raisim world
  raisim::World world;
  world.setTimeStep(0.001);

  /// create objects
  auto ground = world.addGround(0, "gnd");
  ground->setAppearance("hidden");

  auto map = world.addArticulatedSystem("PATH_TO_WHERE_YOU_CLONE_MAP/ICRA2023_Quadruped_Robot_Challenges/urdf/map.urdf");

  /// launch raisim server
  raisim::RaisimServer server(&world);
  server.launchServer();

  for (int i=0; i<200000000; i++) {
    RS_TIMED_LOOP(int(world.getTimeStep()*1e6))
    server.integrateWorldThreadSafe();
  }

  server.killServer();
}

the raisim version is 1.1.7. Am i correct or there are some steps i missed?

jhwangbo commented 1 year ago

Currently 0-dof articulated systems are not supported. You have to load the mesh (defined inside the URDF) and set it to static by setBodyType.

Czworldy commented 1 year ago

i see, load the mesh meams load the *.dae inside the URDF, isn't it?