Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 77

How to publish 2D array of int type

$
0
0
How does one go about publishing a 2D array of the integer type in ROS? I am using C++ for this node i am writing. #include "ros/ros.h" #include //include? int main(int argc, char **argv) { ros::init(argc, argv, "talker"); ros::NodeHandle n; ros::Publisher chatter_pub = n.advertise("chatter", 1000); //Is this correct? ros::Rate loop_rate(10); //define array data int[2][2]; data[0][0] = 12; data[1][1] = 23; while (ros::ok()) { chatter_pub.publish(data); ros::spinOnce(); loop_rate.sleep(); } return 0; } I have tried many things by now and I am really out of options. Anybody that can demonstrate this? Simply said: I would like the above code to be checked and edited so that it compiles without errors and that it sends a 2D array of type integer.

Viewing all articles
Browse latest Browse all 77

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>