rosserial - arduino - custom message - message larger than buffer
Hey guys,
I wrote a custom message which looks like:
geometry_msgs/Vector3[] data
so i got an array of Vector3()'s. I can use this message, echo it, etc... So I am assuming that everything worked fine here.
Now I am using an Arduino Mega to subscribe this message. Which seems to work to. But I got the following problem:
I am publishing a message which contains out of 14 Vector3()'s and I am getting this error:
[ERROR] [WallTime: 1430219046.856917] Message from ROS network dropped: message larger than buffer.
If I publish a message which contains out of 4 Vector3()'s everything works fine. Is this message really too big? Shoudnt it be something like 14 (entries in the array) * 8 (Float64) * 3 (three points for each vector) = 336 Bytes? Is this really too much for the Arduino?...
I found out that I have to change the buffer as descriped here http://wiki.ros.org/rosserial/Overvie... .
typedef NodeHandle_<ArduinoHardware, 25, 25, 1024, 256> NodeHandle;
I dont get the error anymore, but if I echo the topic /Test (see in the code below) I dont see any value (at least for 14 entries in the message. For 4 Values it works perfectly fine!). The Publisher for /Test is made, so that I can see if the message gets transferred correctly.
So though I set the buffer up to 1024 Bytes
[INFO] [WallTime: 1430223859.870142] Note: subscribe buffer size is 1024 bytes
the message is not transferred correctly.
Any ideas how to solve this problem? Thanks alot in advance!
P.S.: My general goal is to send speed information for two stepper motors and a information about the time to the arduino. So each vector looks smth like: (v1 , v2 , t). And i got - at the moment - 14 of them. There might be more in the future!
In case that there is a more handy solution for this, feel free to suggest.
[EDIT]
Actually I tried many Vector3()'s can be in the array, so that the message will be transferred correctly. As chance would have it I only can transfer 4 Vector3()'s in the array... That would only be 4 * 8 * 3 = 96 Bytes right? :0
// einbinden der Bibliotheken
#include <AccelStepper.h>
#include <ros.h>
#include <vector_3_array/Vector3DArray.h>
#include <geometry_msgs/Vector3.h>
#include <std_msgs/Float32.h>
#include <std_msgs/Bool.h>
ros::NodeHandle nh;
std_msgs::Float32 test;
ros::Publisher testpub("Test", &test);
// Interface, PIN1, PIN2
AccelStepper stepper_rot(1, 9, 8);
AccelStepper stepper_lin(1, 3, 2);
void stelldaten_transformation( const vector_3_array::Vector3DArray& vectordaten_tabelle)
{
test.data = vectordaten_tabelle.data[3].x;
testpub.publish( &test);
test.data = vectordaten_tabelle.data[3].y;
testpub.publish( &test);
test.data = vectordaten_tabelle.data[3].z;
testpub.publish( &test);
}
void subscribetest( const std_msgs::Bool& boolee)
{
test.data = 10.1;
testpub.publish( &test);
}
//Initialisieren der ROS Messages
ros::Subscriber<vector_3_array::Vector3DArray> vectordaten("Stelldaten", &stelldaten_transformation);
ros::Subscriber<std_msgs::Bool> booleantest("Boolean", &subscribetest);
void setup()
{
//stepper.setSpeed(4000);
nh.initNode();
nh.subscribe(vectordaten);
nh.subscribe(booleantest);
nh.advertise(testpub);
}
void loop ...