It would be helpful if you include the output that describes where that error is occurring (which line of the program). In addition, it seems like using rospy in your program is unnecessarily complicating things at this point and making it harder to debug.
Have you tried running the example Python programs included with our Raspberry Pi slave library for Arduino? If they work for you, could you trim your program down to something very minimal (for example, only call a_star.motors() without using rospy) and then gradually try adding your other code back in until you encounter a problem?
By the way, you don’t need int() around your arguments to a_star.motors().
Ok, after sometime I was able to diagnose the issue. The framework I was using, ROS, was running the script I wrote as python 2 script. I was able to get it to run it as a python 3 script but it doesn’t seem very stable.
Is there a a_star.py script that will work with python 2?
The scripts were originally written for Python 2 and later converted to Python 3 in version 2.0.0, so you might be able to use an older a_star.py from version 1.0.1 of the library. That version does not have the read_encoders() function, so you would have to add it back in if you use it.
Cool, I was able to get it to work with the old version of the a_star.py script. I noticed however that it doesn’t include a function for reading the IMU data from the arduino. How could I fix this?
In the your setup, the Raspberry Pi is the I²C master, so it needs to communicate directly with the sensor chip; the AVR will not be involved. To be clear, you are using a Romi 32U4 Control Board, right? Unfortunately we do not have any complete example code for controlling the LSM6DS33 on that board with a Raspberry Pi. However, there are various example projects online that you could look at. For example, here is a blog post I found in a series about connecting a Raspberry Pi to a MinIMU-9 v5, which includes an LSM6DS33.
We also have this example code for the Balboa robot, which is a work in progress but contains code for communicating with the LSM6DS33.