qboticslabs / mastering_ros

This repository contains exercise files of the book "Mastering ROS for Robotics Programming"
https://www.packtpub.com/hardware-and-creative/mastering-ros-robotics-programming
468 stars 282 forks source link

[chapter 3, Adding the ROS teleop node] roslaunch diff_wheeled_robot_control keyboard_teleop.launch #2

Closed wkyoun closed 8 years ago

wkyoun commented 8 years ago

I tried to do as chapter 3, Adding the ROS teleop node indicates (page.111)

wkyoun@wkyoun-XPS-13-9343:~/catkin_ws$ roslaunch diff_wheeled_robot_control keyboard_teleop.launch

However, it shows error as following:

ERROR: cannot launch node of type [diff_wheeled_robot_control/diff_wheeled_robot_key]: can't locate node [diff_wheeled_robot_key] in package [diff_wheeled_robot_control]

It seems to me that diff_wheeled_robot_key(made by python language) is not include in the package.

... logging to /home/wkyoun/.ros/log/601e2e90-c273-11e5-b9dd-c48e8ff3cd6f/roslaunch-wkyoun-    XPS-13-9343-3813.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.4:41147/

SUMMARY
========

PARAMETERS
 * /diff_wheeled_robot_key/scale_angular: 1.5
 * /diff_wheeled_robot_key/scale_linear: 0.5
 * /rosdistro: indigo
 * /rosversion: 1.11.16

NODES
  /
    diff_wheeled_robot_key (diff_wheeled_robot_control/diff_wheeled_robot_key)

ROS_MASTER_URI=http://192.168.0.4:11311

core service [/rosout] found
ERROR: cannot launch node of type [diff_wheeled_robot_control/diff_wheeled_robot_key]: can't     locate node [diff_wheeled_robot_key] in package [diff_wheeled_robot_control]
No processes to monitor
shutting down processing monitor...
... shutting down processing monitor complete
wkyoun commented 8 years ago

There should be catkin_install_python in CMakeLists.txt about diff_wheeled_robot_key node as http://wiki.ros.org/catkin/CMakeLists.txt indicates

But, nothing is found related to that:

Installing Python Executable Scripts

For Python code, the install rule looks different as there is no use of the add_library() and     add_executable() functions so as for CMake to determine which files are targets and what type of     targets they are. Instead, use the following in your CMakeLists.txt file:

catkin_install_python(PROGRAMS scripts/myscript
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
qboticslabs commented 8 years ago

@won13y I found the bug. I will update in the repo soon.

I can explain the steps to remove this error

1) Goto scripts folder 2) Change file permission of diff_wheeled_robot_key node using the following command chmod +x diff_wheeled_robot_key node

3) Open the script and comment the following like follows

import roslib

roslib.load_manifest('turtlebot_teleop')

and run the launch file. It will work

Try and reply if it is worked !! Thanks

qboticslabs commented 8 years ago

@won13y Updated the code !!

whyscience commented 6 years ago

chmod +x solve the problem