Issues building transform broadcaster code
I am working through the Navgation Stack Tutorials on Ros.org.
I am using Ubuntu 16.04LTS and ROS Kinetic.
The issues occur when building the code (Step 5 from link below):
http://wiki.ros.org/navigation/Tutori...
I feel the issue is happening at Steps 3 and 4, when I am broadcasting and then using a transform.
I am being told to save the text files as src/tf_broadcaster.cpp and src/tf_listener.cpp.
But you cannot save a file using /, so I am saving them in my src folder as tf_broadcaster.cpp and tf_broadcaster.cpp.
I then edit the CMake.txt file in this folder to include the below text:
add_executable(tf_broadcaster src/tf_broadcaster.cpp)
add_executable(tf_listener src/tf_listener.cpp)
target_link_libraries(tf_broadcaster ${catkin_LIBRARIES})
target_link_libraries(tf_listener ${catkin_LIBRARIES})
I already know before I build my code that there will be an error as it is calling to add executable src/....
I build the code using the commands:
cd ~/catkin_ws/
catkin_make
I then get the error below:
CMake Error at robot_setup_tf/CMakeLists.txt:208 (add_executable):
Cannot find source file:
src/tf_broadcaster.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Error at robot_setup_tf/CMakeLists.txt:209 (add_executable):
Cannot find source file:
src/tf_listener.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Error: CMake can not determine linker language for target: tf_broadcaster
CMake Error: Cannot determine link language for target "tf_broadcaster".
CMake Error: CMake can not determine linker language for target: tf_listener
CMake Error: Cannot determine link language for target "tf_listener".
-- Generating done
-- Build files have been written to: /home/jamescoady/catkin_ws/build
Makefile:2866: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
What am I doing wrong here? Am I saving the files incorrectly in steps 3&4?
Could you update with the folder struct of the folders using the command "tree" (sudo apt install tree). In the package folder (Not in the workspace, the package [catkin_ws/src/robot_setup_tf])
When I run the command [catkin_ws/src/robot_setup_tf], I get the message [bash: catkin_ws/src/robot_setup_tf: Is a directory], so I am unsure if I am now in the package?
I ran [sudo apt install tree] after the first command above and it installed with no issues. (see next comment please)
However, when I run [catkin_make] again I get some different errors
There is more to follow in next message as I ran out of characters
CMakeFiles/Makefile2:3855: recipe for target 'robot_setup_tf/CMakeFiles/tf_broadcaster.dir/all' failed
Teo Cardoso, would you have any advice on this?
When I made the first comment I was aiming to see your folder struct because this error can be caused by missing files or something like this.
The command tree you generate something like this, could you post this struct of your package?
├── CMakeLists.txt
├── package.xml
├── scripts
│ ├── image2og.py
│ ├── map2.png
│ ├── map3.png
│ └── map4.png
└── src
Sorry for the delay, here is the structure of the package:
I edited both files to remove .odt but still get the exact same error when running catkin_make. I have not copied and pasted it as it is the same error in my messages to you on July 2nd.
Just to be sure the issue is with the current package that I am using. I removed robot_setup_tf from my scr space and have run catkin_make again with no errors.