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

what is header.seq, header.stamp header.frame_id for mavros topics

asked 2018-02-27 20:02:29 -0500

Nebula gravatar image

I am not able to understand the following error (specially first three arguments of the header) with msg type Type: geometry_msgs/PoseStamped. It would be good if I get example for this command

rostopic pub -r 1 /mavros/setpoint_position/local  geometry_msgs/PoseStamped geometry_msgs/Pose '[0.0,0.0,3.0]' '[0.0,0.0,0.0]'
    ERROR: Too many arguments:
     * Given: ['geometry_msgs/Pose', [0.0, 0.0, 3.0], [0.0, 0.0, 0.0]]
     * Expected: ['header', 'pose']

Args are: [header.seq header.stamp header.frame_id pose.position.x pose.position.y pose.position.z pose.orientation.x pose.orientation.y pose.orientation.z pose.orientation.w]

Here is datatype of msg

rosmsg show geometry_msgs/PoseStamped
std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
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
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2018-02-28 00:58:16 -0500

mgruhler gravatar image

The general command should look like this pub <topic-name> <topic-type> [data...].

So the geometry_msgs/Pose [...] part is wrong in your example. If you hit tab after geometry_msgs/PoseStamped it will create you the required data fields and you can fill them out. Not that the orientation in a pose is actually a quaternion and thus requires for values.

rostopic pub -r 1 /mavros/setpoint_position/local  geometry_msgs/PoseStamped "header:
  seq: 0
    secs: 0
    nsecs: 0
  frame_id: ''
    x: 0.0
    y: 0.0
    z: 0.0
    x: 0.0
    y: 0.0
    z: 0.0
    w: 0.0"
edit flag offensive delete link more


what are the variables associated with header seq, secs, nsecs and frame_id?

Nebula gravatar image Nebula  ( 2018-02-28 02:14:47 -0500 )edit

what do you mean with "what are the variables"? The header is a standard ROS msg ( ).

mgruhler gravatar image mgruhler  ( 2018-02-28 03:17:30 -0500 )edit

answered 2018-02-28 03:48:59 -0500

Delb gravatar image

updated 2018-02-28 03:50:17 -0500

You can take example on this command:

rostopic pub <topic_name> <topic-type> "{header: {stamp: now, frame_id: 'value'}}"

Here you can define the parameters for your header (you can also write {header: auto} if you don't care about those parameters).

For your application this should be:

rostopic pub -r 1 /mavros/setpoint_position/local  geometry_msgs/PoseStamped "{header:{stamp: now, frame_id: 'value'}, pose: {position: {x: 1.0, y: 5.0, z: 2.0}, orientation: {x: 0.0, y: 1.0, z: 5.0, w: 10.0}}}"

This is to answer your question but you should really consider writing a simple publisher with parameters/arguments that you could define when executing a rosrun/roslaunch command.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-02-27 20:02:29 -0500

Seen: 5,958 times

Last updated: Feb 28 '18