ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to use geometry_msgs/Twist.h ?

asked 2012-04-01 04:07:55 -0600

CoderKai gravatar image

updated 2014-01-28 17:11:49 -0600

ngrennan gravatar image

Hello, I'm trying to use stage with ROS. So I have modified the talker.cpp code, from the tutorial, to control the robot of the stage's tutorial. I have changed the declaration of the publisher to this:

 ros::Publisher chatter_pub = n.advertise<geometry_msgs::Twist>("cmd_vel", 1000);

And I add this too:

#include <geometry_msgs/Twist.h>

My problem is that the code cant compile because this library cant be found. The error given by the compiler is :

ros_workspace/stage_controllers/src/talker.cpp:4:33: error fatal: geometry_msgs/Twist.h: No existe el archivo o el directorio compilación terminada.

Its in spanish, but it means: fatal error: geometry_msgs/Twist.h: The file or directory doesn't exist, compilation finished.

I have tried to add the route of this file to the $PATH (/opt/ros/electric/stacks/common_msgs/geometry_msgs/msg_gen/cpp/include/geometry_msgs/Twist.h) and have done all the tutorial. So where should I add this route to makes it compile? Thanks for your time

edit retag flag offensive close merge delete


Please always copy-paste the error messages you get. It's hard to guess what's going wrong.

Lorenz gravatar image Lorenz  ( 2012-04-01 09:08:16 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2012-04-01 09:36:29 -0600

tfoote gravatar image

You need to have a dependency on geometry_msgs in you manifest, geometry_msgs needs to be in your ROS_PACKAGE_PATH and geometry_msgs needs to have been built. If you rosmake with it in you dependencies this will be done for you.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-04-01 04:07:55 -0600

Seen: 9,071 times

Last updated: Apr 01 '12