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

How to use state_publisher launch file

asked 2014-07-24 14:51:02 -0500

Kaddoura gravatar image

updated 2014-07-24 16:40:24 -0500

I have managed to solve most of my problems, but the missing thing with me is with the CMakeLists.txt of the hand_pub. (BTW should I edit it for the hand_urdf ??) I have added the following in my CMakeLists.txt, is there any thing I should add?

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs) catkin_package() include_directories(include ${catkin_INCLUDE_DIRS}) add_executable(state_publisher state_publisher.cpp) target_link_libraries(state_publisher ${catkin_LIBRARIES})

Because I am getting an error when trying catkin_make. I am not sure if my cpp file is wrong or it is not able to compile at all.

my old post:

I have finished my URDF file and saved it in catkin_ws/src/hand/hand_urdf/urdf (its name is hand.urdf) I was able to open it in rviz using :

roslaunch urdf_tutorial display.launch model:=Hand.urdf gui:=True

(the current directory being the one stated above) and everything works and I can move the hand and everything using the state_publisher gui. Then I worked on the state_publisher, I did the state_publisher.cpp and saved it in catkin_ws/src/hand/hand_pub and wrote a launch file called display.launch and saved it in catkin_ws/src/hand/hand_pub/launch I think I have something wrong with my launch file which is:

<launch> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/> <node name="state_publisher" pkg="hand" type="state_publisher"/> </launch>

My question is do I have something wrong with the directories? Do I have something wrong with my launch file? Most importantly how do I run everything together from terminal (I think that I have to run the launch file but what is the exact command for that) i.e. for the urdf I called roslaunch urdf_tutorial display.launch model:=Hand.urdf gui:=True.

edit retag flag offensive close merge delete


If you are getting an error, please post the error.

David Lu gravatar image David Lu  ( 2014-07-25 11:17:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-07-24 15:36:19 -0500

David Lu gravatar image

You also need to upload the urdf to the parameter server. Do this by adding the following line to your launch file.

<param name="robot_description" textfile="$(find hand_urdf)/urdf/hand.urdf" />

(assuming that I'm reading your directories correctly)

edit flag offensive delete link more


Thank you for your help, now I am getting an error when compiling the state_publisher.cpp file using CMakeLists, please check my post after I edited it and see if you can help me.

Kaddoura gravatar image Kaddoura  ( 2014-07-24 16:42:25 -0500 )edit

Question Tools

1 follower


Asked: 2014-07-24 14:51:02 -0500

Seen: 209 times

Last updated: Jul 24 '14