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

rosrun: unable to locate the node robot_state_publisher

asked 2019-01-04 06:22:30 -0500

microbot gravatar image

updated 2019-01-04 07:16:36 -0500

gvdhoorn gravatar image

The exact error I am having is

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

I have cloned the robot_state_publisher from ros wiki and already had done rosmake.

I have also sourced the terminal to devel before using rosrun aswell as exported all the reqaquired core packages and python path to the terminal before trying to run the robot_state_publisher.

here is the my CmakeList.txt file,

cmake_minimum_required(VERSION 2.8)
project(robot_state_publisher)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")

find_package(orocos_kdl REQUIRED)
find_package(catkin REQUIRED
  COMPONENTS roscpp rosconsole rostime tf tf2_ros tf2_kdl kdl_parser
)
find_package(Eigen3 REQUIRED)

find_package(urdfdom_headers REQUIRED)

catkin_package(
  LIBRARIES ${PROJECT_NAME}_solver
  INCLUDE_DIRS include
  DEPENDS roscpp rosconsole rostime tf2_ros tf2_kdl kdl_parser orocos_kdl urdfdom_headers
)

include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS})
include_directories(include ${catkin_INCLUDE_DIRS} ${orocos_kdl_INCLUDE_DIRS} ${urdfdom_headers_INCLUDE_DIRS})
link_directories(${orocos_kdl_LIBRARY_DIRS})

add_library(${PROJECT_NAME}_solver
  src/robot_state_publisher.cpp src/treefksolverposfull_recursive.cpp
)
target_link_libraries(${PROJECT_NAME}_solver ${catkin_LIBRARIES} ${orocos_kdl_LIBRARIES})

add_library(joint_state_listener src/joint_state_listener.cpp)
target_link_libraries(joint_state_listener ${PROJECT_NAME}_solver ${orocos_kdl_LIBRARIES})

add_executable(${PROJECT_NAME} src/joint_state_listener.cpp)
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_solver ${orocos_kdl_LIBRARIES})

# compile the same executable using the old name as well
add_executable(state_publisher src/joint_state_listener.cpp)
target_link_libraries(state_publisher ${PROJECT_NAME}_solver ${orocos_kdl_LIBRARIES})

Can you please help me solve this problem, I am trying to run a robot I have designed using xacro on gazebo and control it with ros. I have already installed ros_control and ros_gazebo packages. Thank you advance,

edit retag flag offensive close merge delete

Comments

I have cloned the robot_state_publisher from ros wiki

why?

and already had done rosmake.

why?

Did sudo apt-get install ros-kinetic-robot-state-publisher not work for you?

gvdhoorn gravatar image gvdhoorn  ( 2019-01-04 06:47:07 -0500 )edit

Please remove robot_state_publisher from your workspace (remove your build and devel folders as well), install the binary version, rebuild your workspace and try again.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-04 06:49:04 -0500 )edit

after cloning it from the wiki, I had used rosmake to compile the cloning package. I am not sure whether its mandatory or not but I followed the same process i follow to create any new packages on catkin workspace.

microbot gravatar image microbot  ( 2019-01-04 07:09:39 -0500 )edit

I followed the same process i follow to create any new packages on catkin workspace.

rosmake is not used for Catkin packages. That would be catkin_make (or catkin build).

gvdhoorn gravatar image gvdhoorn  ( 2019-01-04 07:11:07 -0500 )edit

In general: always try to use binary packages and install them using apt (or apt-get). There are few cases where you'd want to / need to build packages from source. git clone should not be your default for installing ROS packages.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-04 07:12:00 -0500 )edit

build and devel folders contains other ros packages that I have been using. Doesn't remove the entire folders affect the entire project in a way that I had to create them all again ? and also may I know how it is going to help ?

microbot gravatar image microbot  ( 2019-01-04 07:12:19 -0500 )edit

build and devel folders contains other ros packages that I have been using. Doesn't remove the entire folders affect the entire project in a way that I had to create them all again ?

build and devel contain only derived resources -- if you're using a normal Catkin workspace setup. ..

gvdhoorn gravatar image gvdhoorn  ( 2019-01-04 07:13:05 -0500 )edit

.. That means that after removing build and devel, a catkin_make should result in all the pkgs in src being rebuilt. In the end devel should contain the same packages as before.

and also may I know how it is going to help ?

you've added robot_state_publisher to your workspace, ..

gvdhoorn gravatar image gvdhoorn  ( 2019-01-04 07:14:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-01-04 07:42:32 -0500

gvdhoorn gravatar image

As to your question: yes. Remove src/robot_state_publisher, remove devel and build folders, run sudo apt-get install ros-kinetic-robot-state-publisher and then rebuild your workspace (run catkin_make).

edit flag offensive delete link more

Comments

Thank you very much, now I have got it about how to install. Thank you once again.

microbot gravatar image microbot  ( 2019-01-06 09:52:37 -0500 )edit

the question I have asked had already been answered although I have got a beginner confusion , could you please point me where the packages I installed using apt-get command located ? I have checked in the ros folder and it contains only ros core packages. can you please help me ?

microbot gravatar image microbot  ( 2019-01-07 04:36:42 -0500 )edit

try

roscd robot_state_publisher/

then

pwd
sciduck gravatar image sciduck  ( 2020-08-19 14:00:20 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-01-04 06:22:30 -0500

Seen: 2,145 times

Last updated: Jan 04 '19