After changing the buffer size, error again in publishing a array msgs with large data length 240in Arduino?
Dear all, I am trying to publish a msgs with large data size on Arduino. I am using Float32MultiArray msgs. Thanks for the solutions from http://answers.ros.org/question/12545... So, I changed the buffer size from 280 to 512. However, when i increase the data_length more than 30, it shows an error in the terminal:
[INFO] [WallTime: 1391356801.758318] Failed Packet Flags
after the command rosrun rosserial_python serial_node.py /dev/ttyACM0
(the code as attached) again. If I keep the size below 30, the msgs can be published normally.
I want to pass 240 data size in one msgs array like array[240]..
Could you help me and give me some suggestion , please? thank you!!
#include <ros.h>
#include <ros time.h>
#include <std_msgs/Float32MultiArray.h>
ros::NodeHandle nh;
std_msgs::Float32MultiArray range_msg;
ros::Publisher pub_range("/test", &range_msg);
void setup()
{
nh.initNode();
range_msg.data_length=100;
nh.advertise(pub_range);
}
long range_time;
void loop()
{
//publish the adc value every 50 milliseconds
//since it takes that long for the sensor to stabilize
if ( millis() >= range_time ) {
for(int i=0;i<100;i++)
{
range_msg.data[i]=0.01222331221;
}
pub_range.publish(&range_msg);
range_time = millis() + 50;
}
nh.spinOnce();
}