Robotics StackExchange | Archived questions

Catkin_make error while reading a URDF file using parser.cpp

Hello all,

I'm following this tutorial on creating a simple URDF for use in Gazebo:

http://wiki.ros.org/urdf/Tutorials/Parse%20a%20urdf%20file

when i try to build the package using catkinmake in the catkinws directory, I get the following error:

/home/adi/catkin_ws/src/testbot_description/src/parser.cpp: In function ‘int main(int, char**)’:
/home/adi/catkin_ws/src/testbot_description/src/parser.cpp:14:23: error: ‘testbot’ was not declared in this scope
   if (!model.initFile(testbot.urdf)){
                       ^
make[2]: *** [testbot_description/CMakeFiles/parser.dir/src/parser.cpp.o] Error 1
make[1]: *** [testbot_description/CMakeFiles/parser.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

Appreciate your help!

Asked by Adibot on 2016-04-10 21:44:21 UTC

Comments

Answers

The tutorial you link does not instruct you to replace the urdf_file variable name with the name of your urdf file. If you look at the example code, urdf_file is a variable that gets assigned the first parameter given to the program you are creating:

std::string urdf_file = argv[1];

You don't need to replace urdf_file with an actual file name. Just pass it as a parameter when starting the parser program.

PS:

I'm following this tutorial on creating a simple URDF for use in Gazebo

If you just want to create URDFs, and not read or parse them, I'd recommend following the Learning URDF Step by Step tutorials. The Learning URDF tutorials will teach you about the programmatic (C++) interface(s), which is probably not what you are interested int.

Asked by gvdhoorn on 2016-04-11 01:45:56 UTC

Comments

gvdhoorn answer is true, but if you still get problems. Like I did, You could try this

in

CMakeList.txt

change

find_package(catkin REQUIRED )

to

find_package(catkin REQUIRED urdf )

Asked by epowerpixi on 2016-06-12 19:39:16 UTC