Difference in rate when running arduino w/ and without ROS
I have arduino code that takes readings from a bunch of sensors (IMU, hall sensors, encoder, gps). The details of the code are unimportant, but as it stands the loop runs at about 100hz on the arduino when ROS is not running. However, when I run ROS on my raspberry pi (which is connected to the arduino) the rate slows to about 10hz. I run all of my nodes in rospy at 100hz, so I am unsure if this delay is incurred by serial communication or something else. At the end of my arduino code my node head makes a call to spinOnce(). If I am running rospy on my raspberry pi should I be using a multi-threaded spin()? Any thoughts or other ideas? Has anyone experienced an issue like this and been able to fix it? I need to be running at at least 50 hz to get the PID controller we use working.