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 -0600
Seen: 433 times
Last updated: Aug 28 '12
Subscriber and Publisher node at once in cpp
Which ways of communicating with a controller are real-time safe?
basic question in understanding publishing and subscribing
Programmatically get ModelState from Gazebo
Problem using subscribed motor position topic
Publisher Subscriber Teleoperation -- High Latency?
Rosserial/Arduino Publishers and Subscribers
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]