0
$\begingroup$

Rosanswers logo

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/Tutorials/RobotSetup/TF

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?


Originally posted by jimc91 on ROS Answers with karma: 29 on 2020-06-30

Post score: 0


Original comments

Comment by Teo Cardoso on 2020-06-30:
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])

Comment by jimc91 on 2020-07-02:
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)

Comment by jimc91 on 2020-07-02:
However, when I run [catkin_make] again I get some different errors

Base path: /home/jamescoady/catkin_ws
Source space: /home/jamescoady/catkin_ws/src
Build space: /home/jamescoady/catkin_ws/build
Devel space: /home/jamescoady/catkin_ws/devel
Install space: /home/jamescoady/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/jamescoady/catkin_ws/build"
####
#### Running command: "make -j8 -l8" in "/home/jamescoady/catkin_ws/build"
####
[0%] Built target std_msgs_generate_messages_cpp
[0%] Built target std_msgs_generate_messages_py
[0%] Built target std_msgs_generate_messages_eus
[0%] Built target std_msgs_generate_messages_lisp
[0%] Built target std_msgs_generate_messages_nodejs
Scanning dependencies of target tf_broadcaster
make[2]: *** No rule to make target 'robot_setup_tf/CMakeFiles/tf_broadcaster.dir/build'.  Stop.

There is more to follow in next message as I ran out of characters

Comment by jimc91 on 2020-07-02:
CMakeFiles/Makefile2:3855: recipe for target 'robot_setup_tf/CMakeFiles/tf_broadcaster.dir/all' failed

        make[1]: *** [robot_setup_tf/CMakeFiles/tf_broadcaster.dir/all] Error 2

        make[1]: *** Waiting for unfinished jobs....

        [  1%] Built target raspicam_node_gencfg

        [  1%] Built target _turtlebot3_msgs_generate_messages_check_deps_SensorState

        [  1%] Built target _turtlebot3_msgs_generate_messages_check_deps_Sound

        [  1%] Built target _turtlebot3_msgs_generate_messages_check_deps_VersionInfo

        [  1%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts

        [  1%] Built target _beginner_tutorials_generate_messages_check_deps_Num

        [  1%] Built target _raspicam_node_generate_messages_check_deps_MotionVectors

        Makefile:138: recipe for target 'all' failed

        make: *** [all] Error 2

        Invoking "make -j8 -l8" failed

Comment by jimc91 on 2020-07-07:
Teo Cardoso, would you have any advice on this?

Comment by Teo Cardoso on 2020-07-07:
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

Comment by jimc91 on 2020-07-10:
Sorry for the delay, here is the structure of the package:

jamescoady@jamescoady-Inspiron-5579:~$ cd catkin_ws/src/robot_setup_tf

jamescoady@jamescoady-Inspiron-5579:~/catkin_ws/src/robot_setup_tf $ tree
.
├── CMakeLists.txt
├── include
│   └── robot_setup_tf
├── package.xml
└── src
    ├── tf_broadcaster.cpp.odt
    └── tf_listener.cpp.odt

3 directories, 4 files

Comment by jimc91 on 2020-07-14:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

In the files 'tf_listener.cpp.odt' and 'tf_broadcaster.cpp.odt'.

Remove the '.odt' from the name. The file name should be tf_broadcaster.cpp only. Same to the listener.

I guess this should solve your problems.


Originally posted by Teo Cardoso with karma: 378 on 2020-07-11

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by jimc91 on 2020-07-14:
I went back and started again. When saving tf_broadcaster.cpp and tf_listener.cpp, I saved both as text files then ran catkin_make again and there was no issue.

Comment by islemhm on 2021-06-15:
@Teo Cardoso I have the same error even the files are saved without .odt and when I run [catkin_make] I get errors

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.