msg file needed?
hello reader,
do i need a msg-file when i want to write a publisher and a subscriber? and if yes, how do i have to integrate the file into the publisher-code and the subscriber-code?
thx in advance
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
hello reader,
do i need a msg-file when i want to write a publisher and a subscriber? and if yes, how do i have to integrate the file into the publisher-code and the subscriber-code?
thx in advance
The tutorials and the wiki are always a good starting point. Have a look at this wiki page and this, this and this tutorial.
You always need a message file to generate the C++ files that define the types you need for subscribing and publishing. For instance std_msgs/msg/String.msg
is used to generate std_msgs/String.h
which is for instance used in the above tutorials. ROS provides a lot of pre-defined messages and if you can, you should use them. If you cannot find a matching message, you need to define it yourself.
Asked: 2012-08-28 21:45:56 -0500
Seen: 401 times
Last updated: Aug 28 '12
adding std_msgs Int16 and int ?
using ros::shutdown() in arduino code
Help with writing a subscriber node for an existing publisher
group topics with diferent publishing rates
Problem with subscribing to a topic that contains slash
Subscriber data not up to date
Node to NOde synchronous communication using Publisher Subscriber Architecture
Custom Nodes not publishing or subscribing, why?
publish after processing data from 2 synced subscribers (rospy)
and what if i want to publish an 1 dimensional array? do i just need to include "std_msgs/Float64MultiArray.h" or do i need something else?
You can use Float64MultiArray but it might be a bit tricky because you need to give a layout definition. Have a look at the message definitions for more info. They contain some documentation. I personally think that Float64MultiArray doesn't provide enough semantics and I'd define my own message.
hm, i see. and what do i write into my own defined message? double arrayname[4]?
Depends on what you want to send around. Have a look at this page for data types you can use.
i want to send a 1-dim double array with the size of 4
It would be
float64 arrayname[4]