Ask Your Question
0

How to run a cpp file in ROS?

asked 2019-04-23 12:57:39 -0600

vnovelo gravatar image

I'm currently using the 'april_tags_ros" package: http://wiki.ros.org/apriltags_ros

I'm trying to run the april_tags_detector_node.cpp file to detect an april tag setup in the Gazebo environment. We're using the PX4 for running flights, and I'm having trouble actually runinnf the file. I keep getting errors of 'gcc: error: april_tag_detector_node: No such file or directory'. Any help would be appreciated.

edit retag flag offensive close merge delete

Comments

1

I keep getting errors of 'gcc: error: april_tag_detector_node: No such file or directory'.

that's a compiler error, while your question title and part of the question text asks how to "run a cpp file". Those are two different things.

.cpp files are first compiled. The objects then linked. The resulting binary is then executed (or "run").

Could you please update your question to make it clear where the actual problems are?

gvdhoorn gravatar imagegvdhoorn ( 2019-04-23 14:07:50 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-25 05:51:47 -0600

@vnovelo, please provide more information. I will suggest some solutions, but none of them may work since you didn't give too much information.

WARNING! According to apriltags_ros package, it only supports ROS Indigo distribution. If you are trying to use this package with ROS Kinetic, it may not be possible and the error might be caused by this!

1-) After installing april_tags_ros package did you build it with catkin_make? All you need to is going catkin_ws directory and typing catkin_make.

2-) Did you source the setup.bash file? Try:

source catkin_ws/source/devel.setup.bash

You need to source in each terminal you call ros nodes. If you don't want to source everytime, add above command to .bashrc

3-) If you did previous two steps, and still couldn't get the node working, open CMakeLists.txt file inside of april_tags_ros package and check the lines: add_executable(apriltags_ros src/apriltags_ros/april_tag_detector_node.cpp ) If it doesn't exist, add this line. However, probably it exists and your problem is caused by the reason in WARNING! part.

I hope this helps. Don't forget to mark this comment as answer!

edit flag offensive delete link more

Comments

After installing april_tags_ros package did you build it with catkin_make? All you need to is going catkin_ws directory and typing catkin_make.

No, you need a little more than that. See #q252478 for an example workflow.

gvdhoorn gravatar imagegvdhoorn ( 2019-04-25 06:04:34 -0600 )edit

@gvdhoorn, I assumed he is downloaded the package into catkin_ws/src directory. Yet, you are definitely right! In any case, we need more information to understand the situation better.

samialperen gravatar imagesamialperen ( 2019-04-25 06:19:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-04-23 12:57:39 -0600

Seen: 471 times

Last updated: Apr 25 '19