IOErrors - Kind of need urgent help!

Hi all,

My name is Kadar and I’m a student at James Madison University. Our ISAT department has 6 of your GoPiGo robots and we love the product so far, but are running into some issues!

We have our final project due Monday and got together as a group to run our code, but each of our robots gives us “IOError”'s when we run the code. I’ve tried now on two different GoPiGo kits and with multiple SD cards – no dice.

Since the errors were vague, I looked at the gopigo.py file and edited the exceptions to include which method was having issues, and it seems to be the write_i2c_block code that is causing our errors.

To be specific, when we send something like fwd(), time.sleep(1), left(), it’ll either carry out one command, or all, or none. It’ll IOError on the commands it can’t carry. This happens whether I try pre-provided code (basic_robot_control.py) or self-written code.

My knowledge in Linux is enough to be comfortable working on it and working in the CLI, so don’t be afraid to give me technical instructions to carry out – that’s not an issue.

Some details that you might ask for: Yes, I have updated the firmware to 1.3 and YES I disconnected the motors before doing so. I have tried on two different GoPiGo kits and have the same issue. I will try again after wiping the SD card clean and re-installing tonight, but I’m not getting my hopes up. I have tons of fresh batteries and my voltage is usually around 9.8 or so. I don’t have any trim settings right now but that’ll be the next minor tweak to make.

Please let me know what this error means and how I can go about fixing it. It’d be absolutely amazing if a developer can be involved in the conversation and I can reference our conversation to my instructor to prove that it may be an issue outside of our control. I am the most tech-savvy in our group and have taken a strong leadership role in guiding everyone, but this issue is very frustrating and everyone is looking to me for an answer.

I can provide screenshots or whatever else you may need.

Thank you, and sorry for the long post!

Hey Kadar, great to hear you like the GoPiGo! I’ll try to walk you through the problem, it’s not clear to me right away what the problem is.

It sounds like you’re having some communications drop out on the I2C bus. Did you add anything on to the bus (like some sensors), or change anything about the hardware?

Did this problem just start? If it worked at one point previously, what have you changed?

Can you send:

  • Pictures of the GoPiGo setup, as you run it. Just to give us an idea of anything that might have changed.
  • A screenshot of i2cdetect (sudo i2cdetect -y 1). (If possible, run this 5-10 times and tell us how many times it’s dropping out).
  • Screenshot of the IOErrors and what leads to it.

I don’t think this is an SD card problem, but thanks for checking that. If some of the communications are getting through and some of the commands are successful, I don’t see how that could be the root of the problem.

Thanks Kadar!

Hey John,

Let me answer your questions in order:

  • No, nothing was added to the bus. AFAIK, stock setup, nothing extra added (no extra sensors, etc). We’re just supposed to show an understanding of Python by making the robot move in a pre-defined pattern, blink the LED’s, etc. Nothing about the hardware was changed AFAIK.

  • The problem was first noticed after we upgraded to the most recent firmware of 1.3. The professor upgraded everyones’ firmware to address the trim issue in the motors, and that is when we realized this problem existed.

  • The only change made, as stated above, was upgrading to v1.3 firmware

  • Here are some imgur links to pictures to show you the issues I’m having.
    (1) showing the code I’m executing
    http://imgur.com/SW4kIs4

(2) showing the IOError’s that happen which prevent me from stopping the robot (it almost fell off my table!). I had to ctrl+C to stop it, re-run the program, and issue the command that way, which is why you see the keyboardinterrupt. Also shown is the write_i2c_block_data error. This is of a brand new installation with v1.3 firmware and no other changes made (besides a static IP address).
http://imgur.com/xKxJ1zt

(3) running the i2cdetect command
http://imgur.com/h9EdW5V

(4) physical picture of the robot. ignore the captions, those are for my report.
http://imgur.com/OlOtBmb

Hopefully this helps! We’ve discussed these issues with the professor and he is having us just record the robot moving one command at a time to demonstrate that we understand the concept. We’re writing a detailed report on the issues and the solutions we found.

Thanks again for your help!

Hey,
For some reason, the imgur images with the error and the i2cdetect output is are not showing up, can you please check the links and add them again.

-Karan

Hey folks, I think the issue might be in the code. Karan, for whatever reason, I can see the imgur pictures.

Somewhere inside your while loop, before the if loop, I think you need to add the line
a = raw_input()

Can you try this? It would make a lot of sense that the variable “a” never changes in the code you’ve posted; you go into the while loop, but the value of “a” never changes or never gets the chance to change.

You may also want to just download the code from Github we have, and test that. I didn’t realize that you were running some alternate code on the GoPiGo.

Sorry Karan, I deleted the imgur links without realizing their linked here (I’m cautious about having my name out there too much). I’ll add new images here shortly.

And John, I’ve run the code that comes with the Dexter wheezy image (/Desktop/GoPiGo/Python/Software) and sometimes I get errors, other times I don’t, but that code (basic_test_all.py) is a bit more complicated than the code we were asked to write (I could easily emulate it, but that wasn’t part of the project).

If it’s really just a matter of adding the raw_input() inside the while loop, I’m going to smack myself :stuck_out_tongue: I don’t have the robots with me anymore as the project is now complete, but I am in touch with the professor and can arrange to have access to them. I’ll also point him to this thread so he can see the issue.

The only question I have that remains is that we had two different groups with two different robot setups have the same issue at the same time after the firmware update. The one group didn’t touch their code before coming to my apartment to use the robots, and they encountered the same errors at the same time as us.

Is the error because the raw_input() line isn’t inside the loop, therefore it’s only prompting for the input once? Syntactically, that makes sense.

Imgur album here:

Thanks for your help!

Hey,
It looks like the problem is because of not having the raw_input() in the loop and absence of a small delay before sending commands.

Since you don;t have the raw_input() in the code, the same command is being sent again and again very fast to the GoPiGo. You should send commands to the GoPiGo after a small delay. A small delay of 100ms should be good enough. You can add a delay by adding time.sleep(.1) at the end of the loop/

Do let us know if this helps.

-Karan