KDL parser: URDF parsing issue
Hey,
This question seems a bit obvious/easy but I am not able to get the KDL parser working with URDF file for making a KDL tree. I am following this tutorial, section 2.1 - KDL parser: From a file. I am not able to pass the correct filename in the function kdl_parser::treeFromFile("filename", tree)
. I tried with the model urdf name, the relative path to that file, the absolute path; all of them gives the same error while running - Error document empty. Can anyone specify how to pass the URDF file to the function?
ROS: Melodic
Edit:
As mentioned by @pmuthu2s in the comment, I added below line in the launch file.
<param name="robot_description" textfile="$(find exercise2)/model/robots/sim.urdf"/>
Also the code for parsing looks like this:
KDL::Tree lumi_tree;
std::string lumi_robot;
node.param("robot_description", lumi_robot, std::string());
if (!kdl_parser::treeFromFile(lumi_robot, lumi_tree)){
ROS_ERROR("Failed to construct kdl tree");
return false;
}
Still getting the same error. Probably I am doing something wrong here. Anyone know how to fix this?
Regards,
Anand
Hey, Maybe check this out Error document empty
Added some more details in the question. Still the same error.
Have you checked whether
lumi_robot
actually contains anything?And does
cat $(rospack find exercise2)/model/robots/sim.urdf
show the expected content?@gvdhoorn - I can see the urdf with that
cat
command. But the problem here islumi_robot
does not have any value. Thanks for pointing out that. The launch file just launches the robot and starts rviz. I run the executable separately. Is that the reason why it cannot get the URDF from rosparams? I am able to see the URDF withrosparam get /robot_description
. I am getting the URDF asstd::string lumi_robot; node.param("robot_description", lumi_robot, std::string());
I changed the it to
/robot_description
asnode.param("/robot_description", lumi_robot, std::string());
. Nowlumi_robot
as the content ofsim.urdf
. Still I am geting Error document empty.