Ask Your Question

Simple problem with TwistStamped msg

asked 2015-07-13 06:09:11 -0600

Alvaro Salcedo gravatar image

updated 2015-07-13 06:11:24 -0600

hi Ros users:

I am trying to do an array of velocities. This is my code:

  geometry_msgs::Twist cmd;
  geometry_msgs::TwistStamped tiempo;
  cmd.linear.x = 1; 
  cmd.linear.y = 0;
  cmd.linear.z = 0;

  cmd.angular.x = 0;
  cmd.angular.y = 0;
  cmd.angular.z = 4;

But when it is compiled i can see these errors on terminal

/home/alcor/catkin_ws/src/lanzar_velocidades/src/arrayvel.cpp:52:3: error: ‘geometry’ has not been declared geometry::TwistStamped tiempo; ^ /home/alcor/catkin_ws/src/lanzar_velocidades/src/arrayvel.cpp:52:26: error: expected ‘;’ before ‘tiempo’
geometry::TwistStamped tiempo; ^ /home/alcor/catkin_ws/src/lanzar_velocidades/src/arrayvel.cpp:57:3: error: ‘tiempo’ was not declared in this scope tiempo.header.stamp=5;
^ make[2]: * [lanzar_velocidades/CMakeFiles/arrayvel_node.dir/src/arrayvel.cpp.o] Error 1 make[1]: * [lanzar_velocidades/CMakeFiles/arrayvel_node.dir/all] Error 2

Any ideas?


edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-07-13 06:26:24 -0600

dornhege gravatar image

stamp must be a ros::Time object. Also 5 seems quite arbitrary and is probably not gonna do what you want it to do.

edit flag offensive delete link more

answered 2015-07-13 06:29:15 -0600

Alvaro Salcedo gravatar image

Thanks for your response @dornhege

I would like to publish a linear velocity of 1 m/s and in 5sec I would like to publish an angular velocity of 4. Is that the way to do this?


edit flag offensive delete link more


Please do not create answers for discussion or comments. Instead, either edit and append to your original post or use the comment functionality.

dornhege gravatar imagedornhege ( 2015-07-13 06:36:25 -0600 )edit

This is not. Do what you say. Publish 1m/s and in 5sec publish angular of 4rad/s.

dornhege gravatar imagedornhege ( 2015-07-13 06:36:53 -0600 )edit

but How can I publish a velocity in 5sec?

Alvaro Salcedo gravatar imageAlvaro Salcedo ( 2015-07-13 06:43:37 -0600 )edit

Use code, wait 5s, i.e. this is not a ROS thing. Just make sure you publish 5s later.

dornhege gravatar imagedornhege ( 2015-07-13 06:54:36 -0600 )edit

Yes, but how can I wait 5sec in code? with ros sleep?

Alvaro Salcedo gravatar imageAlvaro Salcedo ( 2015-07-13 07:14:25 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-07-13 06:09:11 -0600

Seen: 661 times

Last updated: Jul 13 '15