ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
So, I've also been playing around with similar problems trying to send an Imu message (about 320 bytes) using a 328 (set in rosserial for 280 bytes) and I couldn't get it to work.
This is what I have learning by experimenting with that problem and also by comparing a 328 nano with a 168 nano.
First it is important to note that adjusting memory needs to be done from both sides, i.e. setting the buffers too low will also be a problem because then the initialization messages won't fit. For the HelloWorld example I needed to set a minimum size of 79 (this will increase if the topic name is longer).
I tried to increase the buffer to get to the working area for sending strings in the helloworld example and found out that on the 168
ros::NodeHandle_<ArduinoHardware, 2, 2, 80, 105> nh;
is the highest setting that works.
So, depending on what you want to send this might be sufficient although the memory limit is quite harsh.
I tried to play around the same way on the 328 Nano for the Imu message, but did not succeed. Interestingly enough it didn't even work on a Mega that is setup to 512 by default. There were no error messages, but also nothing happened.
Digging through the code, these sizes really are just the size of the used buffer. Serial data is sent byte-wise in a for loop. Judging from that, if 280 for in- and output buffer is OK, so should 320 for one and 240 for the other - regarding memory-consumption. This is something that I do not understand, yet. It would be interesting to see if someone knows the reasons for these limits.