0
$\begingroup$

Rosanswers logo

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/WritingTeleopNode ).

I also used as example the code found at JetsonHacks https://github.com/jetsonhacks/jetsoncar_teleop

Thanks for the support.


Originally posted by renanmb on ROS Answers with karma: 33 on 2017-06-22

Post score: 0


Original comments

Comment by gvdhoorn on 2017-06-22:
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.

Comment by gvdhoorn on 2017-06-22:
One thing to check: have you built your workspace (ie: ran catkin_make) and then sourced the devel/setup.bash file?

Comment by renanmb on 2017-06-22:
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

Comment by gvdhoorn on 2017-06-22:
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 find teleop_joy, as it won't be created due to the compiler failing.

Comment by gvdhoorn on 2017-06-22:
If I fix those errors, the binary is generated and after source devel/setup.bash I can successfully run: rosrun test_node teleop_joy. The CMakeLists.txt seems ok. At least on my end only the compiler errors were preventing things from working.

Comment by renanmb on 2017-06-22:
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.

Comment by gvdhoorn on 2017-06-22:
There is nothing wrong with CMakeLists.txt. See my answer.

Comment by renanmb on 2017-06-22:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Bit of a strange answer, but see below for the diff that shows how I fixed the errors in your program:

diff --git a/src/teleop_joy.cpp b/src/teleop_joy.cpp
index 740d928..645d14a 100644
--- a/src/teleop_joy.cpp
+++ b/src/teleop_joy.cpp
@@ -37,12 +37,12 @@ TeleopTurtle::TeleopTurtle():
   angular_(0),
   deadman_axis_(4),
   l_scale_(2.0),
-  a_scale(2.0)
+  a_scale_(2.0)
 {

   ph_.param("axis_linear", linear_, linear_);
   ph_.param("axis_angular", angular_, angular_);
-  ph.param("axis_deadman", deadman_axis_, deadman_axis_);
+  ph_.param("axis_deadman", deadman_axis_, deadman_axis_);
   ph_.param("scale_angular", a_scale_, a_scale_);
   ph_.param("scale_linear", l_scale_, l_scale_);

@@ -53,7 +53,7 @@ TeleopTurtle::TeleopTurtle():

   joy_sub_ = nh_.subscribe<sensor_msgs::Joy>("joy", 10, &TeleopTurtle::joyCallback, this);

-  timer_ = nh_.createTimer(ros::Duration(0.1), boost::bind(&TurtlebotTeleop::publish, this));
+  timer_ = nh_.createTimer(ros::Duration(0.1), boost::bind(&TeleopTurtle::publish, this));
 }

After that I could successfully build the workspace and after source devel/setup.bash everything 'just worked'.


Originally posted by gvdhoorn with karma: 86574 on 2017-06-22

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by gvdhoorn on 2017-06-22:
PS: if I may suggest: unless you are writing a teleop node for the learning experience, I would really suggest you see if teleop_twist_joy works for what you need. Always better to reuse than to reimplement.

Comment by renanmb on 2017-06-22:
My mistake was terrible. I may need a pair of glasses. But the code still doesnt work as supposed. I believe it can be button mapping for the DS4 or I made a mess trying to put this "Deadman" button. I am writing it for learning experience, reusing is fast but dont teach as much as trying to write

Comment by gvdhoorn on 2017-06-23:
teleop_twist_joy could still be a reference for what you are trying to achieve. It depends a bit on what you want to spend your time: getting your robot to work or fight with joysticks.

Comment by renanmb on 2018-09-23:
Later on I solved the problem by trial and error and making a controller mapping. I was writing a teleop node for the learning experience and later on I applied on some projects that required personalized teleop node

$\endgroup$

Your Answer

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