ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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

asked 2018-10-11 07:40:04 -0600

lzheng gravatar image

updated 2018-10-11 07:45:30 -0600

Hello I took over a project on ROS and I'm still pretty new to the environment. I'm currently using ROS Kinetic and Ubuntu 16.04. I'm trying to launch a simple keyboard_teleop.launch program but get this error:

process[master]: started with pid [27909]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 25d5ccd0-cd3c-11e8-9d38-74e5f9149b23
process[rosout-1]: started with pid [27922]
started core service [/rosout]
ERROR: cannot launch node of type [teleop/teleop_key]: can't locate node [teleop_key] in package [teleop]

Here is the launch file:

<?xml version="1.0" encoding="UTF-8"?>
<launch>
  <!-- teleop_key already has its own built in velocity smoother -->
  <node pkg="teleop" type="teleop_key" name="teleop_keyboard"  output="screen">
    <param name="scale_linear" value="0.5" type="double"/>
    <param name="scale_angular" value="1.5" type="double"/>
    <remap from="teleop_keyboard/cmd_vel" to="/cmd_vel"/>
  </node>
</launch>

And the CMakeLists

cmake_minimum_required(VERSION 2.8.3)
project(teleop)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS roscpp geometry_msgs joy)

include_directories(${catkin_INCLUDE_DIRS})

catkin_package(
  INCLUDE_DIRS
  CATKIN_DEPENDS roscpp geometry_msgs joy
  DEPENDS
)

###########
## Build ##
###########

add_executable(teleop_joy src/joy.cpp)
target_link_libraries(teleop_joy ${catkin_LIBRARIES})

#############
## Install ##
#############

## Mark executable scripts (Python etc.) for installation
install(PROGRAMS
  scripts/teleop_key
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## Mark executables and/or libraries for installation
install(TARGETS teleop_joy
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## Mark all other useful stuff for installation
install(DIRECTORY launch
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
edit retag flag offensive close merge delete

Comments

Do you actually have a node named "teleop_key" in your package? The CMakeLists.txt file you posted compiles a node named "teleop_joy". The answer from @shiv_rar assumes you have a Python script providing "teleop_key", but I'm not sure how that conclusion was arrived at.

jarvisschultz gravatar image jarvisschultz  ( 2018-10-11 09:03:08 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2018-10-11 09:09:15 -0600

Delb gravatar image

updated 2018-10-11 09:10:13 -0600

You have the issue ERROR: cannot launch node of type [teleop/teleop_key]: can't locate node [teleop_key] in package [teleop] because there are no nodes called teleop_key.

Why ?

In your launch file you launch this node :

< node pkg="teleop" type="teleop_key" name="teleop_keyboard"  output="screen" >

You can check here all the attributes of the node tag. The strings you put here are defined by the CMakeLists.txt.

Your package is named teleop which is okay because you have project(teleop) in the CMakeLists.txt but you have set the type to teleop_key which correspond to the name of the executable, same as the one you would type when using rosrun. This name is defined in the CMakeLists.txt with the instruction add_executable. In your file you have add_executable(teleop_joy src/joy.cpp).

Solutions :

  • If you want to change the name of the executable for teleop_key, change it in the CmakeLists.txt in add_executable.
  • If you don't want to change the name modify your launch file to have type="teleop_joy".
edit flag offensive delete link more
1

answered 2018-10-11 08:47:17 -0600

shiv_rar gravatar image

Hey since you are running a python script be sure to add it as an executable in order for it to be called.

chmod u+x teleop_key.py

After that resource the workspace and in a CLI:

source ~/"your_root_ws"/devel/setup.bash

And then try running the node by itself and see if it works.

Hope this helps

edit flag offensive delete link more

Comments

Hi thanks for the fast reply ! I did exactly what you told me but I still get the same error :/

lzheng gravatar image lzheng  ( 2018-10-11 08:54:13 -0600 )edit

Hey last thing to try, add the .py extension to the type.

So:

rosrun teleop teleop_key.py

Also: <node pkg="teleop" type="teleop_key.py" name="teleop_keyboard" output="screen">

shiv_rar gravatar image shiv_rar  ( 2018-10-11 09:24:07 -0600 )edit

Thank you very much, it worked perfectly for me ! Not with rosrun teleop teleop_key.py but with roslaunch teleop teleop_keyboard.launch

lzheng gravatar image lzheng  ( 2018-10-11 09:47:38 -0600 )edit

Glad to help :)

shiv_rar gravatar image shiv_rar  ( 2018-10-11 09:49:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-10-11 07:40:04 -0600

Seen: 3,648 times

Last updated: Oct 11 '18