personalrobotics / or_urdf

OpenRAVE plugin for loading URDF and SRDF files.
BSD 3-Clause "New" or "Revised" License
19 stars 32 forks source link

not loading robot model from srdf #33

Open jontromanab opened 7 years ago

jontromanab commented 7 years ago

Hello,

I am trying to create a robot model for fetch robot. I have the fetch urdf and srdf files. Including the fetch.srdf, here is the error:

openrave [ERROR] [urdf_loader.cpp:866 URDFLoader::loadURI] Failed loading URDF model: End-effector 'gripper' has no parent group

Including the fetch srdf and calling env.GetRobot(name) gives me this error:

Boost.Python.ArgumentError: Python argument types in Environment.GetRobot(Environment, NoneType) did not match C++ signature: GetRobot(openravepy::PyEnvironmentBase {lvalue}, std::string name) Segmentation fault (core dumped)

While I am trying to import kinbody only from the urdf. The kinbody looks like this:

1

While the robot model from collada_urdf is looking pretty decent. However the gripper has not come proper:

2

Please help me out.

mkoval commented 7 years ago

While I am trying to import kinbody only from the urdf. The kinbody looks like this:

You need to change <up_axis>Z_UP</up_axis> to <up_axis>Y_UP</up_axis> in all of the Collada (.dae) meshes included in the fetch_description package. This is a fundamental incompatibility in how RViz and Assimp (the library used to loads meshes by OpenRAVE) handle the <up_axis> tag in Collada files. See this issue for more information: https://github.com/ros-visualization/rviz/issues/1045.

openrave [ERROR] [urdf_loader.cpp:866 URDFLoader::loadURI] Failed loading URDF model: End-effector 'gripper' has no parent group

This error occurs because the <end_effector name="gripper"> in the fetch.srdf file in the fetch_moveit_config package is missing the parent_group attribute. It most likely should be parent_group="arm".

or_urdf uses a <end_effector> tags to generate OpenRAVE Manipulator objects, which allow you to run inverse kinematics on an end-effector frame. The parent_group attribute defines what joints are allowed to be modified by the inverse kinematics solver.

Alternatively, if you don't care about inverse kinematics, you can omit the SRDF file. This will create a KinBody object (instead of a Robot object) with no Manipulators.

Including the fetch srdf and calling env.GetRobot(name) gives me this error:

Boost.Python.ArgumentError: Python argument types in Environment.GetRobot(Environment, NoneType) did not match C++ signature:
GetRobot(openravepy::PyEnvironmentBase {lvalue}, std::string name)
Segmentation fault (core dumped)

The error occurs because or_urdf printed an error message ("Failed loading URDF model..."), failed to load the robot, and returned None. You should check the return value of SendCommand for None to handle this case.

OpenRAVE quit with a "Segmentation fault" because Python exited without calling RaveDestroy(). You should wrap your code in a try-finally block to guarantee that RaveDestroy() is called on exit.

jontromanab commented 7 years ago

Thank you very much @mkoval. After manually correcting every dae it looks fine now. Even the gripper. 2

I am writing some code that can automatically make this change to all daes included in the URDF, so I dont have to do it again. Please let me know if there is already some existing functionality such that, then I wont go in that way.

If you like, I can send the code of changing in daes. Otherwise I can close this issue.

mkoval commented 7 years ago

It would be great if you could share that code. This is an issue every time I create a URDF file - I should have really documented this in the README.

jontromanab commented 7 years ago

I am a little bit busy in something which will be done in 2 days. I will make the PR as soon as I can. Thank you very much for the help.