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

argument problem to publish msg to a certain topic

asked 2012-04-26 23:25:14 -0500

grge gravatar image

updated 2012-04-27 13:41:05 -0500

joq gravatar image

hello. i roslaunch a turtlebot in an empty world, and i am trying to send data in a topic but i am having a problem. the topic is /gazebo/set_model_state, which have a type of gazebo_msgs/ModelState. so the arguments i have to include into rostopic -pub command are:

string model_name
geometry_msgs/Pose pose
  geometry_msgs/Point position
    float64 x
    float64 y
    float64 z
  geometry_msgs/Quaternion orientation
    float64 x
    float64 y
    float64 z
    float64 w
geometry_msgs/Twist twist
  geometry_msgs/Vector3 linear
    float64 x
    float64 y
    float64 z
  geometry_msgs/Vector3 angular
    float64 x
    float64 y
    float64 z
string reference_frame

i've read the tutorials, but they didn't help me with it. please, if anyone nose how to publish msg to that, help me!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-04-27 13:58:01 -0500

michikarg gravatar image

updated 2012-04-27 14:00:29 -0500

I know there is a way to publish such messages via command line, but for more complex messages i recommend to write a simple publisher like in the tutorial:

http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28python%29

You can use the same code to write a simple publisher with the only difference that instead of a string you will need to post a pose. Code should look similar to the following:

import roslib; roslib.load_manifest('geometry_msgs')    
(...)
from geometry_msgs.msg import PoseStamped
(...) 
my_pose = Pose()
my_pose.position.x = 0.1
my_pose.position.y = 0.2
(...)
        pub.publish(my_pose)
(...)
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-04-26 23:25:14 -0500

Seen: 705 times

Last updated: Apr 27 '12