How to publish a array msgs with large data size in Arduino?
Dear all, I amtrying to publish a msgs with large data size on Arduino. I have tried both Float32MultiArray and Laserscan msgs. However, when i increase the data_length more than 7, 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). If I keep the size below 7, the msgs can be published normally.
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();
}</std_msgs></ros></ros.h>