rosserial Device Lost Sync, restarting
I'm using an Arduino 2560. Does anyone have any suggestions on how I can diagnose this? My total sketch size is 60k bytes. I won't include all the code since there's a lot but here's some relevant parts.
#include <ros.h>
#include <std_msgs/Int8.h>
#include <std_msgs/String.h>
#include <sensors/Analog.h>
#include <boxing_start/parameters.h>
#include <networking/WifiList.h>
#include <networking/WifiConnect.h>
ros::NodeHandle nh;
using networking::WifiList;
using networking::WifiConnect;
void setup()
{
nh.initNode();
nh.serviceClient(client2);
delay(100);
nh.serviceClient(client3);
nh.advertise(p_analog);
while(!nh.connected()) nh.spinOnce();
nh.loginfo("Startup complete");
current_menu = 1;
}
void loop()
{
nh.spinOnce();
At this point I have a touch screen menu and each part of the menu sets a global variable that tells me what the current menu page is and then I use a switch statement to branch off into individual loop functions. All works fine.
One of the loop functions runs this:
I've got 2 service clients and 1 publisher. From my understanding that's not too much.
If I use rostopic echo /Analog when that part of the loop function is running sometimes it'll return results but usually it's nothing. I doubt it's the code below because it will timeout before I get to the menu that runs that.
analog_msg.pressure1 = analogRead(pressurePin1);
analog_msg.pressure2 = analogRead(pressurePin2);
analog_msg.pressure3 = analogRead(pressurePin3);
analog_msg.pressure4 = analogRead(pressurePin4);
analog_msg.pressure5 = analogRead(pressurePin5);
analog_msg.accel1 = analogRead(accelPin1);
p_analog.publish(&analog_msg);
rosrun rosserial_python serial_node.py
[INFO] [WallTime: 1344388173.077256] ROS Serial Python Node 1
[INFO] [WallTime: 1344388173.086662] Connected on /dev/ttyACM0 at 57600 baud
[INFO] [WallTime: 1344388175.211573] Note: publish buffer size is 512 bytes
[INFO] [WallTime: 1344388175.260775] Starting service client, waiting for service 'WifiList'
[INFO] [WallTime: 1344388175.269687] Setup service client on WifiList [networking/WifiList]
[INFO] [WallTime: 1344388175.273153] Starting service client, waiting for service 'WifiConnect'
[INFO] [WallTime: 1344388175.280700] Setup service client on WifiConnect [networking/WifiConnect]
[INFO] [WallTime: 1344388175.301110] Setup publisher on Analog [sensors/Analog]
[INFO] [WallTime: 1344388175.304173] Note: subscribe buffer size is 512 bytes
[INFO] [WallTime: 1344388175.308926] Startup complete
[ERROR] [WallTime: 1344388188.090867] Lost sync with device, restarting...
if I remove all the references to the Publisher the problem still exists with just the two service clients.