How to properly create a Joy Node or any node.
I made this post because I couldn`t find any detailed explanation on the web about how to build a node from scratch and it may help anyone trying to self-learn ROS. I tried to build a node for controlling the Turtle sim using my PS4 joystick using different buttons and axis with learning purpose for later applying at my robot.
However while trying to run I receive back the message:
couldn`t find executable named teleop_joy below /home/rmb/workspace1/src/test_node
My code: https://github.com/renanmb/SURP
It happens using rosrun and roslaunch. I don`t understand why since I tryied to keep the code very similar to the code found at the Ros Joy Tutorial ( http://wiki.ros.org/joy/Tutorials/Wri... ).
I also used as example the code found at JetsonHacks https://github.com/jetsonhacks/jetson...
Thanks for the support.
Probably not the answer you are looking for, but: have you completed the regular -- beginner -- ROS tutorials on the wiki? This would seem to be something that is covered there.
One thing to check: have you built your workspace (ie: ran
catkin_make
) and thensource
d thedevel/setup.bash
file?Yes, I did all tutorials. I know that I need to compile running catkin_make or cmake, and for each workspace that I will be working with I need to source the devel/setup.bash . I followed all that and still get the message that there is no executable. The mistake is probably at CMakeLists, file .cpp
If I try to compile your code, I get three compiler errors. Is the code on your github repo identical to what you have on your machine? If so, then it would make sense that
rosrun
can't findteleop_joy
, as it won't be created due to the compiler failing.If I fix those errors, the binary is generated and after
source devel/setup.bash
I can successfully run:rosrun test_node teleop_joy
. TheCMakeLists.txt
seems ok. At least on my end only the compiler errors were preventing things from working.but why the compiler is failing? Is It probably something in the CMakeLists? I don`t know what I made wrong because I just followed like it says in the Tutorial. I not included the directory include, but I think is only necessary CMakeLists.txt , package.xml and the executable in the src directory.
There is nothing wrong with
CMakeLists.txt
. See my answer.So what was the errors in the compiler? I got lost trying to learn CMake in 1 night. So do you think it is an installation problem with the compiler? Both my devices run on ARM 64.